Tutorial Microcontroller 8051
 
 
 
 
 
   

BACK NEXT

 2.1.3. Running LED

Congratulation, you have succeded with make more LED to blink. Now lets improve your skill by making running LED ( 8 LED ). In this lesson, you'll turn on one LED in sequence for 8 LED.

Step 1st
Build the circuit as shown in figure 2.1.3. As you seen on figure 2.1.3. P0.0 trough P0.7 is connected to LED's katode each. Remember, that all we want to do with this lesson is make these LED to run.

Microcontroller Application LED

Figure 2.1.3. Diagram Skematik Running LED

 

Step 2nd
In this step, you must tipe the assembly program to make four LED blink, we assume that you have already known the editor, we used MIDE-51 to edit the program. ( Download File : exp213.zip )

       org 0h
start: mov P0,#11111110b; Turn on LED on P0.0
call delay ; call delay time
mov P0,#11111101b; Turn on LED on P0.1
call delay ; call delay time
mov P0,#11111011b; Turn on LED on P0.2
call delay ; call delay time
mov P0,#11110111b; Turn on LED on P0.3
call delay ; call delay time
mov P0,#11101111b; Turn on LED on P0.4
call delay ; call delay time
mov P0,#11011111b; Turn on LED on P0.5
call delay ; call delay time
mov P0,#10111111b; Turn on LED on P0.6
call delay ; call delay time
mov P0,#01111111b; Turn on LED on P3.7
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


Step 3rd
Safe your assembly program above, and name it with LED3.asm (for example) Compile the program that you have been save by using MIDE-51, see the software instruction.

Step 4th
Download your hex file ( LED3.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 ).

Best Link

 

BACK NEXT

 

Lesson 1:
T o o l
1.1. Programmer
1.2.
Edsim 51
1.3. MIDE-51
1.4. ATMEL ISP

Lesson 2:
Input Output
2.1.LED
2.2.Swicht
2.3.7 Segmen
2.4.LCD Character
2.5.ADC
2.6.DAC
2.7.Motor Stepper
2.8.Keypad

Lesson 3:

Timer Counter

3.1.Basic
3.2.Mode 0
3.3.Mode 1
3.4.Mode 2
3.5.Mode 3

Lesson 4:

Serial Comm.

4.1.Basic
4.2.LED
4.3.Rotate LED
4.2 ADC
4.3.LCD

Lesson 5:
Interuption

5.1.Basic
5.2.Timer
5.2.External