Data Structures | |
struct | timestruct |
Defines | |
#define | WRITE_OFFSET 0x80 |
#define | EOSC 0x80 |
#define | WP 0x40 |
#define | INTCN 4 |
#define | AIE1 2 |
#define | AIE0 1 |
#define | INT0 0x04 |
#define | INT1 0x08 |
#define | RTC_CS_MASK 0x04 |
#define | RTC_CE_SETUP() DDRK|=RTC_CS_MASK |
#define | RTC_CE_ON() PORTK|=RTC_CS_MASK |
#define | RTC_CE_OFF() PORTK&=(~RTC_CS_MASK) |
#define | TIME2RTC(data) (((data/10)<<4)+(data%10)) |
#define | RTC2TIME(data) (((data>>4)*10)+(data&0x0f)) |
#define | RTC_SECONDS RTC_Read_Register(SEC) |
#define | RTC_MINUTES RTC_Read_Register(MIN) |
#define | RTC_HOURS RTC_Read_Register(HOURS) |
#define | RTC_DAY RTC_Read_Register(DAY) |
#define | RTC_DATE RTC_Read_Register(DATE) |
#define | RTC_MONTH RTC_Read_Register(MONTH) |
#define | RTC_YEAR RTC_Read_Register(YEAR) |
#define | RTC_SET_SECONDS(data) RTC_Write_Register(SEC,TIME2RTC(data)) |
#define | RTC_SET_MINUTES(data) RTC_Write_Register(MIN,TIME2RTC(data)) |
#define | RTC_SET_HOURS(data) RTC_Write_Register(HOURS,TIME2RTC(data)) |
#define | RTC_SET_DAY(data) RTC_Write_Register(DAY,TIME2RTC(data)) |
#define | RTC_SET_DATE(data) RTC_Write_Register(DATE,TIME2RTC(data)) |
#define | RTC_SET_MONTH(data) RTC_Write_Register(MONTH,TIME2RTC(data)) |
#define | RTC_SET_YEAR(data) RTC_Write_Register(YEAR,TIME2RTC(data)) |
Enumerations | |
enum | registers |
Functions | |
int | RTC_Write_Register (int reg, u8 data) |
u8 | RTC_Read_Register (int reg) |
int | RTC_GetTime (timestruct *time) |
int | RTC_SetTime (timestruct *time) |
|
Get the current time from the RTC This function reads the current time stored in the RTC's internal registers. Alternatively each individual register can be returned using the RTC_ macros below
|
|
Read from a RTC register
|
|
Set the current time of the RTC This function sets the current time stored in the RTC's internal registers. Alternatively each individual register can be written using the RTC_Write_Register function.
|
|
Write to a RTC register
|