DS1305 Module


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)

Detailed Description

This module provides functions for accessing and controlling a DS1305RTC, which currently only exists on the iPAC-HCS12

Function Documentation

int RTC_GetTime 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

Parameters:
time a timestructure that GetTime fills with data
Returns:
SUCCESS

u8 RTC_Read_Register int  reg  ) 
 

Read from a RTC register

Parameters:
reg he register to write to(from the enumerated registers above)
Returns:
the byte that was read

int RTC_SetTime timestruct time  ) 
 

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.

Parameters:
time a timestructure SetTime writes to the clock
Returns:
SUCCESS
See also:
RTC_Write_Register function.

int RTC_Write_Register int  reg,
u8  data
 

Write to a RTC register

Parameters:
reg the register to write to(from the enumerated registers above)
the data to write to it
Returns:
SUCCESS


Generated on Fri Mar 3 17:25:46 2006 for EMAC-HCS12-SDK by  doxygen 1.4.6