PIC Prototyping Basics: Software

The Software
           The software for this tutorial is far less important than getting the programming/power circuitry hooked up correctly on the breadboard. One wire can make the entire system not work. For this reason, we'll just use a simple LED blinking program to show that we can connect with & program the pic off of a breadboard with the Tiny ICD2 programmer.

« Begin Code »
/*
Written by: Chris
Date: 11/23/2007
Purpose & Description: This program turns Bit 0 of PORTA
off and on (0 and 1, 0v and 5v) at 0.3 Second intervals.
For this specific Development Board it will turn the LED
off and on.
*/
#include <p18f452.h>
#include <delays.h>
void main(void){
TRISA = 0x00;
PORTA = 0x00;

         while(1){
                  PORTA = 0x01;
                  Delay10KTCYx(150);
                  PORTA = 0x00;
                  Delay10KTCYx(150);
         }
}


« End Code »

           The best thing to do is copy the code above into a notepad document and Save as... main.c ...then include it in an MPLAB project & program the pic. This process is all covered in the Programming a PIC tutorial.



;