Pic Serial Programmer

Posted : admin On 12/26/2021

Programmer uses In-Circuit Serial Programming (ICSP) interface described in PIC18F2455 / 2550 / 4455 / 4550 Data sheet. Serial port is not used in standard communication mode (where RxD, TxD are used for regular data transfers). Programmer uses control pins of. Nowadays, my programming all done with PBASIC, compile into HEX file then program it using Universal Programmer. Please give me some better idea how I can program the PIC by using c, compile it, and program it.

Latest DIYpack for PIC programmers K128, K149, K150, K182

March 2nd, 2007

Kit 128 Pic Programmer

Kit 149E Pic Programmer

Kit 150 Pic Programmer

Kit 182 Pic Programmer

April 7, 2005

Bob has put together some Notes on PIC ICSP Programming.

Current Documentation being shipped with Kits 128 149 150 and 182.
Kit 128
Kit 149 Upgraded April 17, 2005.
Kit 150
Kit 182

See pdf files within each diypack for more information and schematics.

March 25, 2005

If you log onto the Kit Forum you will see Bob Axtell is hard at work redesigning MicroPro, and doing a new PIC ProgrammerKit 185. One small problem we are fixing now is the transistors blowing particularly if ICSP wires are shortcircuited. In Kit 149we are now using 3xBC327-40 instead of the BC558, and the SOT23 MMBT2907A transistor for the other kits.

Latest DIYpack for K128/149/150/182

Download diypack25.zip This will be the last diypack until P19/MP2 is released. No new PICs will be added for the time being.

Software protocol so people can port it to other platforms - click here (P018 as of August 16, 2004).

Here is a list of the PICs the software & firmware of diypack25 supports for K149 and K150. K128 and K182 are flash programmers and support only those PICs with an 'F' in the partnumber:

12C508 16C65A 16C77 16F76 16F877
12C508A 16C65B 16C710 16F77 16F877A
12C509 16C66 16C711 16F737 18F242
12C509A 16C66A 16C712 16F747 18F248
12C671 16C67 16C716 16F767 18F252
12C672 16C620 16C745 16F777 18F258
12CE673 16C620A 16C765 16F83 18F442
12CE674 16C621 16C773 16F84 18F448
12F62916C621A 16C774 16F84A 18F452
12F675 16C622 16C83 16F87 18F458
16C505 16C622A 16C84 16F88 18F1220
16C554 16C71 16F627 16F818 18F1320
16C558 16C71A 16F627A 16F819 18F2220
16C61 16C72 16F628 16F870 18F2320
16C62 16C72A 16F628A 16F871 18F4220
16C62A 16C73 16F630 16F872 18F4320
16C62B 16C73A 16F648A 16F873 16C63
16C73B 16F676 16F873A
Added from diypack23:
16C63A 16C74 16F684 16F874 16F5x
16C64 16C74A 16F688 16F874A 10Fxxx
18F6525 6621 8525 8621
(all beta) 16C64A 16C74B 16F73 16F876
16C65 16C76 16F74 16F876A
Added diypack25 12F683

Support for 16F88 added in diypack22 on. Note 10K resistor needs to be added between pins 9 & 10
of Programming sock

Previous DIYpacks

If your kit documentation says to get diypack18 or diypack19 or diypack22 etc. then you MUST get that version so that the supplied firmware runs with the MicroPro.exe version in the corresponding diypack. After you get the kit going then upgrade to the latest version by programming the firmware with the appropriate hex file from the latest version, replacing the firmware IC then running the latest MicroPro.exe.

diypack23v2.zipSeptember 29, 2004. Voice annotations deleted. Support added for 15F5x. Beta (untested) support for 10Fxxx18F6525 6621 8525 8621
diypack22.zip
diypack21.zip
diypack20.zip
diypack19.zip
March 2, 2004. To load into 628A chips go into Fuses and turn all code protection OFF.
diypack18.zip
diypack16.zip
diypack15.zip
diypack14.zip
diypack11.zip
diypack10.zip
diypack9.zip
diypack8.zip
diypack7.zip

Some users have experienced trouble installing Micropro.

SOME versions of Windows XP won't allow the DIYPACK installer to work. Bob has done some research and discovered that the handler was Win16 (1997). So for people that were completely unable to install MicroPro, Bob has come up with different versions of DIYPACK22 and DIYPACK25. NOTHING is changed except the handler itself. So at the next release and thereafter, DIYPACKs will use the Win32 Installer. This is a subtle hint that, like DOS, Microsoft is slowly dropping Win16 apps!

You can download Bob's versions here - diypack22a.zip and diypack25a.zip

USB Drivers

The USB VCP Windows drivers can be downloaded from the FTDI website at http://www.ftdichip.com/Drivers/VCP.htm. Select the driver for the Windows version you are using and the ZIP file will be downloaded. All the programmer kits use the 'FT232BM' chip.
Installation guides (PDFs) can be found at http://www.ftdichip.com/Documents/InstallGuides.htm

Fixhex is a correction program for people that have C compilers that output odd number of bytes on a Hex file line. MicroPro rejects the file, and people can't use DIY Programmers as a result. This program corrects the Hex file so MicroPro can take it. (April 1, 2005)

New USB PIC Programmers - Design Philosophy Kits 149 128 & 150

March 23, 2003. We are rapidly developing three new PIC programmers using the USB port: kits 128 149 and 150.
Originally there were going to be software packages for all three but it became clear that the one software package covering all three kit would be best.

March 24 a new software package for Kit 149 is released with a hardware change needed: replace the 4.000MHz crystal by a 6.000MHz crystal. More details below. Then all 3 kits will now be operating on the same clock speed and the user interface will be the same for all three kits. The new Kit 149 software (V250303) also fixed some bugs in the previous V030303 release.

Kit 149 (version A PCB). USB & Serial Port PIC Programmer. All thru-hole components except the FT232BM chip. (This version is now sold out.)

May 11. Kit 149 version B PCB now released. It adds ICSP and take off 1 crystal, some resistors & other components.) Note the ZIF socket is not supplied with the kit. It must be bought extra. An ordinary 40 pin IC socket is supplied with the kit.

April 10, 2004. Kit 149 Version C now released.

Kit 150. ('Kit 149B without the serial port.') USB PIC Programmer, ICSP programming supported. Mostly surface mount. ICSP mode. Some thru-hole components. Released august 22, 2003. New version April 2, 2004.

Kit 128. USB all-Flash PIC Programmer. No external power supply. No ICSP. Mostly surface mount. Choice of 40 pin wide slot ZIF socklet or just 0.6' 40 pin IC socket. All surface mount components are presoldered. Released april 5, 2003.

Kit 149, USB / Serial Port PIC Programmer

Released 12/2002. A DPST switch switches between USB and serial modes. The kit uses a modern, surface-mount FT232BM presoldered on the solder side of the board.

September 9, 2003. Hardware Modification K149A K149B K150.

It has been pointed out that in the circuit design of these kits when the kit is placed in a Reset state then the programming voltages all appear in the programming socket and on the ICSP pins. This will also happen when the Boards are connected and MicroPro is not running. Normally this will not be a problem since ICs are only programmed when MicroPro is running. But it is undesirable. The solution is to add three 3K3 resistors as shown here. These resistors will be added in the next PCB production of these boards.

Software

March 23, 2003 - We have struck some problems with the V030303 User Interface software. Please go back to the V110103version together with either of the following hex files for the firmwware. You can direct program the firmware using these files. Wewill sort out the problem in the next User Interface release.

firmware hex files. These hex files can be direct programmed. you do not have to use the Options/Upgrade. Use the k149_v4.hexfirst.

NOTE: if you have put in the no-keypress programming link after you used V030303 you MUST remove it when running this earlier version.

March 27.V280103 User Interface software, k149_v61.zip This upgrade does two things: it replaces V030303 which had some bugs and it upgrades the hardware to a 6MHz crystal operation.

BEFORE you upgrade to this version you MUST have a 6.000MHz crystal available. Use the hex file 'k149av61.hex' containedin the zip file to program a new firmware IC. Then change the 4.000MHz crystal to a 6.000 MHz crystal then you are upgraded.Then add the link for the no-keypress programming mode.

April 3, 2003. Since the same User Interface is now going to be used for Kits 149 (A and B), 128 and 150 here is the latest upgrade which now unpacks in c:diypgmr. In addition, this upgrade can recognize which programmer board is connected to the PC. For Kit 149A you MUST program a new firmware chip FIRST before you run the latest version. Read the upgrade.txt in the unzipped file. Get the latest version from here. diypack7.zip

May 11. Kit 149 version B PCB now released. It adds ICSP and take off 1 crystal, some resistors & other components.) 40 pinwide slot ZIF socket optional for both.

Pic

Kit 128 USB Flash PIC programmer with ZIF socket

April 3, 2003. The latest USB port all-Flash PIC Programmer. Hardware and software designed by Tony Nixon. No external power supply needed. Only the bi-LED pokes up above the box. Choice of 40-pin wide-slot ZIF socket or ordinary 40 pin 0.6' IC socket in case you have your own 40 pin ZIF socket. Mostly surface mount components. Uses a USB 'A' type extension cable, A-A.

Download the 13 page User Manual here. (This is also in the User Interface download.)

Download k128intro.pdf documetation which comes with the kit.

Please note this programmer does NOT program non-Flash chips! Please make sure you know which PIC chips are Flash (the ones with the 'F'!) and which are not.

Kit 182 USB Flash PIC programmer no ZIF socket

Kit 182 is Kit 128 without the ZIF socket. It is thus a Flash ICSP Programmer operating from the USB port. It will be sold fully assembled as most of the components are surface mount. The board is only 48 x 30mm. There are 4 nylon 10mm standoffs to protect the underside. USB 'B' female connector.

Make sure you understand ICSP before you buy it. We had one complaint already from a person who bought the Kit then complained there was 'nowhere' to put the IC!

Kit 150 USB PIC Programmer

August 22, 2003. Finally released today. It has a B USB connector put on it as well as a 6 pin ICSP connector. We are selling it without a ZIF socket but a 40 pin ZIF socket is recommended for most programming since it is so convenient.

PIC Programmer FAQ

Enquiry: Peter, I need your help with my MicroPro Programmer. I am using version 11 DIYPACK11.ZIP. I am using MPLAB 6.41 and the most updated version of HI-TECH PICC-18 v8.30 to generate a hex file for my application. When I use MicroPro with the hex file, it says 'expecting INHXFILE'. Some of the hex files I use do work , while others give me this error. If you can help me figure out this problem I would appreciate it.

Tony's answer: What is happening is that most compilers place :020000040000FA at the start of INHX32 files to signify address 0000:xxxx The 04 identifier specifies an upper 16 bit address, the next 4 digits, '0000' in this case. :020000040030CA This one specifies upper 16 bit address of '3000' = 3000:xxxx which is the address for the fuse data. Your compiler does not place :020000040000FA on the first HEX file line so MicroPro gets confused and thinks it is not an INHX32 file. diypack17 (now available) has an option to disable this message.

-=Atmel Programmers=-

Kit 122. Atmel AVR programmer. To program 20-pin DIP - 90S1200, 90S2313, and 40-pin DIP - 90S4414, 90S8515. Programs at 9600 baud. Parallel mode. With the optional adaptor board you can now program AT90S4434 and AT90S8535. It will not program the 8-pin AVR devices (90S2323, 90S2343).

Revised 8/2001

K122 assembled & tested. This is how we sell the assembled & tested Kit 122. the choice of ordinary IC sockets or ZIF sockets is left to the buyer.

Adaptor board for K122 to program 90S4434/8535.

underside view of adaptor board
top view of adaptor board

Customer Question: but you don't need a programmer to program AVR's. Just a few lines to the parallel port will do it - seedontronics.com!

Response: the AVR's have a serial programming mode called ISP - In System Programming. Yes you can use a few lines of code from the parallel port to programming the flash, eprom and lock bits. BUT the AVR chips have 'fuse' bits which are not accessible in serial programming mode. For example, in our Kits 129 and 154 we have to program one of the fuse bits RCEN to enable the internal oscillator. This would not be possible using serial programming. Also there is a fuse bit to disable serial programming. If this fuse bit is programmed then the chip is not accessible at all using ISP. It would then only be programmable using a programmer like the 'parallel-mode' Kit 122.

Of course you could make a 'parallel-mode' programmer to operate using the parallel port instead of the serial port like Kit 122. But we decided against this because it would require special software to run on each type of computer. The BIG advantage of Kit 122 is that all the intelligence is in firmware on board the kit. Kit 122 will work on all types of computers. All that is needed is a terminal/communications program which all computers have.

Pic Serial Programmer

The disadvantage of using an intelligent programmer like Kit 122 is that upgrading the programmer to program new chips requires reprogramming the firmware. Since we do not want to release the hex code this means returning the firmware to us.

Kit 117 is an example where we have got special Windows-only software running on the parallel port. Upgrading for new PIC chips is done by simply adding it to the 'device.ini' file.

Getting Started in AVR programming. V4. November, 2000. now available.

Davis vanHorn writes: it was first written to illustrate how to set up the AVR8515, and how to use the major on-board peripherals, but like anything left in the refigerator too long, it's been growing. It has a bunch of handy routines for external devices, like R/C servos, LCD and VFD displays, stepper motors.. Version 4.0 has all that, plus:
- the elimination of the old linear buffers. They've been replaced with variable length circular buffers. I made them variable length, in preparation for a dynamic allocation scheme, but I'm not sure at this point if it's worth implementing. That's part of what I'm exploring for version 5.0

- the implementation of a language interpreter, reading commands with optional parameters from EEPROM. This also means that the program in EEPROM is alterable, so this is a starting point for a robot or other device that could 'learn'. The language only has four commands implemented, but I didn't want to make it too complicated at first. It is trivially easy to add your own commands, and they can be simple procedures, or they could alter the behaviour of other parts of the system. It's entirely up to the user. Currently implemented commands: Delay (ms), Servo position (servo) (position), Loop, and Skip (commands to skip) I didn't implement variables, but adding a few fixed variables would be trivial. I'm looking for a more flexible scheme that would allow me to allocate variable memory dynamically, but again, that's something for 5.0

- there are many cleanups and improvements in the other routines as well. The hardware assignments are easier to deal with, and I've pulled in all the rom and ram allocations to the routines that use them, rather than having them in 'tables.asm' and 'equates.asm'

- tt's still fast, and it uses just over half the rom (as configured) and less than half the ram (again, as configured) In a real application, you probably allocate only a small subset of the buffers I have in this demo, but I wanted to make it visually 'busy', so I am using all eight servos (one is controlled by the interpreted program, one is controlled by the random generator, and the rest simply ramp), a VFD display (scrolling the top and bottom lines in opposite directions within the same buffer), and LCD display with different text, but scrolling similarly, and a 'Quick brown fox' output on the serial port, plus morse code output with randomized messages. Given all that, the CPU is still nearly idle :)

Kit 123. Atmel 89xxxx Programmer

To program
· 89C1051, 89C2051 and 89C4051
· 89C51, 89LV51
· 89C52, 89LV52
· 89C55, 89LV55
· 89S8252, 89LS8252
· 89S53, 89LS53
. 87F51, 87F52 (otp) support added august, 2000

Price $US49 plus $10 postage and packaging.

Two DOS utilities are available for downloading to examine and reorder fragmented hex files which some compilers produce. (Fragmented hex files can choke any serial programming software not expecting it.) hexmap.exe and reorder.exe

term.zip No frills terminal program written by Frank to program Kits 121 122 and 123. Easier than using Hyperterminal. DOS based but will run under W9x.

K151 Kit 151 EEPROM Programmer

PC Parallel port programmer for the 24xxx, I2C bus and 93xxx EEPROMS. 8 bit programming mode only. We use a 24C16 Software in the Christmas Tree Kit 103 so that was the main reason we did the kit. A 16 pin ZIF socket is used on-board. The top 8 pins are for the 24xxx; the bottom 8 are for the 93xxx SPI EEPROM's.

Kit 69. Electronic Dice PIC 16C54

One of the most popular electronic kits ever is an electronic dice. Now we have used a microcontroller to contain all the electronics. Only those items which cannot be put into software - like the display - are still in hardware. All the code is on floppy disk. PCB size 1.4'x2.6'.

Kit 71. Dual Electronic Dice PIC16C54

The code in Kit 69 is extended to roll two dice. PCB size 1.4'x2.6'.

July 30, 2003. Tony Nixon / Bubblesoft Software has closed his website. But his pdf and asm files for his Introduction to PICs and My Next PIC Projects can all be found here. 1.15MB.

Design For DIY Programmer Hardware Tester - A working ICSP arrangement for DIY USB PIC Programmers

Notice that the schotty diode allows the DIY Programmer to feed its VCC without its VCC being shorted to the PIC's normal power supply. A tiny DIP switch will also work in place of the diode. NOTE: the diode is very convenient when developing the code, but it drops about 100mV of the VCC provided (but was never an issue in my designs. Simply do NOT power the PIC while programming it.

The 27K is recommended to prevent VPP current from raising VCC. It can even be larger than this. You can use as low as 10K if a diode is placed in series at the MCLR pin, so that when VPP is applied nothing can conduct. But its a needless waste to have that second diode.

Pic Serial Programmer Job

The reason for this schematic is to clarify how ICSP is driven by a DIY programmer.

The PIC programmer itself is designed to provide only enough VPP and VDD to program the device, nothing else. With the schottky diode, the VDD load of the product itself is ignored by the programmer while programming. The cap across the chip is very important, and can be as low as 0.01uF and as high as 0.1uF - but it can't be higher, otherwise the rise time needed to enter programming mode cannot be achieved.

The other reason is the way PICs must enter programming mode. Some need to have VCC applied first, while others need to have VPP applied first. That two-step process, together with PGD and PGC at gnd, causes the PIC to enter programming mode.

Design For DIY Programmer Hardware Tester


This pdf shows diagrams for testing all of DIY's PIC Programmers. User instructions are enclosed. Clearly, if NONE of the leds wink, there is a communication problem to the programmer, USB drivers, cable etc, although the internal PIC chip could also be inserted backwards or be otherwise defective.

RS232 Communication with PIC Microcontroller

Description

This article shows how to do a simple communication via a RS232 interface with a PICmicrocontroller. RS232 is a standard for a serial communication interface which allowsto send and receive data via at least three wires. With the RS232 interface it is possibleto setup a connection between a microcontroller and a PC (via PC's COM port) or betweentwo microcontrollers.

The RS232 interface can be used for many purposes like sending commands from a PC to amicrocontroller, send debug information from a micontroller to a terminal, downloadnew firmware to the microcontroller and many other things.

In this tutorial I will show how to link a PIC microcontroller to a standard PC.On the PC we will use a termial program to send and receive data. Data sent bythe microcontroller will be shown in the terminal window and any key pressed insidethe terminal will send the corresponding key code to the microcontroller.We will use this simple configuration to test and understand the RS232 communication.

Note that modern PCs don't have a serial port so you need to get a USB to serial converter.They are available at low cost.

Block Diagram

The following block diagram shows the whole setup:

For serial communication the line used to transmit data is called TX and the line used toreceive data is called RX. The level converter is required to translate the voltage levelof the microntroller to RS232 voltage level. The microntroller operates at TTL level(0V = logic 0, +5V logic 1) whereas RS232 uses around +/-12V. A very famous RS232 levelconverter is the MAX232 chip.

Hardware

In the schematic below a PIC microcontroller is connected to the RS232 level converter chip.A PIC18F2620 micocontroller is used, but it will also work with any other microcontrollerwhich has a built-in UART.

Schematic

The PIC is running at 10MHz. This will be important later when we configure the baudratefor the serial communication.

Ther RS232 level converter uses the famous MAX232 chip, but any other MAX232 compatible chipwill also work. It just requires 4 capacitors to do its job. These external capacitors arerequired for the charge pump inside the chip which generates the required voltage levels.

The connections on the DB9 connector between pins 1,4,6 and 7,8 are required to satisfythe RS232 hardware handshake signals which we will not use here.

I have developed a RS232 modulewhich allows direct connection to the microcontroller.It consists of a DB9 Female connector, a MAX232 compatible RS232 level converter and thecapacitors. You can find the RS232 module here.

RS232 Cable

To connect the above circuit to the PC we need a RS232 cable. The below picture showsthe necessary connections.

Hardware Picture

Below a picture of the hardware setup. As you can see I have used myPIC16F/18F Experiment Boardand myRS232 Module.

Software

Microchip Pic Programmer

Now since the hardware is ready we have to write the software for the PIC microcontroller.The different compiler vendors provide different ways to setup the UART in the PIC. So I willshow how to use the UART for different compilers.

RS232 communication with CCS C compiler

The CCS C compiler provides a very simple way to do serial communication via RS232. It hidesall the register settings for the user. Only the some parameters have to be provided, therest is done by the compiler. By the way, the CCS C compiler also allows to do RS232 communication viageneral I/O pins, i.e. software based RS232 communication instead of using the built-in UART.That is a really great feature of the CCS C compiler.

Here the code lines which are required to setup the UART for RS232 communication.

As you can see, it is very simple!

The #use delay directive provides the compiler with the information about the clockfrequency at which the PIC is running. We run the PIC at 10MHz with the 4X PLL fuseenabled, hence it is running at 40MHz, so we have to set clock=40000000.

The #use rs232 directive provides the compiler the information about the RS232parameters which shall be used for the communication. It is more or less self explaining:

  • baud=57600: specifies the baud rate for communication, we will use 57600 baud
  • parity=: specifies whether a parity bit shall be used or not, we will not use it, hence we disable it
  • xmit=PIN_C6: specifies the pin to be used for transmission, since we want to use the built-in UART we have to use pin RC6
  • rcv=PIN_C7: specifies the pin to be used for receiption, since we want to use the built-in UART we have to use pin RC7
  • bits=8: specifies the number of bits per transmitted data

To transmit data the following functions can be used:

To receive data the following functions can be used:

Here a simple demo program for the CCS C compiler.Project download link.To run the demo, the HEX file needs to be flashed into the PIC, e.g. withPICPgm Programmer.

RS232 communication with HI-TECH C compiler

To be done ...

PC connection

Now, since we have the required hardware and firmware, we can connect the hardwareto the PC.

Pic Serial Programmer Resume

To be able to see the data transmitted from the Microcontroller and to send datato the Microcontroller we have to run a terminal program on the PC. There are a lotof terminal programs available. I will show here how to use HyperTerminal whichis included in Microsoft Windows.

HyperTerminal Setup

If you are using Windows XP start HyperTerminal.You can find it in the Communication Folder: Start Menu->All Programs->Accessories->Communication.

On startup it will ask for a connection name. Just enter a text which will identifythe connection, e.g. use 'RS232 Demo'. In the next dialog select the COM port where thePIC is connected to.

In the following dialog we have to set the connection properties. Needless to say, the propertieshave to match the settings we are using in the PIC.

Once this is done, just reset the PIC and the demo output shal be visible.

Download

Pic Serial Programmer Operator

  • Demo project (CCS Compiler): rs232demo_ccs.zip

Pic Serial Programmer Download