Greetings. I have a small process control setup running in a single MSP430 uC. The process has certain scheduled tasks, so I wrote a clock/calendar into the program using the WDT to generate a 1 sec interrupt. The process is important but not safety critical. Consequences of processor crash are repeat of up to 24 hours work plus consternation from the production supervisor. Is it advisable to use the processor to keep time in this way? What are the advantages of a dedicated RTC chip? Advice appreciated.
It will depend on the time-keeping needs of your system. Are the scheduled tasks daily ones or is the schedule run over many days? From the above I am guessing a daily schedule (things happening at the same time every day).
If the process allows and you have some non-volatile memory available you could write a marker into it for every set-interval that is passed (1 minute, 10 minutes etc). This way you won't have missed too much at the restart.
If the actual time is more important then you could wait at the restarts for the supervisor to enter the time before proceeding, or go fetch the time from any other external source. These can include radio coded transmissions (GPS, WWV etc) or an RTC chip. There are some nice serial RTC chips around that will work with the MSP430's I2C interface.
Paul E. Bennett ....................
If your MSP430 compiler allows, you could set up your software RTC to keep a seconds count in RAM which is not cleared at startup. If your restart proceeds with minimal delay, you should lose very little time on the clock. And if your system is restarting often enough to lead to significant long-term RTC drift, you have other problems. Given the low power requirements of the MSP430, it is not too difficult to implement a backup battery to keep the processor alive through power glitches.
I find the MSP430 processors to be really nice for the implementation of an RTC and a group of smart peripheral devices.
The main advantage of an RTC chip is that it can keep counting the time with little power (small battery or cap) if the main power goes down. If your application does not need to keep the time between power down and up, you don't need an RTC.
A microcontroller and crystal does not have the accuracy for long term time keeping. You my be off by several minutes or more a month. You would need to use the line frequency (very good in US and Europe) or a better Xtal/ Oscillator. Unless you clock does not require that much accuracy.
Depends of the energy you have available. If you should rely on a superCAP then a dedicated (true) RTC is a magnitude of
10 or better in current consumption.
In fact power below 0.5 uA for a small SO8 like the Marin V3020 chip is IMHO impossible to do in FW...with a uC solution. The cost is not even a (major) key factor. Such a Real Time solution costs less than 1.5$ RTC chip + crystal.
[Just beware that real RTC need very little energy to become crazy too.]
Finally it depends of the volume, If you want to spent time... Once I was in a seminary were the referee was talking about company having time and other having money...on the other side of the river ... It's up to you....
However I'm still locking for a solution for a soft RTC solution that realy works on a 8 bit microcontroller or even on a 16 bits one like MSPxxx. (In fact conversion between "ripple" counter and real time likeYY.DD.MM:HH:MM:SS with leap years and ... in both direction (the absolute time (date) reference does not matter) ! is maybe not trivial . Just a matter of available $$$ budget, time and (real)power available...
Thanks for every advice.
Bibico [suffocated in junk mail therefore junk reply address...sorry]