Quote Originally Posted by Adrian View Post
I changed the bit of maths and hey presto the programme instantly came good. It is cycle accurate all the way up. I'm really pleased...so many thanks.
That's Great!
Didn't think that was it, but now I'm glad it was.
Thanks for helping me find the problem!

> You did this using ASM. Presumably this could also be done in PBP?

It can be done with only PBP statements. But it's difficult to know exactly how many instructions it uses for the reload. You'd have to search the .LST file to figure that out. Then as the program grows, that code may move to a different "Page" and change the timing without you knowing about it. With the ASM version, you always know it takes 8 instructions.

With 2000 interrupts per second, a difference of 1 count in the load routine translates to an error of 2000 counts per second. Not good for long term timing.