Using TI cc2540 cc2541 32kHz Crystal Oscillator as a RTCC

Jump to: navigation, search

A real time clock counter using the cc254x 32kHz crystal oscillator is easily implemented using the performPeriodicTask subroutine which should run at least a few times per second. In this subroutine you should check the Most Significant Bit of ST1. Every time that bit flips you should increment your counter by one second. Note that the PERIODIC_EVENT_INTERVAL is in milliseconds but it has a systemic negative error (loses about a minute a day). The specification for the jitter of the oscillator should result in a worst case error of a few seconds a day. So do not, for example, set the interval to 100ms and increment your counter on every 10th execution of the periodic task. You'll have significant error from day one. It is good practice to read the value of ST0 before reading ST1 as this latches the timer value.

See also

Use your Android as a Genie garage door opener remote

Personal tools
Namespaces
Variants
Views
Actions
Navigation