Controlling LEDs Using Microprocessor VIA 82C55A:
Using the 82C55A, we can control LED lights. We can use the pins of one port to connect with one leg of the LEDs and pins of another port to connect rest of the legs. Then we can program the 82C55A to control the LEDs. It can be done with a program like the one given below,
CONTROL PROC NEAR
MOV AL, 10000000B ; creating format
OUT CR, AL ; setting command register
MOV AL, 10101000B ; sending 1 to LED0, LED2, LED4
OUT PA, AL ; sending to port A
MOV AL, 00000000B ; sending 0 to LED0-LED7
OUT PB, AL ; sending to port B
CONTROL ENDP
Here first of all we are setting the command byte as A. Then we are sending 10101000 value to port A, in that way we are giving 1’s to LED0, LED2 and LED4. After that, sending 00000000 to port B. Now, those LED’s which has 1 at one leg and 0 at another will light up. So here, the LED0, LED1 and LED4 will light up.