C18 LaurTec Library  2.5
Open Source C Library for PIC18 Microcontrollers
LaurTec_c18_libraries_v_2.5/inc/PCF8563.h
Go to the documentation of this file.
00001 
00002 /***********************************************************************************************
00003 
00004 Author : Mauro Laurenti
00005 Version : 1.0
00006 Date : 4/9/2006
00007  
00008 CopyRight 2006 all rights are reserved
00009 
00010 
00011 ********************************************************
00012 SOFTWARE LICENSE AGREEMENT
00013 ********************************************************
00014 
00015 The usage of the supplied software imply the acceptance of the following license.
00016 
00017 The software supplied herewith by Mauro Laurenti (the Author) 
00018 is intended for use solely and exclusively on Microchip PIC Microcontroller (registered mark).  
00019 The software is owned by the Author, and is protected under applicable copyright laws. 
00020 All rights are reserved. 
00021 Any use in violation of the foregoing restrictions may subject the 
00022 user to criminal sanctions under applicable laws (Italian or International ones), as well as to 
00023 civil liability for the breach of the terms and conditions of this license. 
00024 Commercial use is forbidden without a written acknowledgment with the Author.
00025 Personal or educational use is allowed if the application containing the following 
00026 software doesn't aim to commercial use or monetary earning of any kind.    
00027 
00028 THIS SOFTWARE IS PROVIDED IN AN "AS IS" CONDITION. NO WARRANTIES, 
00029 WHETHER EXPRESS, IMPLIED OR STATUTORY, INCLUDING, BUT NOT LIMITED 
00030 TO, IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A 
00031 PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. THE AUTHOR SHALL NOT, 
00032 IN ANY CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL OR 
00033 CONSEQUENTIAL DAMAGES, FOR ANY REASON WHATSOEVER.
00034 
00035 ********************************************************
00036 PURPOSES
00037 ********************************************************
00038 
00039 This libary is supposed to be used to drive the PCF8563 or compatible 
00040 devices
00041 
00042 //**********************************************************************************************
00043 
00044 */
00045 
00046 #include <i2c.h>
00047 
00048 #ifndef FLAG_PCF8563
00049 #define FLAG_PCF8563
00050 
00051 //**************************************************
00052 // you must change this address if
00053 // you change the device.
00054 //**************************************************
00055 
00056 #define WRITE_ADD 0xA2  
00057 
00058 //**************************************************
00059 // Definition of Day constants (Italian, English)
00060 //**************************************************
00061 
00062 // Italian
00063 
00064 #define DO 0x00 
00065 #define LU 0x01
00066 #define MA 0x02
00067 #define ME 0x03
00068 #define GI 0x04
00069 #define VE 0x05
00070 #define SA 0x06
00071 
00072 // English
00073 #define SU 0x00
00074 #define MO 0x01 
00075 #define TU 0x02 
00076 #define WE 0x03 
00077 #define TR 0x04 
00078 #define FR 0x05 
00079 #define SA 0x06 
00080 
00081 
00082 //**************************************************
00083 //                      Standard Constant
00084 // enable value for the allarm bit (day,month,dayweek)
00085 //**************************************************
00086 
00087 #define Enable_ON  0b00000000   
00088 #define Enable_OFF 0b10000000
00089 
00090 
00091 //**************************************************
00092 //           Address constants
00093 //**************************************************
00094 
00095 #define CONTROL_REG_2_ADDR              0x01
00096 #define SECONDS_ADDR                    0x02
00097 #define MINUTES_ADDR                    0x03
00098 #define HOURS_ADDR                              0x04
00099 #define DAYS_ADDR                               0x05
00100 #define DAY_WEEK_ADDR                   0x06
00101 #define MONTHS_ADDR                             0x07
00102 #define YEARS_ADDR                              0x08
00103 #define MINUTS_ALARM_ADDR               0x09
00104 #define HOURS_ALARM_ADDR                0x0A
00105 #define DAYS_ALARM_ADDR                 0x0B
00106 #define DAY_WEEK_ALARM_ADDR     0x0C
00107 
00108 
00109 //**************************************************
00110 //           Limits constants
00111 //**************************************************
00112 #define MAX_MINUTES      0x60
00113 #define MAX_HOURS        0x24
00114 #define MAX_YEARS        0x99
00115 #define MAX_MONTHS       0x13
00116 #define MAX_DAYS                 0x32
00117 
00118 
00131 signed char set_seconds_RTCC (unsigned char seconds);
00132 
00133 
00141 unsigned char get_seconds_RTCC (void);
00142 
00143 
00156 signed char set_minutes_RTCC (unsigned char minutes);
00157 
00158 
00166 unsigned char get_minutes_RTCC (void);
00167 
00168 
00181 signed char set_hours_RTCC (unsigned char hours);
00182 
00183 
00191 unsigned char get_hours_RTCC (void);
00192 
00193 
00200 unsigned char* get_time_seconds_RTCC (void);
00201 
00202 
00209 unsigned char* get_time_RTCC (void);
00210 
00211 
00224 signed char set_days_RTCC (unsigned char days);
00225 
00226 
00234 unsigned char get_days_RTCC (void);
00235 
00236 
00250 signed char set_day_of_the_week_RTCC (unsigned char day_of_the_week);
00251 
00252 
00261 signed char get_day_of_the_week_RTCC (void);
00262 
00263 
00276 signed char set_months_RTCC (unsigned char months);
00277 
00278 
00286 unsigned char get_months_RTCC (void);
00287 
00288 
00302 signed char set_years_RTCC (unsigned char years);
00303 
00304 
00312 unsigned char get_years_RTCC (void);
00313 
00314 
00315 
00322 unsigned char* get_date_RTCC (void);
00323 
00324 
00341 signed char set_minutes_alarm_RTCC (unsigned char minutes, unsigned char alarm_enable);
00342 
00343 
00360 signed char set_hours_alarm_RTCC (unsigned char hours, unsigned char alarm_enable);
00361 
00362 
00379 signed char set_days_alarm_RTCC (unsigned char days, unsigned char alarm_enable);
00380 
00381 
00399 signed char set_day_of_the_week_alarm_RTCC (unsigned char day_of_the_week, unsigned char alarm_enable);
00400 
00401 
00412 signed char enable_alarm_interrupt_RTCC (void);
00413 
00414 
00425 signed char disable_alarm_interrupt_RTCC (void);
00426 
00427 
00436 unsigned char is_alarm_ON_RTCC (void);
00437 
00438 
00450 signed char increment_minutes_RTCC (void);
00451 
00452 
00464 signed char increment_hours_RTCC (void);
00465 
00466 
00478 signed char increment_years_RTCC (void);
00479 
00480 
00492 signed char increment_months_RTCC (void);
00493 
00494 
00507 signed char increment_days_RTCC (void);
00508 
00509 
00510 #endif
00511 
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Defines