Академический Документы
Профессиональный Документы
Культура Документы
LDI
R20, 0x07
;R20 = 0x07 (to display '7' on 7-segment
we should put 0x07 on the port)
;===========================
;Right 7-segment
;===========================
;put the high nibble of R20 on JB (PORTC)
MOV
R16, R20
;R16 = R20
ANDI R16, 0x70
SWAP R16
OUT
PORTC, R16
;put the low nibble of R20 on JA (PORTA)
MOV
R16, R20
;R16 = R20
ANDI R16, 0x0F ;R16 = R16 & 0x0F
OUT
PORTA, R16
;PORTA = R16
CALL
DELAY
segment
;===========================
;Left 7-segment
;===========================
;put the high nibble of R20 on JB (PORTC)
MOV
R16, R20
;R16 = R20
ANDI R16, 0x70
ORI
R16, 0x80
;enable the catode for the Left 7SWAP R16
OUT
PORTC, R16
;put the low nibble of R20 on JA (PORTA)
MOV
R16, R20
ANDI R16, 0x0F
OUT
PORTA, R16
CALL
RJMP
DELAY
L1
;========================================
;The delay subroutine makes a small delay
;========================================
DELAY:
DL1:
LDI
R16, 0 ;R16 = 0
NOP
DEC R16
BRNE
DL1
RET
;R16 = R16 - 1
;if R16 is not zero go to DL1
http://www.microdigitaled.com/AVR/Hardware/Digilent_asm/5_sevenSeg.asm