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.

PICkit 2 Help

Status
Not open for further replies.

Gareth123

New Member
I am using a number of Microchip PICs for some Model Railway projects. Currently I am using a QL200 Dev board for programing. I have had some problems recently when programming PIC12F629s in that they don't do what they are supposed to do. I have programmed the 629s for other projects to test the the QL200 and also the chip itself succesfully but they don't seem to work on the railway projects. I am sure that the hex programs supplied are correct if only from the feedback from the web sites from where I have got the designs.
Many replies have said that I should use a Microchip PICkit 2 for programming and I have now picked one up from a local charity shop but I think it is not complete. It consist of just a plastic case with a push switch, three lights marked Power, Target, Busy and a usb connection and a in-circuit connection (6 female)
Am I right in thinking that there should be a pcb with a socket/s for the various chips. Does anybody have a circuit design for such a board? Most, if not all of the circuits I use require a preprogrammed chip rather than programming in situ.
 
I just use those cheapy perf boards, add a chip socket and run jumper wires to a connection that will fit the pick, usually the MCLR, V+, GND, CLOCK AND DATA pins, debugging will be a whole nother matter.
 
Hi,

The PK2 was considered one of the best diy programmers ever, but its now been replaced by the Pk3 which by comparison was initially a dog.

Microchip have officially stopped updating the Pk2 Device table and have removed a lot of sales references to the Pk2.

If you see this link it shows where all the Pk2 files are now placed, worth downloading copies for backup.
Your should be running the Pk2 with its program version PK2v023200.hex
There are also references to extra chip additions to the device table made by users.
Notice that you also have a standalone program called V2.61 to allow stand alone programming and also run the extra features like Usart Tool and Logic Analyzer.

https://www.microchip.com/forums/m775322.aspx

This is a nice little programming board with zif sockets, though you will find it easier to make a simple connection lead as the pk2 does not readily / securely plug straight in to the connection points, a little design flaw.
**broken link removed**

Not sure why you are having problems with certain railway programs and not others ?
Do you have a link to the program code/project you are talking about - do a bit of diy dcc myself.
 
That programming adapter from Sure Electronics is nice, I have one. Never understood why it has the plastic cover on the top? Just gets in the way of the levers on the ZIF sockets so I've removed it.
 
.
 
Last edited:
Thanks for all the feedback. I think I will build the adaptor on a breadboard first as I bought the PICkit2 as is so I don't know if it works until I try it. The power light comes on when I plug the USB cable in so I am very optomistic.

Hi Wp100

https://usuaris.tinet.cat/fmco/home_en.htm & https://www.dccdiy.org.uk/

These are the two sites where I have had problems with the 12F629 chips. With the first site (fmco or POWS) I have built the complete system and after a few problems making the PCBs, it works a treat. I built the accessory decoder (16F84) and it also works fine but the function decoders using the 12F629 are the problem. I am sure that it is something that I have done that is the problem as so many people have commented on how well they work.

As regards the second site I have not been able to get any of these units to work. I purchased a second simple programmer just to prove my QL200 board and I still had the same result, not working. I can program the 12f629 chips ok for other projects, just not DCC projects which makes me think that there is some problem with my DCC Control Station etc. A problem with the function decoders is that, so I am told, there is not enough load to generate an ACK signal so the CV values can't be read back.

I have now purchased a commercial system (Digitrax) so I will experiment with that system to see if the decoders will work on that. Obviously I will also try the PICkit 2 on these chips.

Again thanks for the feedback.
 
Hi,

Have seen those sites though never built any from them.
Built the command station for the young ones from this site, though not sure about his decoders.
http://dcctrains.netne.net/Command Station1Eng.html
The cost here for loco decoders; its just not worth building one as they are all smd and so small.

Have not used the 12f629 chip but one thing mentioned on the site and in the Datasheet Osc section is about saving the osc calibration value before you program those chips.
Not sure, but think if its not there, ie you overwrite it by mistake when programming, it may affect how the chip runs when using the internal osc.

Also be wary of poor connection from breadboards, they say they are only good for up to 1Mhz at best and a crystals signal with its fine leads can easily be lost.
Same when programming a chip on a breadboard, plus keep the cable from the pK2 to the chip as short as possible, say 150mm maximum, otherwise you can get strange problems.
 
Gareth:
If you haven't initialised all the variables properly you can have odd behaviour. I always clear all the GPR in the bootup code with a routine to write to all available GPR.
It's possible that 'noise' on the power lines to the 16F629 is causing it to reset. That will make it appear unstable. Try running the PIC off a battery supply that is isolated from the train's PSU/ gnd and ensure a 0.1uf cap is CLOSE to the PIC Vdd/Vss pins.
Ensure that the PIC 5V supply has enough 'headroom' and the train loads aren't pulling your unregulated supply down, close to 7 V.
Also, if your are using PCL lookup tables for anything, make sure that you lookup value cannot exceed the table data length or you can get weird results with the code hopping about. Lastly, PCL lookup tables should start at the beginning of a 256 byte page and not exceed it in length. This can be circumvented but you need to have a good understanding of PCLATH to do it.
 
I have just built the adaptor board as suggestd by Geko and I have programmed two 629's successfully so there is something wrong somewhere else. I know not where because my QL200 board works fine on other projects. I couldn't believe it when I powered up the model railway decoder project with the 629's and the leds operated correctly. The leds are just running lights that change depending the direction of the loco but it give me some confidence to go to the next stage which will be to include interior lights for some passenger coaches.
What I must do though is to order a zero socket as I have a number of chips with broken pins. Unfortunately here in SA we are somewhat restricted in the number of places where we can buy components and prices tend to be high. I have bought a lot of items from China via ebay but the 629s I ordered must have been rejects as the pins broke off just looking at them so I have to find some way to "repair" them. The main reason for building, or trying to, the decoders is cost as I need 10+ for coach lighting and running lights. Although just powering the lighting leds, commercial decoders are 14-18 pounds apiece which makes it a bit expensive. DIY are 50-75% of that cost.

Hi Mosaic

I have to say that I am not and never will be a programmer. I rely totally on the project provider providing the hex file but I take your point about noise etc. The temporary decoder that I used today for the two "working" 629,s was built on a piece of Vero board and I did not take into consideration the size and layout of the board. A permanent board will be much smaller. The suggested battery supply wouldn't work on the new digital systems as the signal is a "form of AC" with the commands superimposed and is fed into/onto the track including power for the motor. Each loco is fitted with a decoder which determines the speed and direction of the loco. There are usually a couple of additional outputs for lights on the loco but in my case I want to put lights in the coaches which need what are called Function decoders which generally are used just to switch lights etc ie low power. This requires a decoder in each coach plus means of picking up the signal from the track. With larger layouts it is not uncommon to have multple power unts (boosters) around the layout, one of which has the controls mounted, the remainder providing additional power. The additional boosters are still connected to the main control unit to pickup the various control signals.

Once again thanks for all of the Help and advice. I now have a working PICkit 2 unit that works. Plus I also have two 12F629s that have been programmed correctly and work on a test rig. Incidently I am just running the PICkit2 v2.6 software as stand alone as it meets all of my needs. I doubt that I would need a complier as I rely on the hex file being provided.
 
AC signal on DC supply. I guess the DC is unregulated for that to work. I like trains myself. How many are you running on the track?
 
Hi,

Good to hear you have got things working ok.

Little tip to avoid damaging the pics pins when removing them for programming etc, place the chip in an extra ic socket, then place the ic in its extra socket in to either the circuit boards socket or the programmer socket, ie double heading, this way the extra ic socket takes all the wear and tear, not the pic chip.
Usually get better contact using the turned pin sockets if available.
 
AC signal on DC supply. I guess the DC is unregulated for that to work. I like trains myself. How many are you running on the track?

Hi,

Its still dc, just pulsed signals superimposed https://www.dccwiki.com/DCC_Power

Loads more details on the web if interested**broken link removed**

The controller I build from that link shown earlier does 4 locos but like many electronic projects they are getting overtaken by lower cost modern commercial units, this latest unit from Hornby runs up to 10 locos from your PC/ laptop ; some units allow you to run the locos via an app on your moby ! - try doing all that with a Pic chip !!
https://www.hornby.com/hornby-dcc/hornby-railmaster/
 
Just a final message. I have just "built" another decoder on a breadboard etc using a PIC16F628 and the PICkit 2 and it worked 100%. So my QL200 and other boards are going into the cupboard for now.

Incidently my original DIY control system (POWS) can control upto 16 locos simultaeneously plus signalling, points etc. All this takes power so the size of the booster would be the limiting factor.

Regards

Gareth
 
Status
Not open for further replies.

Latest threads

Back
Top