Joey
Thanks, I think that I have managed to get it running now. The reason is the fact that writes to the RTCGOCL must be long word writes. 16 bit writes have no effect and it is not possible to write from the register view in the debugger since this (presumably) attempts 16 bit writes. Also the value written is not displayed in the CW7.0 register view (always displays 0x0000 even though the RTC is correctly counting seconds). Finally, the RTC registers do not show in the memory viewer (can't explain why).
I couldn't find the MCF_RTCGOCL definition in MCF52210.h so I assume you added it as
unsigned long. The other guy added it as
unsigned short (as I originally did too), which doesn't allow it to work.
The other misleading point is that the users' manual shows a table where 0x8000 is written for 32kHz but it seems as though 0x2000 really is the correct value...presumably the input is divided by 4 somewhere(?).
So that the RTC and oscillator are only configured once you can check the state of the RTCCR and jump the configuration if it is already configured (rather than downloading different code).
To use the day counter for data you will need to calculate the number of days after a specific reference date (eg. 1.1.2008). This is not that complicated since leap years occur every 4 years from, and including, 2008 - so any year dividable by 4 up to 2099 (then there is the next exeption to the rule).
Knowing the number of days in a year and days in each month, the exact data can be interpreted.
Regards
Mark
www.uTasker.comMessage Edited by mjbcswitzerland on
2008-06-09 10:07 PM