The 8051 Micro
The 8051 Microcontroller

US$82.00

The 8051 Micro: Architecture, Programming & Applications
The 8051 Microcontroller : Architecture, Programming, and Applications

US$29.95

C and the 8051:
Building Efficient Applications








C & the 8051: Building Efficient Applications

US$65.00

C 
 and the 8051 : Hardware, Modular Programming, and Multitasking








C and the 8051: Hardware, Modular Programming, and Multitasking

US$34.95

uP & uC Fundamentals










uP & uC Fundamentals: The 8085/8051 Hardware and Software
US$90.00

Programming and
 Customizing the 8051 Microcontroller








Programming and Customizing the 8051 Microcontroller
US$31.96

blitzlogic










APPLICATION #1        Simple Outputs - 8 LEDs  

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 resistors.
1) For SPJ 8051 C, the following code, led_spj.c
2) For KEIL 8051 C, the following code, led_89.c
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.

EXERCISES

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.