Minggu, 14 Februari 2010

PIC 16F877A HELP

As I have seen so many problems are related to this PIC controller IC's. Nobody finds these programs online. First program is to blink a LED and that we can't find so easily. Let me provide you one code i wrote. This is tested through MPLAB software.
The circuit diagram has not much components. I tried blinking this whole port B. You can change the hex number 0xff and 0x00 and put as you want in the C program. while loop is infinite so the LED's will blink.
Circuit diagram :
The program to be burned has to be written on MPLAB or PIC C compiler as i used them.
The C code is written below:

#include "16f877a.h" //IC selection
#fuses XT, NOWDT, NOPROTECT, NOLVP
#use delay (clock =20000000) //clock 20MHz
void main()
{
while(1)
{
output_B(0xff); //hex to binary output on port B
delay_us(500); // delay = 500 x clock period.
output_B(0x00);
delay_us(500);
}
}

I have tested it. If any questions regarding this circuit. Please do ask . Thank you!