This first tutorial is the usual flashy LEDs example.
We will be introducing the development board we use (its the QL200 PIC development board), we will be using the CCS C Compiler and we use the QL Programmer software that comes with the development board to program the PIC.
First of all , the development board. I chose this board as it had many features that I thought were suitable for myself as a beginner, it has a variety of LEDs, 4×4 key matrix, Seven segment display on board, a remote control IC, buzzer and many more features. You can hook up an LCD to a connector, there are areas for various 3rd party ICs such as EEPROMs, RTC chip, D/A convertor and so on.
The kicker for me was that this development board supports many PIC chips, mine has a PIC16F877A on it. Here is a picture of the board
Code
The example as stated was written using the http://www.ccsinfo.com/downloads.php compiler.
//Include the header for 16F877A.
#include <16F877A.h>
//We use an xtal crystal, no watchdog,
//no low-voltage protection and no code protection.
#fuses XT, NOWDT, NOLVP, NOPROTECT
//The crystal is at 4,000,000 Hz.
#use delay (clock=4M)
//This is the starting point of the program.
void main()
{
//Infinite loop.
while(1)
{
//Send a hexadecimal byte to port A
output_a(0xff);
delay_ms(500);
output_a(0x00);
delay_ms(500);
//Send a hexadecimal byte to port B
output_b(0xff);
delay_ms(500);
output_b(0x00);
delay_ms(500);
//Send a hexadecimal byte to port C
output_c(0xff);
delay_ms(500);
output_c(0x00);
delay_ms(500);
}
}
Compile this and you will get a hex file created. I needed to use the programmer that came on the CD with the board. You can see this in the image below.
Fairly simple operation, connect your board to your PC using the USB cable supplied, select the programmer using Options -> Select Programmer. Make sure the Chip Select is set to the correct chip. Click on Load, locate your hex file from earlier, then click on prog to program your PIC. Now you should see the LEDs flashing on and off.
Links
QL200 PIC Microchip MCU Development Board & USB Programmer Kit 1602 LCD ICD on Amazon UK
QL200 PIC Microchip MCU Development Board USB Programmer Kit 1602 LCD ICD on AMAZON US