Become a subscriber (Free)

Join 29,000 other subscribers to receive subscriber sale discounts and other free resources.
Don't worry -- your e-mail address is totally secure. I promise to use it only to send you MicroZine.

Setting up the C Programming Tutorial Course

This page shows you how to setup everything for the course and goes through setting up hardware and software in a fair bit of detail. There is a lot of information to go through because everything has to be in place.

In fact the first setup is the most difficult part of any project to get going and you are going to have learning curves for each piece of software, so take some time to go though this information carefully.

Setting up hardware and software.

For the programmer I would recommend a PicKit3 as these are USB based and have the necessary ICSP interface. You can easily get these from ebay and use the free MPLAB X software to program the PIC device.

If you need an alternative, you can use ICPROG, which is only relevant if you want to use an older computer with a serial or parallel port built-in. Instructions for using this legacy method are at the end of the page.

For the other components you should have most of the stuff lying around if you have done any type of electronics except for the programmer, RS232 chip and PIC. For getting information out of the project and into the PC a USB to RS232 is needed and this can also be bought on ebay.

Note: You can use a serial port adaptor that does not require you to use an RS232 chip - it plugs directly to the PIC chip.

The course is built around mainly standard components except for the following

Chips You may not have on the bench:

External hardware you need is:

  • Serial Port adaptor : A USB to Serial converter (a good place to get these is ebay) or serial port adaptor.
  • ICSP programmer : A PicKit 3 (again you can get these from ebay).

ICSP Programmer - if you are using a different programmer then check the following:

You will need an ICSP capable programmer, any will do as long as it has the following connections:

  • PGM
  • PGC
  • PGD
  • GND

Also it must be capable of programming a 16F88.

Hardware required for course:

You will also need to purchase the following hardware:

  • External Hardware needed Serial Port USB interface adaptorfor the PC.
  • External Hardware needed ICSP programmer for the PC.
  • Hardware (Bill Of Materials)

The circuit

Compiler setup:

Preparing the 16F88

MPLAB X programmer (recommended)

ICPROG (legacy programmer)

This is for older computers that have a serial port or parallel port.
Use only for older computers that have a parallel port
or serial port (and appropriate programming hardware that you make or buy).

Click to find out details of ICPROG

The Compiler (Free for this course!)

NEW Updated all C Project Course files to MikroC PRO V6

The first thing you need to do is down load the compiler : Click Here . Download the executable to your computer, double click it and follow the instructions.

It has free output up to 2kHex Bytes!
You don't need to buy it.

The course works fantastically well within this limit.

Note: This compiler allows you free use up to 2k output (hex file) size - all the examples in this course generate code below this limit.

First circuit for the C Programming Tutorial Course:

Next you need to construct the following circuit:

Note D7 should be placed at the top right of your development board as this will form part of the dice circuit later on.


Layout this circuit, noting that the diode D7
is the top right diode in a dice display so
allow room to the left and below D7.

Initial circuit for the C programming tutorial course

16F88 c programming course intro

Learn about the tool used for creating this
c programming tutorial diagram.


Layout this circuit, noting that the diode D7
is the top right diode in a dice display so
allow room to the left and below D7.

BOM for the C programming tutorial course.

For this page - see below for BOM for the 1st complete circuit.
Here is the list of parts for the above circuit (or Bill Of Materials):

C programming tutorial BOM

Item Part Description Qty IDs
1 10u electrolytic capacitor 2 C1 C3
2 100n Capacitor 3 C2 C4 C5
3 1u electrolytic capacitor 4 C6 C7 C8 C9
4 DB9F-90 Dtype connector 9 way RS232 on PC COM port 1 CN1
5 2.1mm jack Power Connector socket showing NC connection 1 CN2
6 1N4001 diode 1 D1
7 RED Light emitting diode 6 D2 D3 D4 D5 D6 D7
8 1N4148 diode 1 D9
9 1x4 Header 4 way 1 HD1
10 Push button push button normally open 2 PB1 PB2
11 100 resistor 1 R10
12 10k resistor 2 R1 R2
13 1k resistor 7 R3 R4 R5 R6 R7 R8 R9
14 16F88 Microcontroller 1 U1
15 MAX232CP RS232 level translator 1 U2
16 LM7805C 5V 1A voltage regulator 1 U3
17 LM324 Quad opamp 1 U4
18 20k Resistor 4 R10-R13
19 100 Resistor 1 R14

End ofC Programming Tutorial BOM.

The last 3 components are for the curve tracer which also uses 10k resistors for gain setting.

(Click here for the parts list and circuit for c programming course 1st project)

You also need a circuit board to work on, or a solderless breadboard and wire for connecting up the circuit.

Preparing the 16F88 for the C Programming Tutorial:

R1 stops the part entering the wrong programming mode (LVP mode).  LVP mode is the default mode (Low Volt Programming) and is always enabled for new parts but it makes the pin unusable for anything else.  Since there are not many pins in this particular part the first task is to disable LVP mode.  

You can do this by programming the part with the first program which has turned off the LVP fuse and at the same time it flashes the LED so once the part is programmed you can see that it's working.

At this point you don't need to do any compilation or C coding so lets just go through the programming process.

Note: Later diagrams may not show R1 as it is only important when 1st programming the part (if you ensure that the LVP control is always set to off in the compiler project edit control panel - see videos for more information on that).

Once LVP is programmed off then the PGM pin becomes a 'normal' pin i.e. you can treat it as normal I/O and use it just like any other programmable I/O pin.

Directory Organisation

C Programming tutorial directory preparation.

Create a working directory:


Download hex file for setting up the C programming tutorial

Download the following zip file:

Download file: Download here.

Download the file "" to that directory.  

Note: I use 7zip - just do a google search for '7zip' if you don't have an unzip program which is free and integrates into the windows shell - meaning you can right click in explorer and directly zip/unzip files.

Unzip the file '' in the pic-c-course directory.  It will create a directory c:\pic-c-course\prog00-16F88-intro\ in which will be a hex file.

MPLAB X Programming

This is the prefered method : Create a pre-built project in MPLABX in the directory that contains the hex file and hit the programming button.

I have created a pages that details this process here:

MPLAB X pre-built hex file programming


######### LEGACY INFORMATION FOLLOWS ###########


LEGACY programmer ICPROG

C programming tutorial: Program the 16F88 using ICPROG

Note: ICPROG is a legacy progammer.

Follow the instrucitions for your ICSP programmer to program the chip.

However the process described below is similar for all programmers and is therefore left here for reference.

More details on using ICPROG here.

For this C programming tutorial you should have installed ICPROG so start that program up now.  Setup the hardware interfaces for your programmer using the options menu.  

If you are using the parallel port programmer then the setup details are shown in the image below:

ICPROG setup parallel port programmer

Note: You can set the I/O delay to zero (tested on my parallel port programmer) - this will program the device slightly faster.  Also if you use XP you'll need to select the Windows API interface (in the above box).

Note: For Windows XP use Windows API.

Note see module 1 of the course for a video tutorial on ICPROG.

Load hex file

Now open the file (in ICPROG)


Now program the file into the PIC Microcontroller.

Note: You can find detailed instructions on using ICPROG for this C programming tutorial here.

C programming tutorial: Result

You should now have a circuit with a flashing LED - this is the equivalent of the "hello World" program you usually find in the start of C courses but because the microcontroller is only concerned with I/O ports there is no way of displaying a message yet ...

... later on we'll look at RS232 where you can make a hello world program.

Congratulations... have programmed the microcontroller correctly and are now ready to start the C programming tutorial course.
This proves that all the software and hardware is operating correctly.

C programming tutorial: Notes

Things to note about the circuit for the C programming tutorial course:

  • It uses the internal oscillator.
  • It has an internal reset circuit.

The internal oscillator is running at 4MHz and saves you using an external crystal or RC network.  Similarly the reset circuit is also internal.  Both these features save pins as what was once a dedicated reset pin can now be used as an I/O pin.  Again using the internal oscillator saves two pins for use as I/O pins.

End of C programming tutorial Setup page.

-------------------------- ICPROG (legacy programmer information ) -------------------------

It is recommended that you use a USB programmer
such as a PicKit 2 or PicKit 3

ICPROG setup:

Use only for older computers that have a parallel port or serial port (and appropriate programming hardware)

This is for older computers that have a
serial port or parallel port (or you fancy building it all yourself).
I started out by building a parallel port interafce - and it works fine - do check on this website for details of that parallel port programmer as you will need to inculde the transmission line termination impedance to make it work over long cables reliably).

C Programming Tutorial: Programming software : ICPROG (Free!)

Download and install ICPROG which is PC software that generates the correct serial ICSP signals to program your PIC chip.  You can use it either on a parallel port, serial port or USB port with a USB to serial adapter - ( USB <-> Serial untested).

Note: Look in left frame for download button.

C Programming Tutorial: Setting the path to ICPROG 

You should setup the environment variable to icprog.exe so that it can be called from anywhere but if you don't you can still start icprog by double clicking icprog.exe in its installation directory.

The installation location is up to you but you should put it into a directory that is in the current path so that windows can find it or add the directory (where you put ICPROG) to the system path environment variable.

Unfortunately setting up the windows path is different for every windows installation from Windows 95 to XP so  you will need to find the exact details for your operating system.  Windows 95 uses autoexec.bat and config.sys.

For XP you can set the path from Start --> Control panel --> System --> Advanced (tab) --> Environment variables.  You can set the path for a user or the system.  I usually set the system path but see below:

Note : Do not delete the path variables and only add to the end of them. If unsure select the system path value and copy and paste it to a local editor.  There edit it keeping all the original - make sure it is exactly the same with only your additions on the end.  e.g. if you want to put icprog.exe in a directory c:\icprog-path add the text 'c:\icprog-path;' to the end.  Note save the text editor text and check everything works as before - if it does not go back and set the path to what you started with.

C Programming Tutorial: ICPROG for Windows 2000/XP users

Windows 2000 and XP stop you using the parallel port directly by adding a layer of software between your program and the parallel port.  It's probably there so that no more than one process (e.g. printer) or user can access it at the same time - but a 'PC' is a personal computer usually used by one person this "feature" just gets in the way.

What this means is it is a pain if you want to use the parallel port for hardware.  To get round this you have to install another piece or software which *will* allow you access to the parallel port.  For ICPROG this program is a system driver and you can also download it from the ICPROG page it is icprog.sys (see instructions for getting this driver below)

For a parallel port programmer you need to install icprog.sys to allow the software to have parallel port access:

Note: A Serial or USB port programmer does not have this restriction.

Open an explorer window and navigate to the icprog install directory,

Download the icprog.sys file to your icprog install directory i.e. in the same directory as icprog.exe.  

Finding icprog.sys

The Driver is a little buried on the site but here are instructions for obtaining it :

To get to the driver, click download link on the left
column at and then in the main page
the scroll the right column to find the text link
(just above the help files) i.e. the link labelled:

IC-Prog NT/2000

Click the link to download the zip file:

Then extract icprog.sys from the zip file
(using winzip or (free)

C Programming Tutorial: Windows XP and ICPROG

Using explorer select icprog.exe, right click.  Then select the Properties menu then the Compatibility tab.  Make sure compatibility mode is disabled - icprog will  set this for you as you follow the next instructions.

Start ICPROG  - a privileged instruction error occurs - ignore this - icprog starts.

Now in icprog choose Menu --> Settings --> Options --> Misc (tab) and set Enable NT/2000/XP Driver - icprog will now re-start with the driver installed.

Back to start page.

New! Comments

Have your say about what you just read! Leave me a comment in the box below.

Privacy Policy | Contact | About Me

Site Map | Terms of Use

Visit our Facebook Page:

   Click Here

Recent Articles

  1. How to use a DS18B20 (single or multiple on one wire) for temperature measurement using the Arduino Uno.

    How to Easily Use the DS18B20 Maxim One-Wire thermometer with Arduino example code showing external or parasitic power modes.

    Read more

  2. Digital I/O Expansion - How to increase your microcontroller Input and Output pins.

    Digital I/O expansion. Several diferent serial design techniques with different tradeoffs to increase the number of input or output pins in your microcontroller design.

    Read more

  3. How to use the BMP280 Barometric Pressure chip with the Arduino

    How to use the BMP280 for weather pressure measurement or altitude change detection.

    Read more

Sign up for MicroZine
''The'' Microcontroller Newsletter

Enter your first Name and primary email address in the form below:

And receive absolutely FREE a full project for:

"Measuring Analogue Voltages
Without An ADC"

(Using only one pin).

Instant Download:
You Can
Get It Right Now

Warning: This project could be  Removed 
at any time.  

It will  NOT be 
available indefinitely SO
To avoid 
disappointment  get it:


Don't worry -- your e-mail address is totally secure. I promise to use it only to send you MicroZine
Remember this is a project with full description and fully debugged C Source code - and it's not available from the main website.

You can only get it through this newsletter.

To get exclusive access Enter your first name Name and primary email address Now in the form above.:

But wait !

There's more...

You'll receive more
free and exclusive reports as well as site information and site product updates

Scroll up to the form above and sign up NOW. Don't forget it's FREE and if you don't like it, you can unsubscribe at any time.

Click Here Now to use the form above to get your Valuable information absolutely free.

Readers Comments

"I wanted to thank
you so so so much
for all the information
you have provided in
your site it's


- Ranish Pottath

"This site really is
the best and my favorite.
I find here many useful
projects and tips."

- Milan


"Awesome site,
very, very easy and nice
to navigate!"

- Matt

Learn Microcontrollers

"Interested in

Sign up for The
Free 7 day guide:


"I am a newbie to PIC
and I wanted to say
 how great your
site has been for me."

- Dave


"Your site is a great
and perfect work.

- Suresh


"I couldn't find the correct
words to define
yourweb site.

Very useful, uncovered,
honest and clear.

Thanks so much for
your time and works.

- Anon

Back to Top