Header Ads

Blinking LEDs up to down use PIC16F877A Microcontroller

In this Tutorial you will learn how to Shifting LEDs up to down.The LEDs continous Blinking up to down. 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 PIC Project

  1. PIC16F877A Microcontroller
  2. Crystal
  3. Push button
  4. led 5mm
  5. Resister: 10k ,1k
  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. 


Mikro C Code:



Click the download button for hex code:
download
                 

No comments

Theme images by 5ugarless. Powered by Blogger.