The RTC component is a pure software solution. So you need to set the time and date aftera reset.
How to do that i had no idea. can you give me an example code of RTC on PSOC 5LP.
When you right-click onto the RTC component and select for code examples you are presented with more than 10 example projects. Most difference from PSoC5 to PSoC4 is the source of the interrupt tick used to advance time count.
Your code will look something like this:-
Start.Sec = 00u;
Start.Min = 00u;
Start.Hour = 00u;
Start.DayOfMonth = 01u;
Start.Month = 01u;
Start.Year = 2018u;
If you set the time at the start of the reset via UART or any other input then it will work.
If you want a quick and dirty solution, use a DS1307 IC over I2C , it holds on to its time sample even after reset.
Is there any way to retrive time after reset in PSOC.?
You can enter the data manually via UART or keypad everytime the uC starts or you can try writing active time to EEPROM every second. And then read the EEPROM data as starting time for the UC.
i set the RTC once but again when we re program PSOC or reset the controller it does not retain the time in RTC. rtc must retain the time.
The RTC retains data if you make it retain data. When you normally assign any variable data while the microcontroller is running, it it saved in RAM. When power goes off then the RAM powers down. If you want the data to remain after a reset then you have to store it in a non-volatile place like flash, EEPROM or external memory. As far as I know, the RTC component does not have this automatically.
You can also try the CY_NOINIT as Evgeniy suggested but I personally have never used this system.
Also I am old enough to remember systems where the not initializing variables would ensure that you get garbage results. So I have a few mental blocks about NOINIT.
yes exectly we need to store the time / rtc data into a non-volatile memory. but is there any way to find the period between the resets/ power down.
like i start RTC it shows x timing, i powered down it and detected power down and saved the time in EEPROM, after 10 minutes i powered it.
i want that some how i find this time between power downs so that i can get the timing back.
As far as I know, it is all but impossible to find out "off time" with the internal RTC.