View Single Post
Old 04 July 2013, 09:39   #3
phx
Natteravn
 
phx's Avatar
 
Join Date: Nov 2009
Location: Herford / Germany
Posts: 2,537
Nice example.

Although in a real program you should avoid to save and restore registers which don't change. This wastes a lot of time each interrupt:
Code:
myTimerInterrupt:
    ;tst.w    8(a1)
    ;beq.b    .exit
    movem.l    d2-d7/a2-a6,-(sp)
    add.l    #1,t10ms
    movem.l    (sp)+,d2-d7/a2-a6
    moveq    #1,d0
.exit:
    rts
Quote:
Originally Posted by xArtx View Post
I assume because both chips are driven by the same clock,
that those two timers can't go out of sync?
Yes. All timers use the same 02 clock (0.7 MHz). Alternatively you can let the timers count positive CNT transitions on the serial port. And timer B can also count timer A underflows.

Last edited by prowler; 04 July 2013 at 21:19. Reason: Back-to-back posts merged.
phx is offline  
 
Page generated in 0.04615 seconds with 11 queries