Fighting a 12F675...

Thread Starter

Dodgy Geezer

Joined Nov 30, 2009
177
I have been able to cut some simple code for a PIC, though I am still a rank beginner.

From another forum I was provided with some hex for a project which I needed to write to a 12F675. I have a Vellerman 8048 programmer; I was using the Vellerman ProgPic2 code, and worked out that I needed to 'load' the hex file and then write it. XP is the OS.

My first attempts didn't work - incompatible serial port, and I'm not sure that I copied the hex correctly - but then I found an old laptop that seemed to recognise the programmer. I think I wrote the hex to a pic, but when I tried to read that pic the programmer board would not recognise that there was a pic onboard. I could recognise an unwritten pic in my programmer, but whatever I had done to the first one seemed to have left it uncontactable.

I think I was able to erase it using WinPIC, but this didn't get it recognised again. Have I ruined it somehow, or can someone suggest a way to talk to it again?
 

Thread Starter

Dodgy Geezer

Joined Nov 30, 2009
177
Hex file is from here: http://www.giantcod.co.uk/forum/viewtopic.php?f=15&t=3050

Interesting project! I have done a bit of research, and found some people saying that the Velleman 8048 programmer has a bit of a bug, and won't recognise or erase Pic 12F675s if they are coded with a program that holds one output high.. Unfortunately, that data was hard to find - I bookmarked it meaning to study it at length, and then my system went down and I lost the reference - haven't found it again yet...
 

Thread Starter

Dodgy Geezer

Joined Nov 30, 2009
177
Unfortunately, I am working with an 8048!

I know the 8048 works - I have written pics with it in the past, but I have never tried to take a hex file and write that. I am having all sorts of basic problems - for instance, the hex is given in lines of 24bytes, each starting with a : Look at the reference to see what I mean.

Now, do I just copy/paste this to a notepad file and give it a .hex extension? I assumed not, and took all the colons out, as well as the line throws. Then I saved it as an ANSI file with a .hex extension, and tried to load it - progpic2 said it was the wrong file format.

I tried saving in a variety of formats, and found one that the programmer would accept, but then it complained there was no eof! There does not seem to be any simple tutorial on the web about using hex - all beginner stuff assumes you are writing your own code...
 

eblc1388

Joined Nov 28, 2008
1,542
I could recognise an unwritten pic in my programmer, but whatever I had done to the first one seemed to have left it uncontactable.
The HEX code you tried to load to the PIC had enabled the PIC internal oscillator, as mentioned in the notes by the author.

What you have done is enabled the PIC internal oscillator so as soon as the PIC is powered up(even inside your Velleman programmer), it will start to execute the code inside and so will not enter program mode. Therefore the programmer cannot contact the PIC again.

Some other programmers can still contact the PIC under this situation but I doubt if the Velleman can.

Any Velleman user can confirm?
 

Markd77

Joined Sep 7, 2009
2,806
I'd assume that you should just rename the file .hex
This is a bit of a .HEX file straight from MPLAB:
:020000040000FA
:020000002D28A9
:040002000034003492
:08000800A900030EAA00240860
:100010002202031D102823082102031D10280515A4
:100020002308031D1B282403031D1B282108A300EC
:100030002208A40022280130A40203182228230346

On a side note, I just got some 12F675s and plan to use them with the internal oscillator. Can the PICKIT2 reprogram them once they are programmed that way? I use a ZIF for programming because I'm paranoid about letting the smoke out of the PICKIT2 if I connect something up wrong using ICP.
 

Thread Starter

Dodgy Geezer

Joined Nov 30, 2009
177
Well, I didn't find the 8048 bug discussion, but I recalled enough of it to remember that some people suggested holding the base of one transistor (T4) low by shorting out a diode (D7).This seemed to work - the pic was recognisable again. Some people have soldered a line in to do this at will, or added a little resistor/capacitor pair to enable VPP before VDD...

Anyway - I wrote something to the pic which looks like the original hex. I had woried that I might have overwritten the internal oscillator calibration - indeed, perhaps I have. Is there any way I can check this easily?
 

Thread Starter

Dodgy Geezer

Joined Nov 30, 2009
177
Thanks, Markd77 - your illustration does look exactly like the file I had. I renamed it as you said, and the file wrote and validated fine. I think I ran into this 'no VPP before VDD' issue (which BlueRoomElectronics accurately said the 8048 did not support), but which can be got round by temporarily jumping out D7.

I can't test the code until the muxes arrive, but I did try running a little flashing led prog using the internal oscillator, and it ran - so I presume my calibration is still ok... Panic over....
 

thatoneguy

Joined Feb 19, 2009
6,359
The PicKit 2 is amazingly robust if you stay within the recommended voltage ranges, and use the recommended ICSP layout.

Itcan also read and set the calibration value in PICs, and there are some programs around which work with the PicKit 2 that will re-calculate the cal value if it is lost.

Due to the extra features, such as "load and go" (program without a computer), logic probe + serial debugger (connected to a computer), the PicKit 2 is an awesome value for the money!
 

vane

Joined Feb 28, 2007
189
I think i have had the same problem can you just talk me through how to do it? i tried shorting out D7 but did nothing, maybe i did it wrong...

I couldn't bring myself to throw these chips away, there must be something i can do :s I better not have rendered 2 out of 4 of my 675s crap :(
 
For 8-bit PICs I've also had good luck with a PicKit1 development board, which is $36 compared to 50 for a PicKit2. With a spare 14 pin socket and some flat cable and a 5 pin header I made it into an in-circuit programmer, as well. Just wire up the header in the same order as the PicKit2 for compatibility.

And, yes it works with rewriting chips using internal oscillator mode just fine, for both a 12F675 and a 12F684, at least.

PicKit1:
http://www.microchipdirect.com/productsearch.aspx?Keywords=DV164101

PicKit2:
http://www.microchipdirect.com/productsearch.aspx?Keywords=DV164121
 

t06afre

Joined May 11, 2009
5,934
Vane do not get the pickit 1. Get at least the pickit 2. You can buy the pickit 2 programmer separate. If you are on budget this device is the best value for money.
 

vane

Joined Feb 28, 2007
189
The 12f675 is on the K8048 aswell but i can't use my chips because they have MCLR set as an output, which means the K8048 does not put it into program mode, it automatically goes into cycle mode and runs the program, so the pickit2 would remedy this? I might wet the solder joints on the board incase that is the problem. I am running it off of a 12v supply yet i have heard to put it into program mode it has to be 13.5v+

I can't believe Microchip could make such a big cock up with the 8 pin PICs
 

Markd77

Joined Sep 7, 2009
2,806
I'm using a PICKIT2 (clone) with the 12F675 and can confirm it can write and rewrite them fine.
I think the problem is more with Velleman than Microchip although Microchip do often seem to make things more complicated than necessary. It took me a while the other day to work out that some of the eeprom registers are in different banks on different PICs. That makes no sense to me.
 
Top