The 8051 Microcontroller and Embedded

(lily) #1
Department of Computer Scien

ce and Information Engineering

National Cheng Kung University, TAIWAN
HANEL

Example 15-4 (cont’)(c)CONTRBT EQU 83H ;PA=OUT,


PB=IN, PCL=IN, PCU=OUT

APORT EQU 20HBPORT EQU 21HCPORT EQU 22HCNTPORT EQU 23H

...MOV A,#CONTRBYT ;PA=O

UT,PB=IN,PCL=IN,PCU=OUT

MOV R0,#CNTPORT ;LO

AD CONTROL REG ADDRESS

MOVX @R0,A

;ISSUE CONTROL WORD

MOV R0,#BPORT ;LOAD PB ADDRESSMOVX A,@R0 ;READ PBDEC R0

;POINT TO PA(20H)

MOVX @R0,A ;SEND IT TO PAMOV R0,#CPORT ;LOAD PC ADDRESSMOVX A,@R0 ;READ PCLANL A,#0FH

;MASK UPPER NIBBLE

SWAP A

;SWAP LOW AND HIGH NIBBLE

MOVX @R0,A ;SEND TO PCU

PROGRAMMING THE 8255Address Aliases


(cont’)

Free download pdf