- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I had made a code to display time on LCD and get time through internal RTC but when i reset the controller or reprogram the controller the time gets to its original preset setting on RTC.
please help with any example code and schematic.
thanks in advance.@
Solved! Go to Solution.
- Labels:
-
PSoC 5 Device Programming
-
PSoC 5LP
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
The RTC component is a pure software solution. So you need to set the time and date aftera reset.
Bob
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
How to do that i had no idea. can you give me an example code of RTC on PSOC 5LP.
thanks.
paras
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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.
Bob
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Your code will look something like this:-
void RTC_Startup_init()
{
Start.Sec = 00u;
Start.Min = 00u;
Start.Hour = 00u;
Start.DayOfMonth = 01u;
Start.Month = 01u;
Start.Year = 2018u;
RTC_WriteTime(&Start);
RTC_WriteIntervalMask(RTC_INTERVAL_SEC_MASK);
RTC_Start();
//RTC_Enable();
// RTC_SetPeriod(32768,32768);
}
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.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Is there any way to retrive time after reset in PSOC.?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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.
thanks
Paras
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
As far as I know, it is all but impossible to find out "off time" with the internal RTC.