You are on page 1of 35

How to Work

In this chapter we will discuss that how work with PIC self learning kit . The chapter contain a simple led blinking program with starting to software initialization to hardware Running.

Open Pic C Compiler

In Menu Bar Click on Folder Icon, situted at near to project and then Select new

Choose Source File

Select the location where you want to save your source file, you can make a simple folder and in this folder you can save the file as shown in example.

At this time I have created a folder name as led blink. In this folder I save this file

Note Save this file name with .c extension. For example if you save file with name of led then you have to type the name as led .c. More simply shown in figure

This window opens

Write your code Full code will be shown in next Slide.

#include <16F877A.h> #device adc=8 #FUSES NOWDT //No Watch Dog Timer #FUSES HS //Highspeed Osc > 4mhz //#FUSES INTRC_IO #FUSES PUT //Power Up Timer #FUSES NOPROTECT //Code not protected from reading #FUSES NODEBUG //No Debug mode for ICD #FUSES NOBROWNOUT //No brownout reset #FUSES NOLVP //No low voltage prgming, B3(PIC16) or B5(PIC18) used for I/O #FUSES NOCPD //No EE protection #use delay(clock=16000000) // Sets crystal oscillator at 16 megahertz #use rs232(baud=9600, xmit=PIN_C6, invert) //Sets up serial port output pin & baud rate #define m1 #define m2 #define m3 #define m4 #define m5 #define m6 #define m7 #define m8 PIN_D2 PIN_D3 PIN_C4 PIN_C5 PIN_C6 PIN_C7 PIN_D4 PIN_D5 //2A //2A //2A //2A //2A //2A //2A //2A

void blink() { output_high(m1); output_low(m2); output_high(m3); output_low(m4); output_high(m5); output_low(m6); output_high(m7); output_low(m8); delay_ms(1000); output_high(m8); output_low(m7); output_high(m6); output_low(m5); output_high(m4); output_low(m3); output_high(m2); output_low(m1); delay_ms(1000); } void main() { while(true) { blink(); } } //main program starts here

After completion of the code you have to create its hex file. For creating hex file You have to perform Some operation shown in next slide.

Compile the code

This window appear and after that output window shows 0 Error 0 warnin0.g

Click on Build all This option will create hex file of the code.

This window appears after click on Build all

After the proceess ouput window show that 0 Error 0 Warnings

Go to the folder where you saved the file you will seen a hex file.

Burn this hex file in to microcontroller. For burning this hex file follow some instruction shown in next slide

Component Required

Serial Cable

Adaptor

PIC Programmer PIC KickStart board

Application Board

Fly Leads (connecting wires)

PIC Programmer

PIC KickStart board

Connect Serial Cable to PIC Programmer and PC

Connect PIC Programmer with PIC Kick Start Board as shown in Picture

Open PICPgm Programmer in your PC

You can Choose Log Tab to view all acions which are performed show in next slide

Click on Autodetect Programmer Log window shows the details

Choose: File >Load HEX file

Locate Your HEX File and Click to Open for loading HEX File

After Loading Hex File Click on Program PIC No. of Operation will be Performed Automatically 1. Erasing device 2. Programming code memory These Operation Shown in next slides

1. Erasing device 2. Programming code memory All the details also shown in Log Window

When Programmig Complete This Green Color dialouge box appear havig a massge Programming finishe succissfully

Connection with Application Board

Remove Pic Programmer from KickStart and Connect Adaptor

Connect +5v and Ground Pin of Application Board with Kick Start Board as shown in Picture Red Wire shows +5v Black Wire Shows Ground

Power ON/OFF Button Note: Power OFF the KickStart When you make the connection with any type of device LED should be OFF when Power OFF

Make the Connection according to picture and Power Up the Kick Start Board

END
This is a basic practical contains all thing which you need regarding in PIC Programming and Interfacing Now you can interface all devices in that similar way.

For any doubt Please mail. contact@technido.com

You might also like