I’m currently working on a project using the Renesas RL78/G22 microcontroller, where I need to implement the led is ON for 7 hours and led is OFF for 17 hours for 160 days. I am using rtc as subsystem clock(fsxr)-32.678 Khz external clock. When I trigger the switch the led will On for 7 hours (10:00:00) and off for 17 hrs(05:00:00) this is my condition but the problem is if i trigger the switch the led is on at 10:00:00 the led should off at 05:00:00 but the led is turning off at 04:59:00.If this happens continuosly at the 160 th day there will be 3 hours delay. How to solve this problem? Can please someone help me out.
Hello,
I assume that you are using the alarm detection function of RTC. A way to implement this is to set the initial alarm value on Smart Configurator and update the alarm value every time you get an alarm interrupt.
The alarm register values for 10:00 every day are:
ALARMWM = 0x00
ALARMWH = 0x10
ALARMWW = 0x7F
The alarm register values for 05:00 every day are:
ALARMWH = 0x05
If the alarm interrupt is earlier than expected, please check if the RTC accuracy is correct or needs to be corrected. (see 8.4.6 at https://www.renesas.com/en/document/mah/rl78g22-users-manual-hardware?r=25408646 )
Regards
Hello We are configured rtc based on the counter which is 1440 counts is equal to 24 hours format. For the configuration I am facing the latency issue. Since I am new to the reneseas controller (RL78/G22) how to correct the RTC accuracy. Please help me out.
There is an application note with sample code on this topic:
RL78 Family Real-Time-Clock Watch Error Correction function