Header Ads

Bliniking LEDs use PIC Microcontroller and Mikro C

PIC Microcontroller Project : Using PIC16F877A

In this Tutorial we will learn how to blinking LEDs use PIC Microcontroller. Here I am use PIC16F877A Microcontroller and 8MHz quartz crystal. You con watch the following video or read the written tutorial below.







PIC16F877A Microcontroller has A0-A7, B0-B7, C0-C7, D0-D7 and E0-E2 input/output port. Some pins for these I/O port are multiplex with an alternative function for the peripheral feature on the device. In general, when a peripheral is enable, that pin may not used as a general purpose I/O pin.


The TRIS Register controls the direction of Input/Output port. Here PORTB is 8bit wide, bi-directional port. The corresponding data direction register is TRISB. Setting a TRISB bit (= 1) will make the corresponding PORTB pin an Input. Clearing a TRISB bit (=0) will make the corresponding PORTB pin an Output.



                                            




Circuit diagram:
                            
                     




Component needed for this Project




  1. PIC16F877A Microcontroller
  2. Crystal
  3. Push button
  4. led 3mm(8pic)
  5. Resister: 10k ,100R
  6. Breadboard
  7. Jumper Wire
  8. 5V DC Supplay


Code Explain:
Here I am use Mikro C compiler for code editing. In void main function I define PORTB is output by clearing TRISB register. Then we clear the PORTB register. In next, here I am use while loop for continues program execution and blinking LEDs. And then close the program.


Mikro C Code:






  Click the download button for program file: 

download





No comments

Theme images by 5ugarless. Powered by Blogger.