The 8051 Microcontroller and Embedded

(lily) #1
Department of Computer Scien

ce and Information Engineering

National Cheng Kung University, TAIWAN
HANEL

PROGRAMMING THE 8255Connecting 8031/51 to


(^8255) (cont’)


‰For the program in Example 15-3


¾it is recommended that you use the EQU directive for port address as shown nextAPORT EQU 1000HBPORT EQU 1001HCPORT EQU 1002HCNTPORT EQU 1003HMOV A,#90H


;(PA=IN, PB=OUT, PC=OUT)

MOV DPTR,#CNTPORT ;load

cntr reg port addr

MOVX @DPTR,A

;issue control word

MOV DPTR,#APORT ;PA addressMOVX A,@DPTR ;get data from PAINC DPTR ;PB addressMOVX @DPTR,A

;send the data to PB

INC DPTR ;PC addressMOVX @DPTR,A ;send it also to PC
Free download pdf