This is the section you have been waiting for. It's the "burning" section.
Burning is also called "Programming" or "Downloading a Program" It's the action of putting a .hex file into a microcontroller.
The things you need are:
- the Multi-Chip Programmer project. See construction HERE.
- an interface cable (the components come with the Multi-Chip Programmer). Click HERE.
- IC-Prog file Download it HERE. (See below first)
- a computer. PROGRAMMING/BURNING
STARTS HERE 1. Build the Multi-Chip Programmer Project and insert a PIC chip. The programmer does not have a zif socket and does not need one. We get around the problem in a very simple way. The chip you are programming is firstly fitted to a standard 18-pin IC socket and it is moved from programmer to project in this socket. This makes it easy to fit and remove. All you have to do is push the chip slightly sideways and it comes out of the socket without any effort. This saves you stabbing your fingers on the pins.
Before the programmer “burns” a chip, it will automatically erase any program in the chip, so make sure the chip is available for re-programming.
2. To get the programmer to work you need IC-Prog.
Unzip the program and create a shortcut to your desktop.
3. You will need a .hex file for the programming operation. It can be any .hex file and our website has over 100 .hex files for our projects. Choose any file.
(To make full use of a .hex file, you will need the project)
5x7 .hex files See the project: 5x7 Project
Robot Beacon .hex file for PIC16F84A See the project: Robot Beacon
PIC LAB-1 .hex files See the project: PIC LAB-1
4. Open IC-Prog from your desktop.
Select PIC16F84A as the processor and untick WDT, PWRT and CP. Select Oscillator: RC.
click on the file ICON at the top left of the screen.
A window will open up and show .hex files (if not, find a folder with the files).
Click on the file you need and click on OPEN.
The .hex values will be loaded into the window.
Click on the icon with the lightening arrow and the chip will be “burnt.” The programmer is capable of burning a number of different types of chips - both 8-pin and 18-pin types. The 18-pin chips fit into the socket as shown in diagram 1 above, while the 8-pin chips fit into the socket according to the type of chip. For PIC12c5XX chips, pin 1 aligns with pin 1 of the socket. For PIC24cXX chips, pin 1 of the chip aligns with pin 5 of the socket as shown in the third diagram. You will notice the chip is NOT at the end of the socket and you have to be careful when inserting it.
If you do not have a .hex file, you will have to create one using MPASM.
Unzip the file and create a shortcut to your desktop.
Open MPASM v2.07 and tick Radix default, untick case sensitive, tick warning level default, tick macro expansion default, tick HEX output default, tick generated files: Error file and List file. Processor 16F84A, tab size 8.
In the browse window, find the file you want to assemble. It must have an extension .asm Put the location of the file into the window. Click the button ASSEMBLE.
MPASM will take the .asm file and produce a .lst file and .hex file. The .hex is the file you need.
We have provided a number of projects on the website and they explain everything you need to know to get a project working.
The programmer is capable of burning a number of different types of chips. These come in 8-pin and 18-pin. The 18-pin chips fit into the socket as shown in diagram 1 above, while the 8-pin chips fit into the socket according to the type of chip. For PIC12c5XX chips, pin 1 aligns with pin 1 of the socket. For PIC24cXX chips, pin 1 of the chip aligns with pin 5 of the socket as shown in the third diagram. You will notice the chip is NOT at the end of the socket and you have to be careful when inserting it. The following has been provided by a constructor: Jason Williams.
He has built the Multi Chip Programmer and 5x7 Display and has sent the following:
You will need the following files: directio.zip (35KB) loaddrv.zip (28KB)
I have solved the burning bugs (with the Multi-Chip Programmer AND the 5x7 Display) and it appears the problems were to do with running Windows XP and using the "Windows API" option in IC-Prog instead of "Direct IO".
By running a cool utility called "totalio.sys," (in directio.zip) all applications get full control of the I/O ports and thus IC-Prog works perfectly under Windows XP and Windows 2000, since the IC-Prog driver that is available doesn't work for XP (at least it doesn't work for me).
How To Use IC-Prog with Widows XP/NT/2000:
You can download a driver for IC-Prog from their website - it is called "icprog.sys" but it is really just a renamed driver originally called "giveio.sys". This utility was written by Dale Roberts as one of a set of utilities to give applications under NT more control over the I/O ports. Clicking on the "Enable NT/2000/XP Driver" check box in the settings will try to install this "icprog.sys". Under XP (on my box anyway), it installs but can't be started. There is probably some black magic regarding security permissions when creating symbolic links.
The purpose of this driver is to give an application access to the I/O port but only through the driver. This is because XP, like 2000 and NT, doesn't let you have full access to I/O ports like in 95/98/MS-DOS.
However, there is another way. By using another utility written by Dale Roberts, called "totalio.sys", ALL applications can have full control over the I/O ports, and not through a driver's interface. This means you can let IC-Prog use "Direct I/O" instead of "Windows API (in the "Interface" group of hardware settings) and ignore the "Enable NT/2000/XP Driver" option completely. "totalio.sys" (in theory) should also let any programs which control ports directly to work under XP.
Installing "totalio.sys":
Extract "totalio.sys" from the "directio.zip" file to "C:\Windows\system32\drivers" directory (or equivalent). Extract "loaddrv.exe" from the "loaddrv.zip" file and run it.
In the edit box, type in the full path to "totalio.sys" eg. "C:\windows\system32\drivers\totalio.sys"
Click "Install".
Click "Start".
Click "OK".
The driver should now be running. You can check this by running "Start->Programs->
Accessories->System Tools->System Information", then clicking on the tree item "System Information->Software Environment->Drivers" and looking for "totalio" in the view on the right.
To start or stop the driver after it has been installed, you could use the "loaddrv.exe" program, or use the following commands in a command prompt:
"net start totalio" to start the driver.
"net stop totalio" to stop the driver.
You could put this in a batch file in the IC-Prog directory, eg.
@echo off
net start totalio
icprog
net stop totalio
You can configure the driver to run automatically on startup, but I wouldn't recommend it. You can do this via Device Manager, select "View->Show hidden devices" and look under "Non-Plug and Play Drivers" to find "totalio", look at its properties, and change the startup type from "Demand" to "Automatic" (NOT "Boot" or "System") in the "Driver" tab.
The batch file concept is safest, as you only run the driver when you need to and unload it when you don't need it.
How to configure IC-Prog:
Goto: Settings->Options->Misc. Tab
Uncheck "Enable NT/2000/XP Driver"
Uncheck "Enable Vcc control for JDM" (the help file says it is experimental and not to use it).
Select "Realtime" in the "Process Priority" group. (in theory, this will prevent other CPU-intensive applications from interrupting your burn process).
Goto: Settings->Hardware
Select "JDM Programmer" from "Programmer" dropdown list.
Select "Direct I/O" from "Interface" group.
Uncheck all the check boxes under "Communication".
Select correct COM port.
Move the "I/O Delay" slider to 10. (other values gave errors for me, but this value could be specific to the PC's CPU speed - tweak until you get no read/write errors).
Why "Windows API" doesn't work:
My hypothesis is that using the Windows API introduces slight delays in setting the serial control lines, such that occasionally the data pulses aren't co-ordinated with the clock pulses during a burn. Whole 14-bit words don't get written, depending on the circuit the word will be all 0 bits or all 1 bits depending on the state of the chip's data line. In my experience using the Multi-chip programmer, it meant 5% of the words were burned 3FFF, but not consistently, ie. the errors moved around each burn. Read errors were rare (multiple reads returning different data) but they also experienced the occasional incorrect word of 3FFF or just a few bits gone to 1.
These problems all magically disappear once you use "Direct I/O".
|
Settings to use IC-Prog with Windows XP:
- Open a browser and select the file ic-prog.exe
- Press right button on your mouse
- Go to Propertties
- Go to Compatibility menu
- Set compatibilty mode as Windows 2000 or Windows 98 / Win ME
- Press Apply icon
- Press Accept icon
You need to copy icprog.sys into the SAME directory as icprog.exe. Then you can enter in the ic-prog software, go to Settings, Options and choose the Misc. page. There you can enable the "NT/2000 Driver" it will then be installed.
Latest PC board v628
The latest version of the Multi Chip Programmer (v628) will now program a PIC16F628 via "normal" mode (12-14v on pin 4).
Mod:
To convert previous versions of Multi-Chip Programmer PCB's:
Cut the track connecting pin 10 to 5v rail.
Fit a 10k resistor between pin 10 and 0v rail. (see the layout below)
When a chip is to be programmed for the first time, either the low voltage or high voltage method can be used.
When a PIC16F628 is programmed in the "high voltage" mode, the chip can be re-programmed in the high-voltage mode or you can set the LVP bit to "0" so that the chip can be re-programmed "in-circuit" via the LVP mode. The Low Voltage Programming-mode allows the chip to be re-programmed by applying 5v on pin 10 (instead of 12-14v on pin 4).
The Multi Chip Programmer "burns" a PIC16F628 in the "high voltage" ONLY. You can re-burn the chip "in-circuit" or in the Multi Chip Programmer, depending on the setting of LVP. The chip comes with LVP set to "1." See below for details on this. When burning a chip for the first time, an instruction in your program sets LVP to "0" or "1." If it is set to "1" you can use either re-programming method, but you lose RB4 as an in-out pin. PROGRAMMING THE PIC16F628
This chip has two programming modes:
Normal Mode: 12-14v on Pin 4
Low Voltage Mode: (LVP) 5v on pin 10.
The PIC16F628 has a Low Voltage Programming-mode (LVP) for in-circuit programming. In this mode, the chip can be programmed with 5v on the programming pin (pin 10) instead of 12-14v on Pin 4.
Before deciding on the way you will program the chip, you need to know some of the differences and limitations.
The PIC16F628 chip is supplied with the LVP bit as "1."
When the LVP bit is "1," RB4/PGM (pin 10) is dedicated to the programming function and is not available as in-out pin RB4.
The chip will enter programming mode when a HIGH (5v) is placed on RB4/PGM (pin 10).
This makes the chip "in-circuit" programmable and re-programmable "in-circuit."
If you don't want the "in-circuit programmable" feature, LVP bit must be "0." To make LVP bit "0," the chip must be programmed via "Normal Mode," using 12-14v on Pin 4. The LVP bit cannot be changed when programming "in-circuit."
When programming via "Normal Mode," an instruction is available to change the value of LVP. This instruction is covered in our PIC Programming course, Page 33.
A Recap:
If you program via the "Normal Mode" (12 - 14v to "activate" the chip - to put it into "program mode"), you can use all the features of the chip. (Remember RA5 is input-only, so "Port A" is not a "complete port.")
If you program via "Low Voltage Mode," output line RB4 (pin 10) is not available as you are reserving the pin for re-programming via LVP.
This is very inconvenient as "Port B" is normally used as a complete 8-line output to drive displays etc. To have one line missing from the port is like buying a book with 15 pages missing! Port A is already an incomplete Port, with RA5 as input-only. It would have been much more convenient to put LVP pin on port A and leave Port B complete! Such are the limitations of life!
If you program a chip for the first time: "normally," you can re-program it "in-circuit" (via the 5v feature) or re-program it via the "normal" method.
If you program a chip for the first time: "in circuit," you can regain the RB4 as an in-out line by re-programming it "normally." You cannot regain RB4 as an in-out line by re-programming it "in-circuit."
I hope this covers all the possibilities. For more information about writing a program for the PIC16F628, see our PIC Programming course, Page 33.
PROGRAMMING THE PIC16F628A
The PIC16F628A has some different features to the PIC16F628 and cannot be programmed on the old version of IC PROG (version v105c). The new version is called (v105c-a) IC PROG.
A .pdf file outlining the differences can be found HERE.
This completes the Multi-Chip Programmer project, but it's just the beginning of PIC Programming.
There are so many places you can go.
See our other projects in the "FREE Projects" section. |