ORG 0000H 
LJMP MAIN 
ORG 0030H 
MAIN : MOV SP, #60H 
MOV DPTR, #7FFFH    ; 8255 控制口 
MOV A, #82H         ; 8255 方式字 
MOVX @DPTR, A 
MOV B, #01H 
LP: MOV DPTR, #7FFDH       ; 8255B 口 
BP1: MOVX A, @DPTR 
ANL A, #0FFH 
JZ LP1 
LJMP OUT 
LP1: MOV A, B 
RL A 
MOV B, A 
MOV R6, #0FFH           ;延时 
BB: MOV R7, #0FFH 
CC: DJNZ R7, CC 
DJNZ R6, BB 
OUT: MOV DPTR, #7FFEH             ; 8255C 口 
MOVX @DPTR, A 
LJMP LP 
END 
