* PACC_1 * 1 Dec 99/scp * This program uses the Pulse Accumulator to produce a periodic time tick. * ;$SET simulate $SETNOT simulate ;target HC11 Microkit $include "v2_17.asm" ;version 2.17 only supports interrupts PACTL EQU REGBASE+$26 PACNT EQU REGBASE+$27 TMSK2 EQU REGBASE+$24 TFLG2 EQU REGBASE+$25 M1: DB 'Pulse Accumulator Test Program',LF,LF M2: DB 'PACTL',NULL main: ldx #RAMTOP ;setup user stack at the top of ram txs ldx #M1 ;pointer to line-1 jsr OUTSTRING ;write program name out the serial port ldaa #$01 ;initialize the LCD by resetting it jsr LCD_CMD ;write to command register in LCD ldaa #$0f ;initialize LCD for two lines jsr LCD_CMD ldaa #$01 ;specify line-1 ldx #M2 ;pointer to null-terminated logo-2 string jsr LCDLINE ;write the line to the LCD ldx #IRQ ;address of ISR stx ISR_JUMP15 ;IRQ hook; ldx #PA_ISR ;address of Pulse-Accumulator stx ISR_JUMP4 ;PACNT hook; ibid ldaa #$F0 ;Turn on pulse accumulator staa PACTL ; ldaa #$30 ;Clear PAOVF and PAIF staa TMSK2 ; * Event spin loop * loop: ldaa PACNT bne loop ldaa #$61 jsr OUTCHAR jmp loop * Interrupt Service Routine called each time the Pulse Accumlator overflows * or every 32 us. PA_ISR: ;clear PAOVF ldaa TFLG2 anda $d0 staa TFLG2 rti * ISR called each time the IRQ pin is pulled low (button pushed). * IRQ: ;; Do something with LEDs and switches rti