解:P1.0==D1,.....P1.7=D8; 假设低电平点亮二极管(二极管串联一个200欧姆电阻,正极接电源,负极接CPU 对应引脚)
假设时钟频率12MHz;
ORG 0000H
LED: MOV P1,#0FAH
CALL DELAY1S
MOV P1,#0F5H;
CALL DELAY1S
MOV P1,#0AH
CALL DELAY1S
MOV P1,#0AAH
CALL DELAY1S
MOV P1,#55H
CALL DELAY1S
MOV P1,#00H
CALL DELAY1S
MOV P1,#0FFH
CALL DELAY1S
LJMP LED
DELAY1S: MOV R3,#200
D2:MOV R4,#100
D1:MOV R5,#25
DJNZ R5,$
DJNZ R4,D1
DJNZ R3,D2
RET
END
电路图就不画了,这么简单的电路自己搞掂吧,假设LED接P0口,低有效。
TIMES EQU 30H
SEC EQU 31H
FLAG BIT 00H
ORG 0000H
LJMP MAIN
ORG 000BH
LJMP T0ISR
ORG 0030H
MAIN:
MOV SP,#5FH
MOV TMOD,#01H
MOV TH0,#3CH
MOV TL0,#0B0H
SETB TR0
SETB ET0
SETB EA
CLR FLAG
LOOP:
MOV P0,#0FAH
JNB FLAG,$
CLR FLAG
MOV P0,#0F5H
JNB FLAG,$
CLR FLAG
MOV P0,#0AFH
JNB FLAG,$
CLR FLAG
MOV P0,#5FH
JNB FLAG,$
CLR FLAG
MOV P0,#0AAH
JNB FLAG,$
CLR FLAG
MOV P0,#55H
JNB FLAG,$
CLR FLAG
MOV P0,#00H
JNB FLAG,$
CLR FLAG
MOV P0,#0FFH
JNB FLAG,$
CLR FLAG
LJMP LOOP
END
任务1:
ORG 0000H
JMP START
ORG 0030H
START:
CLR P0.0
SETB P0.1
CLR P0。 2
SETB P0.3
CLR P0.4
SETB P0.5
CLR P0.6
SETB P0.7
JMP $
完
任务:
ORG 0000H
JMP START
ORG 0030H
MOV P0,#10101010B JMP $
的END
仿真知道体现在哪里?