MB2146-450-E Setup Guide
Chapter 4 Sample Code Manual
MCU-AN-500072-E-10 – Page
34
4.2.7 RTC .c
In this function, we should initialize clock register, start time base timer, set display value for
LCD and set condition to enter standby mode
Following table describes the LCD library:
Function Name
Description
void TBT_Init(void)
Initializes time base timer
__interrupt void TBT_Inter (void)
Time base timer interrupt for 0.35ms arrived
void STB_Mode_Set(void)
Set standby time
Following table describes how to use these functions.
Example
Type
Operation
Return
Enable RTC
TBT_Init();
Sets interval time
Set standby time
TBT_Init();
PraBli.Bli_6 = 0x01;
PraBli.Bli_7 = 0x00;
PraBli.Bli_8 = 0x00;
PraBli.Bli_9 = 0x02;
PraBli.Bli_a = 0x06;
STB_Mode_Set();
PraBli.Bli_6 is hour,
PraBli.Bli_7 and PraBli.Bli_8 are
minute,
PraBli.Bli_9 and PraBli.Bli_a are
second.
In this example setting after 1hour
26seconds the system will standby
Standby and
Wake up
EXT_Init();
TBT_Init();
PraBli.Bli_6 = 0x01;
PraBli.Bli_7 = 0x00;
PraBli.Bli_8 = 0x00;
PraBli.Bli_9 = 0x02;
PraBli.Bli_a = 0x06;
STB_Mode_Set();
Press “wakeup” key system wake
up