Difference between revisions of "LED Blinking with PIC16F877A Starter Board"
Line 1: | Line 1: | ||
− | + | [[Category:Starter PIC16F877]] | |
In this tutorial we will learn how to blink the LED's with PIC16F877 Starter Board. The Explore Starter PIC board has | In this tutorial we will learn how to blink the LED's with PIC16F877 Starter Board. The Explore Starter PIC board has | ||
two on board LED's which are connected to PORT D0 and PORT D1. <br><br> | two on board LED's which are connected to PORT D0 and PORT D1. <br><br> |
Revision as of 13:55, 27 April 2016
In this tutorial we will learn how to blink the LED's with PIC16F877 Starter Board. The Explore Starter PIC board has
two on board LED's which are connected to PORT D0 and PORT D1.
Register Configuration
Code
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <pic16f877a.h> | |
void DELAY_ms(unsigned int ms_Count) | |
{ | |
unsigned int i,j; | |
for(i=0;i<ms_Count;i++) | |
{ | |
for(j=0;j<1000;j++); | |
} | |
} | |
int main() | |
{ | |
/* Configure all the ports as Output */ | |
TRISA = 0x00; | |
TRISB = 0x00; | |
TRISC = 0x00; | |
TRISD = 0x00; | |
while(1) | |
{ | |
PORTA = 0xff; /* Turn ON all the leds connected to Ports */ | |
PORTB = 0xff; | |
PORTC = 0xff; | |
PORTD = 0xff; | |
DELAY_ms(100); | |
PORTA = 0x00; /* Turn OFF all the leds connected to Ports */ | |
PORTB = 0x00; | |
PORTC = 0x00; | |
PORTD = 0x00; | |
DELAY_ms(100); | |
} | |
return (0); | |
} |