Monthly Archives: November 2008

Just built a JDM style PIC (16f628a) programmer

*edit.  turns out I may have been using the wrong resistor which explains why the original schematic wasn’t working for me.  Looks like I used 15k instead of 1.5k.  So if your trying to use the JDM programmer, you can probably use the original schematic as is.

‘m pretty excited as I just got a home made JDM style PIC programmer working about 15 minutes ago.  I’m pretty new to electronics: I had an electronics project kit when I was about 8, and maybe 6 years ago I played with rs232 a little (making a loopback device and a simple 1 pin breakout box was the pinnacle I reached).  This programmer is really my 1st project.

The schematic I used is which comes from  I tried another schematic (newpic3) but it failed to work.  However the schematic I ended up using also did not work as-is so maybe the original design would have worked with the modification I ended up using.

I didn’t have any rs232 serial cables laying around when I started building the programmer, and apparently usb convertors tend not to work using a JDM style programmer so I had to purchase one.  I did not do particularly well at this and ended up buying a null modem cable by mistake.  I ended up building a small breakout box for rs232 lighting up leds for each db9 pin I was using in the programmer.  Soldering jumper wires to the db9 plug was really painful.  What I failed to realize is that I needed to solder both the wire and the cup (the little holder thingy for the wire connecting each pin) at the same time.  I had bought a “helping hands” tool from dick smiths to help with my soldering and only when I made a repair when one of the wires come unstuck did I realize that I could make the tool hold the wire and the db9 plug at the same time.

Anyway, I built the breakout box and started measuring voltages since only 1 pin was showing activity.  I realized that since I was getting activity on pins that should only be activated by the DCE (comms equipment) that I bought the wrong cable.

I bought a ton of stuff for this project actually.. multimeter, breadboard, components, soldering tools, pliers, alligator clips..

I made 2 modifications to the schematic I gave earlier.. I made rb4 connect to vss instead of vdd.  There is some people on the net who talk about this modification, and also on the webpage describing the jdm programmer it talks about doing it for the 16f627 which is apparently very similar to the 16f628(a).  I haven’t actually tested without this modification, so maybe its not necessary.  Something i’ll try tomorrow perhaps.

The second modification I did was removing R2.  I kept reading low voltages for rb7, and I had read that R2 wasn’t strictly necessary as a limiting resistor since rs232 limits current draw.  Once I removed R2, it worked!  I was extremely happy with this result especially since I know next to nothing about electronics – there was certainly quite a bit of luck involved.

To test the voltages I used ic-prog which enables you to test key voltages in the pic such as mclr, clock, data etc.  ic-prog works on vista providing you use the driver and enable it in the ic-prog options – this also fixes the ‘priveledged instruction’ error you might get when it starts up.  Another software programmer I tried using was winpic.

The way I checked that the programmer works was by modifying some of the code or data with the supplied hex editor, then programming it (via the software programmer).  It (the software programmer) automatically verifies that its worked by reading the code+data stored on the pic and comparing the results.

I haven’t actually written a real program as yet, or got a board to test it.  I need to buy a 5v voltage regulator, and a battery pack, and I might need another breadboard as I’m using the boards I have currently (with the programmer and a rs232 breakout box).  I am sure to attempt to use a vero board to make a more permanent programmer in the future.  This is something I am looking forward too.

I should also mention that the 22uF capacitor, C3, is a tantalum capacitor.  I read in some posts elsewhere that this was the right type of capacitor.  The other capacitor I used is an electrolyte type.  I also couldn’t find a BC547B transistor on the rack at dick smiths, even though it is in the online catalogue..  I used a PN2222A instead and found a datasheet on the net with the pin layoyut – which is reverse to that of the BC547B.

Ruxcon is on in less than 2 weeks.. I still haven’t finished my slides, and the code I’m releasing, I haven’t touched in about 2 months.  I guess I get carried away with whatever I find interesting at the time.. In recent times its been electronics.