Blinking leds pattern with 8051 microcontroller – Project circuit diagram
Leds flashing/Multiple Led’s with 8051 microcontroller – Project code
Now coming to the main code of blinking leds with 89c51 microcontroller. In the main code all the logic runs in a while(1) loop. While(1) loop means that the logic in it will run for ever as long as the power is supplied. An eight bit command is written to 8051 microcontroller port-1 to switch led on or off. For example P1=0x01 is a hexadecimal command it switches on led connected to port-1 pin#0 and all the other leds will remain off. If we translate the above command in binary it comes out 00000001. If we write this command to 8051 port 1 the output at led’s will be
I made the led’s blink pattern by manipulating the commands. You can translate the commands same like above and see what led pattern it is generating.
I am displaying four patterns on led’s.
- First pattern will blink leds one by one. It starts form one side and reaches the other and then comes back.
- In second pattern 8-leds are divided in to two half’s. Each half now contains four led’s. The above one by one logic is then repeated on the individual half’s at the same time.
- Third pattern illuminates led’s starting from the middle.
- Fourth pattern is random led’s blink
Each led’s flashing pattern is placed in a while loop and it repeats two times before moving to the next pattern. You can verify the pattern by translating the individual commands present in each pattern. Translation figure is given above.
Filed Under: 8051 Microcontroller, Electronic Projects