Department of Computer Science and Information EngineeringNational Cheng Kung University, TAIWAN
HANELConfiguration for Examples 15-6, 15-7OTHER 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=1MOV R1,#CNTPORT;load control reg portMOVX @R1,A ;make PC4=1ACALL DELAY;time delay for high pulseMOV A,00001000B;control byte for PC4=0MOVX @R1,A ;make PC4=0ACALL DELAYDecodingCircuitry
A2 A78255WRRDA0A1D0 D7 A0 CSPA4
WRRD A1