Since we can source a maximum of 20mA per pin for PORT P1 and total max-
imum current from PORT P1 is 80mA, hence we can use PORT P1 to drive
LED display directly. Below shows the circuit where 2 common cathode 7-SEG
LEDs are connected to PORT P1 with 120 Ohms current limiting resistors.
The same segment of the two LEDs are tied in parallel to P1. Q1 and Q2 are
activated by logic high on PA0 and PA1 which switch on ground to the
respective common cathode pins. PA2 and PA3 pin are use to read the inputs
S1 or S2 switches.
1) For SPJ 8051 C, the following code,
2) For KEIL 8051 C, the following code,
demonstrate how to drive two 7-segment LEDs.
The program first display digits on the Left LEDs and counts
from 0 to 9 with a delay of 1 second between each digit. Then
it switches to the Right LED and repeats the same tasks and
then the whole sequence is repeated all over again from the