Hi everyone, I need some help with a project that I'm trying to do. Is there a macro to get the current date and time from the HCS12? I'm trying to get the date and time to output toTera Term when an interrupt triggers. I shouldn't have a problem with the output to Tera Term as long as I can figure out how to get the current date and time. Thanks in advance for any suggestions.
The HCS12 does not have a native clock you can read to get out date and time. You must program a clock yourself. An
excellent reference which contains all the code you need for a real time clock is "Programming the Motorola M68HC12
Family", by Gordon Doughman, 2000, Annabooks, http://www.annabooks.com/. That program uses power line interrupts
for accuracy.
My own HCS12 runs a PLL at 48 Mhz and generates 30 interrupts per second using the Modulus counter. The program
maintains a set of counters for seconds, minutes, hours, days, months, and year. My board's crystal oscillator is
accurate enough for my needs.
Thanks for the advice. I actually did some research and found that my dragon board has an on-board RTC that communicates using IIC.