0% found this document useful (0 votes)
66 views

Start Org

This program displays numbers on a 7-segment display by reading values from a table and outputting them to ports controlling the display segments. It uses buttons to control incrementing or decrementing the displayed value, with delay routines to pace the counting. When the button is pressed, it will count up or down through the digits repeatedly.

Uploaded by

Nabilah Aziz
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
66 views

Start Org

This program displays numbers on a 7-segment display by reading values from a table and outputting them to ports controlling the display segments. It uses buttons to control incrementing or decrementing the displayed value, with delay routines to pace the counting. When the button is pressed, it will count up or down through the digits repeatedly.

Uploaded by

Nabilah Aziz
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 1

START ORG $080c00 seg equ $100011 address port a PB equ $100013 DDD CLR D0 ;Clear the first

digit of 7-segment DISPLAY MOVE.L #$0FFF, D5 ;store $FF to D5 register as temporary counter REPEAT MOVE.B #$00, $100011 ;Activate the LSB digit (first 7-seg display) lea seg,a0 lea PB,a1 lea digits,a3 MOVE.l a3,a4 UPCOUNT MOVE.B (a3)+,D0 ;Display 0 MOVE.B D0, $100011 ;Display the D0 data to Port B cmp.b #$DF,(a1) ;as long as you hold the button it will be not equal BEQ REPEAT2 BSR DELAY CMP.B #$F6,D0 BNE UPCOUNT BSR REPEAT JMP UPCOUNT ;Check D5 equal 0? If not, branch to REPEAT REPEAT2 MOVE.B #$00, $100011 ;Activate the LSB digit (first 7-seg display) lea digit,a4 DOCOUNT MOVE.B (a4)+,D4 ;Display 0 MOVE.B D4, $100011 ;Display the D0 data to Port B cmp.b #$FD,(a1) ;as long as you hold the button it will be not equal BEQ REPEAT BSR DELAY CMP.B #$60,D4 BNE DOCOUNT BRA REPEAT2 ;Check D5 equal 0? If not, branch to REPEAT digits: dc.b digit: dc.b $F6,$F8,$90,$30,$64,$22,$02,$78,$00,$60 $60,$00,$78,$02,$22,$64,$30,$90,$F8,$F6

DELAY MOVE.L #$FFFFF, D6 ;DELAY subroutine DEL1 cmp.b #$FE,(a1) ;as long as you hold the button it will be not equal BNE DEL2 BSR pause0 DEL2 SUBQ.L #1, D6 BNE DEL1 RTS DELAY2 MOVE.L #$FFFFF, D6 ;DELAY subroutine DEL4 SUBQ.L #1, D6 BNE DEL4 RTS pause0 cmp.b #$FE,(a1) ;as long as you hold the button it will be not equal BNE pause0 RTS END START ;end of program

You might also like