The 8051 Microcontroller and Embedded

(lily) #1
Department of Computer Scien

ce and Information Engineering

National Cheng Kung University, TAIWAN
HANEL

Configuration for Examples 15-6, 15-7

OTHER MODES OF THE 8255


BSR
(Bit Set/Reset)Mode

(cont


’)


Example 15-6Program PC4 of the 8255 to generate a pulse of 50 ms with 50% dutycycle.Solution:To program the 8255 in BSR mode, bit D7 of the control word must below. For PC4 to be high, we need a control word of “0xxx1001”. Likewise, for low we would need “0xxx1000” as the control word. Thex’s are for “don’t care” and generally are set to zero.


MOV a,#00001001B

;control byte for PC4=1

MOV R1,#CNTPORT

;load control reg port

MOVX @R1,A ;make PC4=1ACALL DELAY

;time delay for high pulse

MOV A,00001000B

;control byte for PC4=0

MOVX @R1,A ;make PC4=0ACALL DELAY

DecodingCircuitry
A2 A7

8255

WRRDA0A1

D0 D7 A0 CS

PA4
WRRD A1
Free download pdf