write assembly program to disable flashing on the Dragon12Li

write assembly program to disable flashing on the Dragon12-Light board when switch SW5 is pressed. Enable flashing when switch SW4 is pressed. Also, flash RGB led simultaneously with “HELP’ on seven-segment displays. Switches SW2 – SW5 correspond to the I/O port - Port H.

Solution

#include reg9s12.h REGBLK: equ $0000 STACK: equ $2000 ; do not use $4000 ; org $1000 counter: rmb 1 org $2000 ; program code start: lds #STACK ldx #REGBLK ldaa #$ff staa ddrb,x ; make port B an output port staa ddrp,x ; make port P an output port staa ptp,x ; turn off 7-segment LED display back: clr portb,x ; turn off PB0 jsr d250ms ; delay 250ms inc portb,x ; turn on PB0 jsr d250ms ; delay 250ms jmp back * d250ms: ldaa #250 ; delay 250 ms staa counter delay1: ldy #6000 ; 6000 x 4 = 24,000 cycles = 1ms delay: dey ; this instruction takes 1 cycle bne delay ; this instruction takes 3 cycles dec counter bne delay1 ; not 250ms yet, delay again rts end

write assembly program to disable flashing on the Dragon12-Light board when switch SW5 is pressed. Enable flashing when switch SW4 is pressed. Also, flash RGB l

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site