Since any PORT P1 pin is able to source a max. of 20mA per pin with
P1 capable of sourcing a total maximum current of 80mA, hence we
can use P1 to drive LED display directly. As shown in the circuit, 8
LEDs are connected to P1 with each 120 Ohm current limiting
1) For SPJ 8051 C, the following code,
2) For KEIL 8051 C, the following code,
demonstrate how to output and turn on & off the LEDs. The program
blinks LED from LED1 to LED8 turning on & off one after another
sequentially. When it reaches LED8, it repeats all over again.
Modify the above program to display
the following sequence : -
LED1 and LED8 turn on, 1 sec delay;
LED2 and LED7 turn on, 1 sec delay;
LED3 and LED6 turn on, 1 sec delay;
LED4 and LED5 turn on, 1 sec delay;
Loop back & Repeat again forever.