Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

PIC programmer & WinPicProg: my findings

Status
Not open for further replies.

eblc1388

Active Member
Hi everybody.

The recent activities in this forum about PIC programmer has caused a lot of interest on the hardware issues surrounding the construction of a PIC programmer.

So I have decided to "take the matter" into my own hand and do some experiments. There are several issues at hand which I'm going to prove or disprove one way or the other.

1. Programming voltage. Some say it should be a lot higher than +12V but I maintained that +12V would work, at least on 16F628A. So I'm going to use +12V.

2. Cable from computer to programmer. Some insist that short shielded cable be used. I'm of opinion that if a printer can work properly, the programmer should work too. The cables I'm using are two cheap ones, each 1.5M in length, with a switchbox in between as I always use the parallel port for both printer and hardware programming.

3. Length of wire from programmer to PIC. It was mentioned that 15cm of unshielded wire would cause error. I decided to try 100cm, with the thought of cutting it back until there is no more verify errors.

4. The software WinPicProg, reported by an user which failed to program/verify a 16F628 when the HEX file does not have "fill up" bytes for empty locations between memory address 0002 and 0007.

So the above was my quest and I set to work this morning.

The programmer was built around a 7407 TTL and two PNP transistors. The +12V is switch via one PNP transistor to acts as the Vpp for the PIC. It is just a typical parallel port programmer. It took arounds 30 minutes to build including soldering the wires on the 25-pin socket for the parallel cable.

I have no non-A version of 16F628 so I used a 16F628A and downloaded the beta version of WinPicProg from Nigel's site to program it.

The next step was setting up the WinPicProg software so that the correct port signal controls the correct programmer function. With that done, the software found my programmer and all the features on the main menu are enabled.

The first file I tried is the same HEX file that user gregmcc have had troubles with. I was expecting WinPicProg giving me a verfiy error but there isn't any.

The HEX file loads fine, the data displays correctly and programmed/verified correctly. This was shown in the image "winpicprog.jpg". So Nigel's software is definitely working fine without any question or doubt. Any previous allegation that it chocks on HEX file with "gaps" is now proven wrong. It works perfectly in two more erase/program trials.

OK that's the software issues sorted out. It also proved that +12V has no problem programming the PIC 16F628A.

Next on the list is length of connecting wires. I replace the short connecting wires with five 100cm ones as shown as bottom part of the image "wiring_.jpg". Frankly I was expecting verify error to come up. As the previous content of the HEX file is still inside WinPicProg, I did a Verify operation. NO error, verify sucessful. I even proofread each word using cut and paste on two data section to compare them side by side. I then did a erase and programming sequence and the result was also perfect.

There you go. I'm only saying long wires work in my case as many other people would swear on their XXXXX that it wasn't in their real life experience. Don't flame me. This is just what I found out by experiment.

I must stress that in real life situation anyone would be better off with as short the length of wire as possible but a few centimeters is definitely not going to cause a lot of troubles. Don't blame the wires until you have exhausted all other possibilities.
 

Attachments

  • winpicprog_1.gif
    winpicprog_1.gif
    41.8 KB · Views: 1,291
  • wiring_.jpg
    wiring_.jpg
    250.7 KB · Views: 1,652
  • winpicprog.gif
    winpicprog.gif
    37.9 KB · Views: 1,407
A scholarly appraisal!.

Personally I've never had any problems with wire lengths, mine is also connected to the parallel port via a switch box, but with two 2m long leads (so 4m in total, plus a cheap, handwired, switch box). I've no idea if they are screened or not? (they have moulded plugs), but I've had them for years.

As I use a P16PRO40, the target PIC sits in the ZIF socket, so those leads are extremely short.

However, while I've had no problems, I have had a number of support contacts from people who have had problems, usually when trying to do ICSP using longish leads from the programmer to the board. One solution which can help is to use lower value pull-up resistors, but it's advisable to keep the leads as short as possible if you can.

As for the 12V Vpp, it all goes back to the 16C84, the spec called for 12V, but this was sometimes found to be marginal, and it was found that increasing it to 13V helped to reduce any problems. It's since stayed like that mainly for historical reasons - the older chips also drew a reasonable current in the Vpp pin, newer chips don't.
 
Thanks for doing that, but to me the conclusion sounds like : "it *can* work that way", and not "it *will* work that way".

It reminds me of a quality assurance guy that would go to a software developer to tell him there's a bug in his code. The developer will almost always reply "well, it works on my machine!".

In the case of gregmcc, it could be a software problem, but not directly related to WinPicProg.exe

Often, someone using development tools on his PC will end up with debug versions of various standard Windows DLLs. These DLLs are stripped of debugging information on a typical end-user Windows installation. Not to mention, they might not be the same version at all...

It seems like WinPicProg was especially well designed, as to depend on very few of external DLLs, and that's why it can be distributed as a standalone EXE without extraneous DLLs or any installation program overhead.

Visual Studio's "depends" tool list the following as WinPicProg dependencies :
ADVAPI32.DLL
COMCTL32.DLL
COMDLG32.DLL
DLPORTIO.DLL
GDI32.DLL
KERNEL32.DLL
MSVCRT.DLL
NTDLL.DLL
OLE32.DLL
OLEAUT32.DLL
RPCRT4.DLL
SHELL32.DLL
SHLWAPI.DLL
USER32.DLL
WINMM.DLL
WINSPOOL.DRV

This is all standard on a Windows system, except dor DLPORTIO.DLL which is needed on NT/2000/XP machines to enable port access.

MSVCRT.DLL is well known for causing weird problems. Depending on the version installed on your system, it can break some software. Maybe it is at fault here.

But it could be anything else, of course...
 
With regard to Nigel and I had experienced, the parallel port programmer is not critical about cabling at all. So if anyone is planning to build one and is put off by reading the postings here, please go ahead and build one.

Joel Rainville said:
Thanks for doing that, but to me the conclusion sounds like : "it *can* work that way", and not "it *will* work that way".

Sure. It was not meant to be a recommendation to anyone.

My conclusion is wire length is important to be as short as practicable. If you find a extremely short wire making a difference between verify OK/failure, then maybe there are some other problems causing that sensitivity. The short wire is then a cure and not the cause.

If you looks closely, you will also notice the two capacitors I placed across the 16F628A. Maybe that make a big difference in the operation of the programmer.

I also hope that people wishing to learn PIC think about what to build as their first programmer. The parallel port programmer is a very reliable design and very easy to get right, using just a voltmeter and the hardware setup menu inside the WinPicProg software. There is no element of luck involve in building one. It requires a separate power supply but then everything needs one.

Regarding the Vpp voltage Nigel had mentioned, my opinion is that +12.5V to a maximum of +13V is a good all around choice.
 
eblc1388 said:
I also hope that people wishing to learn PIC think about what to build as their first programmer.

Absolutely, amen to that!

Maybe this thread deserves a spot in the F.A.Q. sticky at the top of this forum? At least eblc1388's first post. What do you think Jay?
 
The VPP voltage specification is located in the Programming Specification document for a particular device or group of devices... I've found that 12.0 volts seems to cover a broad range of target devices... I've also found that you can exceed the specified voltage (plus or minus) for a particular device and still place it into high voltage program/verify mode but I certainly wouldn't recommend it...

The VPP voltage specifications (for VDD=5v) for a subset of PIC devices are shown at the right in the listing below and also indicates if "VDD first" or "VPP first" method is required to place the device into high voltage program/verify mode...

Regards, Mike

Code:
;******************************************************************
;
;  18F Device Table
;
;  <ID2> <ID1> <"name"> <param1> <param2>, 8 bytes per device
;
;  PARAM1 = B EE WWWW F  (B = bulk erase algorithm, 0 or 1)
;                        (E = erase buffer size, 20h or 40h)
;                        (W = write buffer size, 08h, 20h, or 40h)
;                        (F = flash memory size b16)
;
;  PARAM2 = FFFF EEEE    (F = flash mem size b15..b12) 
;                        (E = eeprom mem size b11..b8)
;

	org	h'0C00'

ID8TBL  dt   0x04,0x80, "242 ", 0x42,0x41	;18F242    9.0-13.25 VDD
        dt	0x08,0x00, "248 ", 0x42,0x41	;18F248    9.0-13.25 VDD
        dt	0x04,0x00, "252 ", 0x42,0x81	;18F252    9.0-13.25 VDD
        dt	0x08,0x40, "258 ", 0x42,0x81	;18F258    9.0-13.25 VDD
        dt	0x04,0xA0, "442 ", 0x42,0x41	;18F442    9.0-13.25 VDD
        dt	0x08,0x20, "448 ", 0x42,0x41	;18F448    9.0-13.25 VDD
        dt	0x04,0x20, "452 ", 0x42,0x81	;18F452    9.0-13.25 VDD
        dt	0x08,0x60, "458 ", 0x42,0x81	;18F458    9.0-13.25 VDD

        dt	0x07,0xE0, "1220", 0x42,0x11	;18F1220   9.0-13.25 VDD
        dt	0x05,0x80, "2220", 0x42,0x11	;18F2220   9.0-13.25 VDD
        dt	0x05,0xA0, "4220", 0x42,0x11	;18F4220   9.0-13.25 VDD
        dt	0x07,0xC0, "1320", 0x42,0x21	;18F1320   9.0-13.25 VDD
        dt	0x05,0x00, "2320", 0x42,0x21	;18F2320   9.0-13.25 VDD
        dt	0x05,0x20, "4320", 0x42,0x21	;18F4320   9.0-13.25 VDD

        dt	0x08,0xE0, "2331", 0x42,0x21	;18F2331   9.0-13.25 VDD
        dt	0x08,0xC0, "2431", 0x42,0x41	;18F2431   9.0-13.25 VDD
        dt	0x08,0xA0, "4331", 0x42,0x21	;18F4331   9.0-13.25 VDD
        dt	0x08,0x80, "4431", 0x42,0x41	;18F4431   9.0-13.25 VDD

        dt	0x21,0x60, "2221", 0xC2,0x11	;18F2221   9.0-12.5  VDD (e)
        dt	0x21,0x20, "2321", 0xC2,0x11	;18F2321   9.0-12.5  VDD (e)
        dt	0x11,0x60, "2410", 0xC8,0x40	;18F2410   9.0-12.5  VDD (e)
        dt	0x11,0x40, "2420", 0xC8,0x41	;18F2420   9.0-12.5  VDD (e)
        dt	0x24,0x20, "2450", 0xC8,0x40	;18F2450   9.0-12.5  VDD (f) check
        dt	0x0B,0xA0, "2455", 0xC8,0x61	;18F2455   9.0-12.5  VDD
        dt	0x1A,0xE0, "2480", 0xC8,0x41	;18F2480   9.0-12.5  VDD (e)
        dt	0x11,0x20, "2510", 0xC8,0x80	;18F2510   9.0-12.5  VDD (e)
        dt	0x0C,0xE0, "2515", 0xD0,0xC0	;18F2515   9.0-12.5  VDD
        dt	0x11,0x00, "2520", 0xC8,0x81	;18F2520   9.0-12.5  VDD (e)
        dt	0x0C,0xC0, "2525", 0xD0,0xC4	;18F2525   9.0-12.5  VDD
        dt	0x0B,0x60, "2550", 0xC8,0x81	;18F2550   9.0-12.5  VDD
        dt	0x1A,0xC0, "2580", 0xC8,0x81	;18F2580   9.0-12.5  VDD (e)
        dt	0x0E,0xE0, "2585", 0xD0,0xC4	;18F2585   9.0-12.5  VDD
        dt	0x0C,0xA0, "2610", 0xD1,0x00	;18F2610   9.0-12.5  VDD
        dt	0x0C,0x80, "2620", 0xD1,0x04	;18F2620   9.0-12.5  VDD
        dt	0x0E,0xC0, "2680", 0xD1,0x04	;18F2680   9.0-12.5  VDD
        dt	0x21,0x40, "4221", 0xC2,0x41	;18F4221   9.0-12.5  VDD (e)
        dt	0x21,0x00, "4321", 0xC2,0x41	;18F4321   9.0-12.5  VDD (e)
        dt	0x10,0xE0, "4410", 0xC8,0x40	;18F4410   9.0-12.5  VDD (e)
        dt	0x10,0xC0, "4420", 0xC8,0x41	;18F4420   9.0-12.5  VDD (e)
        dt	0x24,0x00, "4450", 0xC8,0x40	;18F4450   9.0-12.5  VDD (f) check
        dt	0x0B,0x80, "4455", 0xC8,0x61	;18F4455   9.0-12.5  VDD
        dt	0x1A,0xA0, "4480", 0xC8,0x41	;18F4480   9.0-12.5  VDD (e)
        dt	0x10,0xA0, "4510", 0xC8,0x80	;18F4510   9.0-12.5  VDD (e)
        dt	0x0C,0x60, "4515", 0xD0,0xC0	;18F4515   9.0-12.5  VDD
        dt	0x10,0x80, "4520", 0xC8,0x81	;18F4520   9.0-12.5  VDD (e)
        dt	0x0C,0x40, "4525", 0xD0,0xC4	;18F4525   9.0-12.5  VDD
        dt	0x0B,0x40, "4550", 0xC8,0x81	;18F4550   9.0-12.5  VDD
        dt	0x1A,0x80, "4580", 0xC8,0x81	;18F4580   9.0-12.5  VDD (e)
        dt	0x0E,0xA0, "4585", 0xD0,0xC4	;18F4585   9.0-12.5  VDD
        dt	0x0C,0x20, "4610", 0xD1,0x00	;18F4610   9.0-12.5  VDD
        dt	0x0C,0x00, "4620", 0xD1,0x04	;18F4620   9.0-12.5  VDD
        dt	0x0E,0x80, "4680", 0xD1,0x04	;18F4680   9.0-12.5  VDD
ID8TOT  equ  ($-ID8TBL)/8

;******************************************************************
;
;  12F/16F Device Table
;
;  <ID2> <ID1> <"name"> <param1> <param2>, 8 bytes per device
;
;  PARAM1 = not defined yet
;
;  PARAM2 = not defined yet
;

	org	h'0E00'

ID6TBL  dt   0x00,0x00, "508 ", 0x0000	;12F508
;       dt	0x00,0x00, "509 ", 0x0000	;12F509
;       dt	0x00,0x00, "510 ", 0x0000	;12F510
        dt	0x0F,0x80, "629 ", 0x0000	;12F629 (*) 8.5-13.5 VPP
        dt	0x0F,0xA0, "635 ", 0x0000	;12F635    10.0-13.0 VPP
        dt	0x0F,0xC0, "675 ", 0x0000	;12F675 (*) 8.5-13.5 VPP
        dt	0x04,0x60, "683 ", 0x0000	;12F683    10.0-13.0 VPP
;
;       dt	0x00,0x00, "505 ", 0x0000	;16F505
;       dt	0x00,0x00, "506 ", 0x0000	;16F506 future?
;       dt	0x00,0x00, "54  ", 0x0000	;16F54  ID 12.5-13.5 VDD
;       dt	0x00,0x00, "57  ", 0x0000	;16F57  ID 12.5-13.5 VDD
;       dt	0x00,0x00, "59  ", 0x0000	;16F59  ID 12.5-13.5 VDD
        dt	0x07,0xA0, "627 ", 0x0000	;16F627     8.5-13.5 VDD
        dt	0x10,0x40, "627A", 0x0000	;16F627A   10.0-13.5 VPP
        dt	0x07,0xC0, "628 ", 0x0000	;16F628     8.5-13.5 VDD
        dt	0x10,0x60, "628A", 0x0000	;16F628A   10.0-13.5 VPP
        dt	0x10,0xC0, "630 ", 0x0000	;16F630     8.5-13.5 VPP
        dt	0x10,0xA0, "636 ", 0x0000	;16F636    10.0-13.0 VPP
;       dt	0x10,0xA0, "639 ", 0x0000	;16F639    10.0-13.0 VPP
        dt	0x11,0x00, "648A", 0x0000	;16F648A   10.0-13.5 VPP
        dt	0x10,0xE0, "676 ", 0x0000	;16F676     8.5-13.5 VPP
        dt	0x10,0x80, "684 ", 0x0000	;16F684    10.0-13.0 VPP
;       dt	0x04,0xA0, "685 ", 0x0000	;16F685    10.0-13.0 VPP
;       dt	0x13,0x20, "687 ", 0x0000	;16F687    10.0-13.0 VPP
        dt	0x11,0x80, "688 ", 0x0000	;16F688    10.0-13.0 VPP
;       dt	0x13,0x40, "689 ", 0x0000	;16F689    10.0-13.0 VPP
;       dt	0x14,0x00, "690 ", 0x0000	;16F690    10.0-13.0 VPP
;       dt	0x11,0x40, "716 ", 0x0000	;16F716    11.0-13.5 VDD
;       dt	0x00,0x00, "72  ", 0x0000	;16F72

;       dt	0x06,0x00, "73  ", 0x0000	;16F73     12.8-13.3 VDD
        dt	0x0B,0xA0, "737 ", 0x0000	;16F737    12.8-13.3 VDD
;       dt	0x06,0x20, "74  ", 0x0000	;16F74     12.8-13.3 VDD
        dt	0x0B,0xE0, "747 ", 0x0000	;16F747    12.8-13.3 VDD
;       dt	0x06,0x40, "76  ", 0x0000	;16F76     12.8-13.3 VDD
        dt	0x0E,0xA0, "767 ", 0x0000	;16F767    12.8-13.3 VDD
;       dt	0x06,0x60, "77  ", 0x0000	;16F77     12.8-13.3 VDD
        dt	0x0D,0xE0, "777 ", 0x0000	;16F777    12.8-13.3 VDD

;       dt	0x12,0x00, "785 ", 0x0000	;16F785    10.0-12.0 VDD/VPP
        dt	0x04,0xC0, "818 ", 0x0000	;16F818     8.5-13.5 VDD
        dt	0x04,0xE0, "819 ", 0x0000	;16F819     8.5-13.5 VDD
        dt	0x05,0x60, "84A ", 0x0000	;16F84A
        dt	0x07,0x20, "87  ", 0x0000	;16F87      8.5-13.5 VDD
        dt	0x0D,0x00, "870 ", 0x0000	;16F870     8.5-13.5 VDD
        dt	0x0D,0x20, "871 ", 0x0000	;16F871     8.5-13.5 VDD
        dt	0x08,0xE0, "872 ", 0x0000	;16F872     8.5-13.5 VDD
        dt	0x09,0x60, "873 ", 0x0000	;16F873     8.5-13.5 VDD
        dt	0x0E,0x40, "873A", 0x0000	;16F873A    8.5-13.5 VDD
        dt	0x09,0x20, "874 ", 0x0000	;16F874     8.5-13.5 VDD
        dt	0x0E,0x60, "874A", 0x0000	;16F874A    8.5-13.5 VDD
        dt	0x09,0xE0, "876 ", 0x0000	;16F876     8.5-13.5 VDD
        dt	0x0E,0x00, "876A", 0x0000	;16F876A    8.5-13.5 VDD
        dt	0x09,0xA0, "877 ", 0x0000	;16F877     8.5-13.5 VDD
        dt	0x0E,0x20, "877A", 0x0000	;16F877A    8.5-13.5 VDD
        dt	0x07,0x60, "88  ", 0x0000	;16F88      8.5-13.5 VDD
;       dt	0x13,0xE0, "913 ", 0x0000	;16F913    10.0-12.0 VDD/VPP
;       dt	0x13,0xC0, "914 ", 0x0000	;16F914    10.0-12.0 VDD/VPP
;       dt	0x13,0xA0, "916 ", 0x0000	;16F916    10.0-12.0 VDD/VPP
;       dt	0x13,0x80, "917 ", 0x0000	;16F917    10.0-12.0 VDD/VPP
ID6TOT  equ  ($-ID6TBL)/8
 
PIC programmer & WinPicProg

i have some problem.PIC programmer & WinPicProgrammer. i want program 16f676 but not fount in windo[16f676].pl suges me the letest ver. PIC programmer & WinPicProg
 
Status
Not open for further replies.

Latest threads

New Articles From Microcontroller Tips

Back
Top