LED Dancing light using PIC Microcontroller: Beginner's guide

LED running light project can be easily implemented using microcontrollers especially with microchip PIC microcontroller. This is a simple microcontroller project using micro PIC16f877A with a neat circuit diagram. PIC16F877A is a 40 pin IC, LEDs are connected at port B. These LEDs twinkle according to the microcontroller C program providing a dancing effect to the viewer.

Mikro C compiler is used for PIC programming. The simulation of this circuit from i-St@r lab is shown in this article.The Mikro C is a popular C language compiler for PIC16F8xxx family and it has wide varieties of inbuilt functions (library functions). You can download it from the Mikro C website.

This microcontroller project program is easy for those who wish to explore the fundamentals of embedded microcontroller programming from the PIC microcontroller MCU. You can simply realize this program if you have done LED interfacing with PIC microcontroller.

Also read: PIC microcontroller basic connection circuit

LED blinking Microcontroller C Program

void main()
{
TRISB=0x00;
while(1)
{
PORTB=0x81;
delay_ms(100);
PORTB=0x42;
delay_ms(100);
PORTB=0x24;
delay_ms(100);
PORTB=0x18;
delay_ms(100);
PORTB=0x24;
delay_ms(100);
PORTB=0x42;
delay_ms(100);
}
}
This is tested and verified embedded program by i-St@r. See the image below.

Dancing light circuit diagram

LED dancing light
                    Click on the image for enlarged view

How to burn PIC microcontroller?

After writing this program in Mikro C compiler, we need to burn our PIC MCU. For this purpose first build the .HEX file and then burn PIC microcontroller.
Ads


0 comments:

Post a Comment

 

Copyright © 2011 CircuitsGallery| ToS | Privacy Policy |

Contact Us | Write For Us | Advertise on Circuits Gallery | About Us