#include "c:\miniIDE\hcs12.inc" org $1000 count ds.b 1 org $2000 lds #$1800 movb #$FF,DDRB clr count movb count,PORTB loops ldy #50 ; create 200 ms delay jsr delay10ms ; " inc count ; increment count by 1 movb count,PORTB ; update LED displays bra loops ; **************************************************************************** ; The following function uses the modulus down counter to create 10 ms delay. ; **************************************************************************** delay10ms bset TSCR1,TFFCA ; enable timer fast flag clear movb #$07,MCCTL ; enable modulus down counter with 1:16 as prescaler movw #15000,MCCNT ; load the value to be down counted brclr MCFLG,MCZF,* bclr MCCTL,$04 ; disable modulus down counter dbne y,delay10ms rts end