急求一个用8255,8253等芯片做一个交通灯实验(接线图+程序)
发布网友
发布时间:2022-05-01 18:58
我来回答
共3个回答
热心网友
时间:2022-06-21 13:50
51单片机外接8255A做成的交通灯程序及PROTEUS仿真结果(附对应C语言程序) CONTROL EQU 7FFFH
PORTA EQU 7FFCH
ORG 0
START: MOV DPTR,#7FFFH
MOV A,#80H
MOVX @DPTR,A
MOV DPTR,#7FFCH
MOV A,#0FFH
MOVX @DPTR,A
LOOP:
MOV A,#21H
MOV DPTR,#7FFCH
MOVX @DPTR,A ;东西红,南北绿
CALL DELAYLONG
MOV A,#11H
MOV DPTR,#7FFCH
MOVX @DPTR,A ;三次闪烁
CALL DELAYSHORT
MOV A,#01H
MOV DPTR,#7FFCH
MOVX @DPTR,A
CALL DELAYSHORT
MOV A,#11H
MOV DPTR,#7FFCH
MOVX @DPTR,A
CALL DELAYSHORT
MOV A,#01H
MOV DPTR,#7FFCH
MOVX @DPTR,A
CALL DELAYSHORT
MOV A,#11H
MOV DPTR,#7FFCH
MOVX @DPTR,A
CALL DELAYSHORT
MOV A,#01H
MOV DPTR,#7FFCH
MOVX @DPTR,A
CALL DELAYSHORT
MOV A,#0CH
MOV DPTR,#7FFCH
MOVX @DPTR,A
CALL DELAYLONG
MOV A,#0AH
MOV DPTR,#7FFCH
MOVX @DPTR,A
CALL DELAYSHORT
MOV A,#08H
MOV DPTR,#7FFCH
MOVX @DPTR,A
CALL DELAYSHORT
MOV A,#0AH
MOV DPTR,#7FFCH
MOVX @DPTR,A
CALL DELAYSHORT
MOV A,#08H
MOV DPTR,#7FFCH
MOVX @DPTR,A
CALL DELAYSHORT
MOV A,#0AH
MOV DPTR,#7FFCH
MOVX @DPTR,A
CALL DELAYSHORT
MOV A,#08H
MOV DPTR,#7FFCH
MOVX @DPTR,A
CALL DELAYSHORT
AJMP LOOP
DELAYLONG: MOV R7,#40
L1: MOV R6,#200
L2: MOV R5,#250
DJNZ R5,$
DJNZ R6,L2
DJNZ R7,L1
RET
DELAYSHORT: MOV R4,#200
L3: MOV R3,#250
DJNZ R3,$
DJNZ R4,L3
RET
END
C语言发不上去
热心网友
时间:2022-06-21 13:50
我这个满足要求吗?
热心网友
时间:2022-06-21 13:51
年轻人别偷懒啊,该学的东西不能这么糊弄过去的!