Getting Started on Programming a PIC

Thread Starter

sbf2009

Joined Jul 21, 2010
8
I have a PIC16F877A I need to program for a project. I am completely lost on how to get/setup an IDE to work with. I can't even get this bit of example code to compile correctly on MPLAB.

#include <16f877A.h>
#device ICD=TRUE
#fuses HS,NOLVP,NOWDT
#use delay (clock=20000000)
#define GREEN_LED PIN_A5
void main ()
{
while (TRUE)
{
output_low (GREEN_LED);
delay_ms (1000);
output_high (GREEN_LED);
delay_ms (1000);
}
}

I think I specified which type of PIC I was using, but I'm not sure if I did it right. If anyone could hold my hand to help me get an environment I can work in correctly, I would much appreciate it.
 

Vaughanabe13

Joined May 4, 2009
102
Where did you get that example code? If you're planning on using Microchip's C18 compiler that code will not compile. Are you using a development board for your PIC or do you have a custom board that you made for it? We need a lot more information on what you are doing/trying to do before we can give good advice.
 

Thread Starter

sbf2009

Joined Jul 21, 2010
8
I'm using CCS's PIC16F877A ( http://www.ccsinfo.com/product_info.php?products_id=16F877Akit ), but I was not given the Compiler CD that comes with the full kit. I just need to be able to compile code and send it out to the PIC.

I tried using MPLAB with CC5X, the code wouldn't compile, I don't think it could even find the 16f877A.h header.

The example code came from the exercise booklet that said the compiler CD was optional, so presumably I should be able to use other software to program for it.
 
Top