#include "c:\miniide\hcs12.inc" high_cnt equ 600 delay equ 1500 org $1500 lds #$1500 movw #oc7_isr,UserTimerCh7 ; set up OC7 interrupt vector movw #oc0_isr,UserTimerCh0 ; set up OC0 interrupt vector movb #$90,TSCR1 ; enable TCNT and fast timer flags clear movb #$81,TIOS ; enable OC7 & OC0 movb #$01,OC7M ; allow OC7 to control OC0 pin movb #$01,OC7D ; OC7 action on PT0 pin is to pull high movb #$03,TSCR2 ; set prescaler to 8 movb #$02,TCTL2 ; select pull low as the OC0 action movb #$81,TIE ; enable OC7 and OC0 to interrupt ldd TCNT addd #delay std TC7 ; start an OC7 operation addd #high_cnt std TC0 ; start an OC0 operation cli ; enable interrupt loop bra loop ; infinite loop to wait for interrupt swi oc7_isr ldd TC7 ; start the next OC7 action with 15000 addd #delay ; clock cycles delay, also clear the C7F std TC7 ; flag rti oc0_isr ldd TC0 ; start the next OC0 action with 15000 addd #delay ; clock cycles delay, also clear the C0F std TC0 ; flag rti end