Closed ra1fh closed 1 year ago
The official documentation is not very clear about the ordering. Some Z180 manuals contain a timing diagram that shows TCR first and TMDR second. I could only find one source about HD64180 that mentions that order is important:
This was found with ds1302 enabled btw. The time quickly ran away and started to jump centuries when the timer interrupt triggered too fast. With the fix in place, ds1302 works fine.
Interesting little quirk. I'll go ripple that through the other Z180 ports
To reset the timer interrupt, read TCR first and then TMDR0L. Otherwise, on Z8S180-K the timer interrupt triggers with double of the intended frequency.