ORG 0000H ABC:CLR P1.0 SETB P1.7 JB P1.7,$ JNB P1.7,$ SETB P1.0
MOV R2,#0 DAY:NOP NOP
DJNZ R2,DAY SJMP ABC
Ω
5.7 利用8XX51的P1口控制8个发光二极管LED。相邻的4个LED为一组,使两组每隔0.5s交替发亮一次,周而复始,画出电路并编出程序(设延时0.5s子程序为D05,已存在)。
ORG 0000H MOV A,#0FH ABC:MOV P1,A ACALL D05 SWAP A
+5V
SJMP ABC
D05:MOV R6,250 DY:MOV R7,250 DAY:NOP NOP
DJNZ R7,DAY DJNZ R6,DY RET END
89C51
P1.0P1.1P1.2P1.3P1.4P1.5P1.6P1.7