Transfering program to another chip.

This is the place for any magazine-related discussions that don't fit in any of the column discussion boards below.
yusha
Posts: 50
Joined: Fri Jul 14, 2006 2:27 pm
Contact:

Transfering program to another chip.

Post by yusha »

Is it possible to copy a pic16f84 and program another chip.I had a stepper motor controller which has a PIC16f84 chip in it.I must have damaged the output cause it sucks down the 5 volt reg as soon as I plug the chip into socket.This board was working fine until an accident hook up.Now I have an EPIc programmer that I can use to read the hex code on the original chip but I do not know how to save this code and program a new chip.This board was build by a friend who is not available any more so is problem with copyrite,etc.Please help.
Thanks
yusha
Posts: 50
Joined: Fri Jul 14, 2006 2:27 pm
Contact:

Re: Transfering program to another chip.

Post by yusha »

I should have check my post.There is NOT a problem with copyrite.Sorry.
User avatar
Lenp
Posts: 1529
Joined: Thu Oct 26, 2006 8:11 pm
Location: Maryland
Contact:

Re: Transfering program to another chip.

Post by Lenp »

Yusha
This link may help. Many say no but at least one poster says yes!
http://www.edaboard.com/ftopic143246.html
Len
Len

“To invent, you need a good imagination and a big pile of junk.” (T. Edison)
"I must be on the way to success since I already have the junk". (Me)
psycho
Posts: 388
Joined: Thu Jan 10, 2008 8:13 pm
Location: Northwest Indiana
Contact:

Re: Transfering program to another chip.

Post by psycho »

If the chip was not programmed with the protection config bits set, you should be able to read the code (including the config bits - they DO matter) then take the hex file and program it to another chip without any problem.

I am pretty sure the 84 uses ICSP for programming and if it does, you only need to hook up a few wires to your programmer. If you apply 5v and ground (only), does it still pull down the Vcc line??? because you need Vcc & Gnd to program (or read) the chip.

Note that I am going from memory and I could be wrong about ICSP. The 84 (you didn't say it's an 84a) is an obsolete part. I wouldn't even use an 84a in a new design.

Hope it helps,
Kevin
dyarker
Posts: 1917
Joined: Fri Aug 22, 2003 1:01 am
Location: Izmir, Turkiye; from Rochester, NY
Contact:

Re: Transfering program to another chip.

Post by dyarker »

it sucks down the 5 volt reg as soon as I plug the chip into socket
Sounds like you put the IC in the socket while the circuit is powered up. Never do that, its a good way to blow chips.

Have you checked the rest of the circuit? Could be that when another part gets voltage from PIC I/O pin, it turns on and sucks Vcc down (no schematic, so guessing in void). In this case, PIC might be okay; or you'll just blow the next one.

Like Psycho asked, if PIC is blown so bad that with just Vcc, ground, external clock (if used), connected it still pulls down Vcc, then you're not going to be able to read the code out; its gone.

Good luck with this one,
Dale Y
User avatar
MrAl
Posts: 3862
Joined: Fri Jan 11, 2002 1:01 am
Location: NewJersey
Contact:

Re: Transfering program to another chip.

Post by MrAl »

Hi,

When i first read this thread first post, that's what i couldnt help but think too. If the chip is blown electrically then the only way to read the code is via microscopy which isnt very easy to do at all.

How important is this chip and is it possible to do the same thing using a different chip?

How many steps did the stepper motor driver have? I ask because some algo's are not that difficult to do anyway even if you have to start from scratch.
LEDs vs Bulbs, LEDs are winning.
yusha
Posts: 50
Joined: Fri Jul 14, 2006 2:27 pm
Contact:

Re: Transfering program to another chip.

Post by yusha »

Thanks guys,I can read the hex code on the original but dont know how to copy and save it .I am using the Epic programmer.Also when I put in a unprogrammed chip ,the voltage stays stable.So that is what I need help with is copy the hex code and then saving it and reprogramming an other chip.Is it possible to copy a hex code to notepad and then reassembling it?
psycho
Posts: 388
Joined: Thu Jan 10, 2008 8:13 pm
Location: Northwest Indiana
Contact:

Re: Transfering program to another chip.

Post by psycho »

I don't use the same programmer but if you can read the hex data, the software *should* allow you to save it as a hex file. Once you have a hex file (with the config data, too), you just program the new chip with the hex file.

When you write a program for a PIC, the final output of the compiler/assembler is a hex file. So, if you can read the chip and save the hex file, it would be just like you compiled source to produce the hex file.

The config settings are important. They set things such as the oscillator settings, etc.

You are going to have to figure out how to save the data you read from the chip as a hex file - I don't use an epic programmer so I don't know how offhand. However, if you are going to get into PIC's, you might want to invest $35 or so in a PICkit 2 - well worth the money and it is painfully simple to use. It will do what you want to do in seconds... All with a nice GUI - And a debugger, too. You can check it out on http://www.microchip.com/pickit2

And, no. I don't work for Microchip. I have just been around long enough to know that the PicKit2 is worth double what they charge for it.

Hope it helps,
Kevin
User avatar
MrAl
Posts: 3862
Joined: Fri Jan 11, 2002 1:01 am
Location: NewJersey
Contact:

Re: Transfering program to another chip.

Post by MrAl »

Hi again,


Oh ok that's different. We did not realize you could already read the Hex code. That's a good sign and means that somehow some way it will in fact be possible to program another chip.

I use MPLab and that allows you to save and import hex code. If you have hex code saved, you can import it and then program a chip using that hex code and it's as easy as that. With other programmers im afraid you'd have to read the help files. Look for import/export hex code for example.
LEDs vs Bulbs, LEDs are winning.
dyarker
Posts: 1917
Joined: Fri Aug 22, 2003 1:01 am
Location: Izmir, Turkiye; from Rochester, NY
Contact:

Re: Transfering program to another chip.

Post by dyarker »

Good! the PIC isn't completely dead. That brings us back to the rest of the circuit.

If just an I/O pin is bad, than something blew it. Maybe the PIC is okay. Does the programmer allow running the PIC to see if I/O pins change state?

Maybe you can simulate the PIC to the rest of the the circuit with pull up, pull down resistors pushed into PIC socket. Simulate PWM with a 555.

WAG time. The stepper motor is driven by another IC containing multiple H-bridges, or by some discrete transistors (bipolar or FET). At least one power transistor has failed to shorted. When the PIC is in the circuit, the other transistor on the same end of a motor winding gets turned on, making a short from Vcc to common.

Cheers,
Dale Y
yusha
Posts: 50
Joined: Fri Jul 14, 2006 2:27 pm
Contact:

Re: Transfering program to another chip.

Post by yusha »

Just got a PICSTART plus programmer and am trying to get it hooked up.Will keep you all posted.
yusha
Posts: 50
Joined: Fri Jul 14, 2006 2:27 pm
Contact:

Re: Transfering program to another chip.

Post by yusha »

Hey hey! found the site and hex code!www.eleccircuit.com/stepper-motor-contr ... -pic16f84/
But a little confused.The sch.calls for a 16f84a and yet the board I have has a 16f84 in it.Can any one tell me the difference in simple farmer talk?Thanks
User avatar
MrAl
Posts: 3862
Joined: Fri Jan 11, 2002 1:01 am
Location: NewJersey
Contact:

Re: Transfering program to another chip.

Post by MrAl »

Hi there,


The most notable difference is the 'A' version can work up to 20MHz while the non 'A' version can only work up to 10MHz.
That's the biggest difference, so if the circuit you use only uses a 10MHz (or less) crystal you can most likely get away with a non 'A' version.

There are some other differences in the operating voltage and similar but they are relatively minor.

The EEPROM write time is a little longer for the non 'A' version, but if they dont use the EEPROM in the program code then that's not
a concern either. If they do use the EEPROM then they probably dont time it in hard code but probably rely on a feedback bit, so that
will most likely work ok too.
The FLASH memory has a similar difference, but i would think the hardware programmer device would know the difference and would use the right timing, as long as it is compatible with the non 'A' device in the first place.


Overall i would think that if the application you intend to use this with uses a 10MHz crystal or anything less than that that it should run
pretty well. I dont see anything that jumps up at me and says this will not work. If something does happen to fail, you'll just have to
purchase some 'A' version devices i guess.


PS
Took a look at your 'link' and sure enough it only uses a 4MHz crystal. I would think this would work fine.
If there is some strange difference then you'll just have to buy some new chips.
I wouldnt mind taking a look at the program code, but could not find it on that page. Is this a micro stepper or just a regular stepper?
LEDs vs Bulbs, LEDs are winning.
yusha
Posts: 50
Joined: Fri Jul 14, 2006 2:27 pm
Contact:

Re: Transfering program to another chip.

Post by yusha »

Yes!I downloaded the hex file with the Epic programmer into the 16f84 and the control works again.I think I blew the outputs of the original chip when I wired the motor common to the 5 volt 78l05 and that was what killed it.Im using this standalone circuit to test stepper motors.I see some circuits have another chip between the PIC and the Trans.Maybe a good idea.
Thanks all.
User avatar
MrAl
Posts: 3862
Joined: Fri Jan 11, 2002 1:01 am
Location: NewJersey
Contact:

Re: Transfering program to another chip.

Post by MrAl »

Hi yusha,


Where did you find the program code or hex file? I couldnt find it.
LEDs vs Bulbs, LEDs are winning.
Post Reply

Who is online

Users browsing this forum: Ahrefs [Bot] and 33 guests