Capture Time, day, month and weekday in RTC
masselon Posts: 27
in Propeller 1
RTC_DEMO.spin Version 1.01
│ Author: Mathew Brown │
│ Copyright (c) 2008 Mathew Brown │
RealTimeClock.spin Version 1.01
How someone can capture data in the refered objects to triger events in specific date in timeline dayly or weekly or monthly?
Thanks in advance.
You should post a link to that code -- better yet, given its age, post the code.
My fault for not being more specific; embedding snippets okay (please learn to use code block in the format menu), but copy-and-paste of the whole file, especially without code formatting is not the way to go. See Evan's post on how to attach files.
That said, I waded through. You could create trigger values in the mstime format provided by then object, the read the current rtc in the format and do a simple compare. It should be easy.
The bigger question becomes.... what do you do on a power loss when your RTC is running in a cog? How does it get reset correctly when power is restored? You might consider an external RTC module that has a battery back-up. These are typically I2C and can usually share the EEPROM I2C pins.
I've added 3 backticks around your code snippet for you. That enables code view. If you edit your own post above, you can see what I did so that you'll know next time.
If you need any more help with the feature, please ask anytime.
"That said, I waded through. You could create trigger values in the mstime format provided by then object, the read the current rtc in the format and do a simple compare. It should be easy."
Since the PUB Main execute a infinite loop, how do I do to make the code skip the loop to execute the new Pub (pack_mstime (yr, mo, dy, hr, mn, sc) : result) and compare if hr, e.g, is = 20?
You would need to use pack_mstime() before your loop to create trigger values. Inside your loop you would test by calling the current time in MS format and comparing it to your triggers. Note that the MS format has a 2-second resolution, so you need to have some kind of flag that tells you not to use that flag again until you have a real retrigger event. These things take planning and thought. I wrote code for a gentleman whose elderly mom needed reminders to take medicine at specific times of day. As I had created a P1-based WAV player for EFX-TEK, we adapted it to an audio reminder by adding an RTC module and creating triggers in a table that the software accessed.
Thank you Jon McPhalen