8255 INTERFACING

SECTION 15.2: 8255 INTERFACING
Chapters 12 and 13 detailed real-world interfacing of LCDs, sensors, and ADC devices. In this section we show how to interface the 8255 to LCDs, stepper motors, and ADC devices, then program it using 8051 instructions.
Stepper motor connection to the 8255
Chapter 17 will detail the interface of a stepper motor to the 8051. Here we show stepper motor connection to ^ 8255 and programming. See Figure 15-9.
MOV A,#80H /control word for PA=out
MOV R1,#CRPORT ;control reg port address
MOVX @R1,A ;configure PA=out
MOV R1,#APORT /load PA address
MOV A,#66H /A=66H,stepper motor sequence
AGAIN: MOVX @R1,A /issue motor sequences to PA
RR A /rotate sequence for clockwise
ACALL DELAY /wait
SJMP AGAIN





Figure 15-9. 8255 Connection to Stepper Motor


LCD connection to the 8255
Figure 15-10. LCD Connection



Program 15-1 shows how to issue commands and data to an LCD connected to an 8255. See Figure 15-10. In Program 15-1, we must put a long delay before issuing any information (command or data) to the LCD. A better way is to check the busy flag before issuing anything to the LCD. This was discussed in Chapter 12. Program 15-2 is a repeat of Program 15-1 with the checking of the busy flag. Notice that no DELAY is used the main program in Program 15-2.














Program 15-1.




Program 15-2.



Program 15-2.
ADC connection to the 8255
ADC devices were covered in Chapter 13. The following is a program for the ADC connected to the 8255 as shown in Figure 15-11.


So far we have discussed the simple I/O mode of the 8255 and showed many applications for it using Assembly language. Next, we discuss how to program the 8255 using 8051 C language.



Figure 15-11. 8255 Connection to ADC804

Next post:

Previous post: