SuperH-based fx calculators
fx-CG20, RTC

Legacy RTC syscalls
syscall 0x02BF: void RTC_Reset( uint mode );
Resets the RTC, if mode!=0 all registers are set to zero.

syscall 0x02C0 : void RTC_GetTime( unsigned int*hour, unsigned int*minute, unsigned int*second, unsigned int*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.

syscall 0x02C1 : int RTC_GetTicks(  void  );
Returns the RTC-basecount in units of 1/128 s. The count restarts at zero after midnight.

syscall 0x02C2: 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.

syscall 0x11DD: void RTC_TriggerAlarm( void );
resets alarm flag and enables alarm interrupt.

syscall 0x11DE: 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.
syscall 0x11E2: void RTC_GetDateTime( unsigned char[7]*timestr );
Gets 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)
timestr[7]: day of week is set to zero.

 

(08.08.2011 14:47:41)