Monday, September 28, 2009

Running Light 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.

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 ).

4 Channel RF Remote Control






Figure 1. RF 4 channels remote Transmitter

This is a very simple RF transmitter circuit that consists of the Holtek HT-12E encoder chip and AM 418MHZ-transmitter module (WZ-X01). Using the hybrid RF xmit/receive modules make building the RF remote control a lot easy.

The transmitter can be powered with any voltage from +3 to +12V. The total current consumption is less than 5ma. Depending on the supply voltage, you may need to select a difference resistance value for the oscillator resistor R1. The recommended oscillator is Foscd (decoder) = 50 Fosce (encoder). See data sheet for more details.

The individual security code of the transmitter is preset by dip-switches S5, up to 256 combinations.

When any of S1-S4 is pressed the /TE pin is pulled low, and power is applied to both the encoder chip and transmitter module, the encoder then starts scanning and transmitting the status of the 12bits address and data serially.




Figure 2 RF 4 channels receiver circuit

The circuit diagram for the receiver (WZ-R01)is shown in figure 2. The decoder U1(HT-12D) receives serial addresses and data from the encoder that are transmitted by the RF transmitter module. It compares the serial input data three times continuously with its local addresses. If no error or unmatched codes are found, the input data codes are then decoded and transferred to the output pins D8~D11. The VT pin also goes high to indicate a valid transmission, which will turn on the LED1. The addresses of the decoder (set by S1) have to be matched with the transmitter encoder. The outputs of U1 drive the four TIP30 PNP transistors that can be connected to the relays or lamps.

The operating range of this transmitter/receiver is dependent on the choice and position of the antenna. The space around the antenna is as important as the antenna itself. Try to keep the antenna away from other metal in the system such as batteries and PCB ground plane. The following types of antenna are recommended.


Blink More LED :D

Congratulation, you have succeded with make a LED blink. Now lets improve your skill by making more LED blink ( 8 LED ). In this lesson, we will make four LED blink change reversed.

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

Microcontroller Application LED



Figure 2.1.2. Diagram Skematik LED Blink

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.

org 0h
start: mov P0,#11110000b; Turn on LED on P0.0 - P0.3
call delay ; call delay time
mov P0,#00001111b; Turn on LED on P3.4 - P0.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 LED2.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 ( LED2.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 ).