Making a LED Blink
The first step is to build a simple circuit. At this point you should be familiar with the parts used. (1 resistors, and 1 LED). This design is intended for use with an Atmel 89s51 but also posible for others family 8051. Most microcontrollers can handle the current required to turn an LED on and off but. In this lesson we’re going to make a LED Blink continously.
Build the circuit as shown in figure 2.1.1 As you seen on figure 2.1.1 P0.0 is connected to LED’s katode. Remember, that all we want to do with this lesson is make a LED blink.
In this step, you must tipe the assembly program to make the LED blink, we assume that you have already known the editor, we used MIDE-51 to edit the program.
org 0h start: Clr P0.0 ; send '0' to P0.0 call delay; call delay time Setb P0.0 ; send '1' to P0.0 call delay; call delay time sjmp start; loooooop forever to start ;============================================= ;subroutine delay created to rise delay time ;============================================= delay: mov R1,#255 del1: mov R2,#255 del2: djnz R2,del2 djnz R1,del1 ret end
Safe your assembly program above, and name it with LED1.asm (for example) Compile the program that you have been save by using MIDE-51, see the software instruction.
Download your hex file ( LED1.hex ) into the microcontroller by using Microcontroller ATMEL ISP software, see the instruction.After download this hex file you’ll see the action of the LED ( of course if your cable connection and your program are corrected ).