View previous topic :: View next topic |
Author |
Message |
aaronik19
Joined: 25 Apr 2011 Posts: 297
|
Ds1302 alarm |
Posted: Sat Dec 29, 2012 12:48 pm |
|
|
Dear all, unfortunately after the design I noticed that the chip for the rtc are ds1302. These chips have no alarms so I need to make software alarms. Can someone explain how can I achieve this ? |
|
|
temtronic
Joined: 01 Jul 2010 Posts: 9245 Location: Greensville,Ontario
|
|
Posted: Sat Dec 29, 2012 2:20 pm |
|
|
comment
probably a few ways to do it ,depending on the PIC type and what 'alarm times' you need...
step one...save the 'alarm times' into RAM or EEPROM or hardcode into program memory. it's up to you to decides where to put them.
step two...in 'main' have a simple if(current_time==alarm_time){do this} type of code....
there are several examples on this forum and in the examples folder that
CCS supplies...
..also look at any DS RTC with alarms to see how they setup to do it..
how 'fancy' the code becomes depends on you as only you know you want it to work! In my energy control systems I only need a byte to store any 'alarm time',you'll probably need more..
hth
jay |
|
|
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
|
|