Escolar Documentos
Profissional Documentos
Cultura Documentos
LISTA DE EXERCÍCIOS I
(Copie e cole todos os códigos desenvolvidos em Assembly no
Edsim51)
R:
INICIO:
ACENDE:
JB P2.0,ACENDE
JB P2.1,ACENDE
CLR P1.0
APAGA:
JNB P2.0,APAGA
JNB P2.1,APAGA
SETB P1.0
JMP INICIO
2) Faça um contador de 0 a 9 e ao chegar no fim da contagem acenda um LED,
conta um tempo (delay) e apague o LED.
R:
INICIO:
MOV R0,#0x00
CONTADOR:
MOV A,R0
INC A
MOV R0,A
XRL A,#0x09
JNZ CONTADOR
CLR P1.7
CALL DELAY_1S
DELAY_1MS:
MOV R1,#0x03
CONT_DELAY1MS:
MOV A,R1
DEC A
MOV R1,A
XRL A,#0x00
JNZ CONT_DELAY1MS
JMP CONT_DELAY1S
DELAY_1S:
MOV R2,#0x02
CONT_DELAY1S:
MOV A,R2
DEC A
MOV R2,A
XRL A,#0x00
JNZ DELAY_1MS
SETB P1.7
JMP INICIO
MOV R0,#0x09
CONTADOR:
MOV A,R0
DEC A
MOV R0,A
XRL A,#0x00
JNZ CONTADOR
CLR P1.7
CALL DELAY_1S
DELAY_1MS:
MOV R1,#0x03
CONT_DELAY1MS:
MOV A,R1
DEC A
MOV R1,A
XRL A,#0x00
JNZ CONT_DELAY1MS
JMP CONT_DELAY1S
DELAY_1S:
MOV R2,#0x02
CONT_DELAY1S:
MOV A,R2
DEC A
MOV R2,A
XRL A,#0x00
JNZ DELAY_1MS
SETB P1.7
JMP INICIO
4) Mostre no display de 7 segmentos os números de 0 a 9.
R: