SuperH-based fx calculators
fx legacy: RTC

0x039: void RTC_Reset( uint mode );

Resets the RTC, if mode!=0 all registers are set to zero.


0x03A: void RTC_GetTime( uint*hour, uint*minute, uint*second, uint*millisecond );

Reads the consistent time into hour, minute, second and millisecond, resp.. The function repeats automatically when a carry occurs. milliseconds is only as exact as the 1/128 second base-tick allows.


0x03B: int RTC_GetTicks( void );

Returns 1/128 second ticks. The count restarts at zero after midnight.


0x03C: int RTC_Elapsed_ms( int start_value, int duration_in_ms );

start_value has to be set with RTC_GetTicks.
duration_in_ms is the duration, which has to elapse since start_value.
returns 0 if duration_in_ms has not elapsed yet
returns 1 if duration_in_ms has elapsed

Advantage: the routine does not block!
Special care has to be taken, when start_value has been set before midnight and RTC_Elapsed_ms is called after midnight, because RTC_GetTicks restarts at zero after midnight.


0x23D: void RTC_TriggerAlarm( void );

resets alarm flag and enables alarm interrupt.


0x23E: void RTC_SetDateTime( unsigned char[7]*timestr );

Sets the RTC time.
timestr[0] and timestr[1]: year in BCD (f. i. 0x20 0x08)
timestr[2]: month in BCD (f. i. 0x03)
timestr[3]: day in BCD (f. i. 0x02)
timestr[4]: hour in BCD (f. i. 0x19)
timestr[5]: minute in BCD (f. i. 0x47)
timestr[6]: second in BCD (f. i. 0x03)
Day of week is set to zero.


(14.03.2011 13:32:22)