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’)


¾or, see the following, also using EQU:


CONTRBYT EQU 90H

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

BAS8255P EQU 1000H

;base address for 8255

MOV A,#CONTRBYTMOV DPTR,#BAS8255P+3

;load c port addr

MOVX @DPTR,A ;issue control word MOV DPTR,#BAS8255P+3 ;PA address...

‰Example 15-2 and 15-3


¾use the DPTR register since the base address assigned to 8255 was 16-bit¾if it was 8-bit, we can use “MOVX A,@R0


”and


“MOVX @R0,A



‰Example 15-4


¾use a logic gate to do address decoding


‰Example 15-5


¾use a 74LS138 for multiple 8255s

Free download pdf