5x7 Display  

Burning a Chip Page1


To go to actual "BURNING A CHIP" - CLICK HERE

This section shows how to connect a PIC chip to a COM port 

Burning a chip is also called Programming but since we refer to writing a program as "programming," we can think of burning a chip as "DOWNLOADING, DUMPING or BURNING."
The microcontroller we are using in this project (PIC16F84) can be programmed and re-programmed up to 1,000 times and this makes it ideal for experimenting. 
The other advantage of this chip is the ability to program it while it is "IN CIRCUIT."    The manufacturer of the chip has produced only very vague information on how to design a project capable of self-programming the chip when it is fitted to a project as they have a vested interest in selling their own "simple programmer".
But we want to do it even cheaper than the cost of a commercial programmer and we want to design with almost NO EXTRA parts on the board to provide this function. 
And it is quite possible. There has been a range of programmers capable of doing this, from a NO PARTS programmer to those having buffer chips to improve the programming signals. 
At first glance these programmers may seem to be ideal but after studying and trying each of them; the complexities they contain, don't make them suitable for the beginner. In simple terms, they were too difficult to get going. The authors were highly technical people and they expect highly technical constructors to put them together. 
They offered little or no technical back-up and some don't even supply a circuit diagram! It would have been nice to take one of these "Public Domain" projects and use it in our project. But they weren't suitable. Many of them did not verify the contents of the chip after programming and others were not suitable for programming a chip "in-situ." You had to take the chip out of the project and program it on a separate board. Some needed a 5v and 12-14v rail, while others needed to run under DOS. After eliminating each design, we ended up with having to design something ourselves. So here it is.

The basics of programming a PICF84 is simple.  When  /MCLR (pin 4) is taken HIGH (to a voltage called
VIHH 12v to 14v), the chip turns into programming mode and two pins change from in/out pins to Clock and Data pins. 
Port B bit 6 (pin 12) changes from  an in/out pin to CLOCK. (to clock data into the chip during programming and clock it out of the chip during "read" mode)
Port B bit 7 (pin 13) changes from  an in/out pin to DATA in/out. 
The /MCLR pin becomes Vtestmode during programming mode. 
Data books on the PIC16F84 state that the programming voltage (about 13v) is internally generated and the voltage delivered to the Vtestmode pin is purely a reference voltage and no current is required to be delivered to this pin during programming.  
Using these features we can produce a circuit with the PIC chip in programming mode. This is shown in the diagram below. This is not a functional circuit as the programming voltage (Vpp) must be able to be switched from LOW to HIGH to place the chip in programming mode.  

The four requirements above (12 to 14v, 5v for the chip, Clock and Data) can be obtained from the serial port of a computer as shown in the diagram below:

To understand the 5 lines of the COMmunications Port,  the direction of data flow and the voltage on the lines, we have to go back to the basic details of a SERIAL COMMUNICATIONS PORT. 
The original use for this port was to connect a computer (called the Data Terminal Equipment - DTE) to a device such as a printer, plotter or modem (called the Data Communications Equipment - DCE). The mode of communication is called RS-232. None of this involves our use of the port as we are not using it in the way it was intended. For instance, we are taking advantage of the fact that one of the lines produces a voltage of 12v and we use this voltage to power the project during programming. 
To understand how the lines can be used, you need to know if each line is an input or output and the voltage it is capable of supplying. Some of the lines are capable of supplying very little current (less than 1mA while others can supply 25mA to 35mA). Since our project draws very little current, (only 1mA or so in programming mode) the current capability of the lines is not an issue. But the voltage they are able to produce and the direction of signal-flow, are the issues. 
The diagram below shows the features of the 5 lines. 

Once we know the features of the lines,  we can write software to make them HIGH or LOW and either deliver data or receive data.
The TxD line is the Transmit Data line and it is purely used for the 12v it is capable of supplying. IT is taken HIGH during programming so supply both the programming trigger voltage for pin 4 of the PIC as well as the 5v rail for the operation of the chip. 
RTS is an output line from the computer and it will be used to clock the chip during programming mode so that command bits and data bits (from the DTR line) can be delivered to the chip. 
To put the PIC chip into programming mode, RTS and DTR are held LOW and TxD is taken HIGH. The chip now waits for 6 bits of data called a COMMAND. The first command may be "Load Configuration" or "Load Data for Program Memory" or "Bulk Erase Program Memory." In this way the commands and the data is placed in the PIC. 
After programming is complete, the program can be READ by sending a command "Read Data From Data Memory" and the bits will be transmitted out of the PIC to the computer via the CTS line. 
Resistors are needed between some of the lines and the chip to limit the current.
The 10k in the diagram above is not really needed but since Vtestmode pin requires very little current, the 10k will not upset the voltage delivered to the chip. 
The 2k2 feeding the 5v6 zener allows the 5v6 to be generated without reducing the voltage on the TXD line. 
The 22k on the RTS line allows almost any voltage to be present on the RTS line and only deliver a maximum of 5v to the PIC. 
The 4k7 serves two purposes. It limits the voltage from the DTR line to 5v, and allows the PIC to deliver an output to the CTS line. In other words, if the DTR line is LOW, the PIC will be able to deliver a HIGH to CTS. 

More to come.

Go to the next page:
Burning A Chip - Page 2