#include "c:\miniide\hcs12.inc" hi_freq equ 1250 ; delay count for 1200 Hz (with 1:8 prescaler) lo_freq equ 5000 ; delay count for 300 Hz (with 1:8 prescaler) toggle equ $04 ; value to toggle the TC5 pin org $1000 delay ds.w 1 ; store the delay for output-compare operation org $1500 lds #$1500 movw #oc5_isr,UserTimerCh5 ; initialize the interrupt vector entry movb #$90,TSCR1 ; enable TCNT, fast timer flag clear movb #$03,TSCR2 ; set main timer prescaler to 8 bset TIOS,OC5 ; enable OC5 movb #toggle,TCTL1 ; select toggle for OC5 pin action ldd #hi_freq std delay ; use high frequency delay count first ldd TCNT ; start the low frequency sound addd delay ; " std TC5 ; " bset TIE,OC5 ; enable OC5 interrupt cli ; " forever ldy #5 ; wait for half a second jsr delayby100ms ; " movw #lo_freq,delay ; switch to low frequency delay count ldy #5 jsr delayby100ms movw #hi_freq,delay ; switch to high frequency delay count bra forever oc5_isr ldd TC5 addd delay std TC5 rti #include "c:\miniide\delay.asm" end