Identify Picaxe before downloading?

John O

Senior Member
Reading the thread about programming multiple Picaxes in parallel made me think of a "problem" I had recently: I had three 18M2 chips all with different programs running but, when I made a change to one, I had to change them all (wireless serin/serout).

It meant a lot of download plug swapping and I lost count of the number of times I downloaded the wrong program into the wrong chip! No great hassle but it would have been great if there was a compiler directive that could look at a programmed ID in a chip and determine if the "new" code was destined for the correct chip.

John.
 

hippy

Technical Support
Staff member
It could potentially be done but might be a lot of effort and perhaps fraught with danger for little gain. The last thing one wants is for a PICAXE to render itself unable to dowload anything.

The easiest solution is to put each on their own AXE027 or other download cable and specify the #COM port the program downloads through, that way you are guaranteed to get the program into the right PICAXE each and every time.

Alternatively, have the program check the pins for a particular configuration so it can flash a LED or something when the program finds its in the wrong chip. Setting a voltage for an ADC is an easy way to use just one pin and allows a number of different boards to be identified.
 
Last edited:

John O

Senior Member
Thanks. A separate download cable for each would have made the job a whole lot easier anyway! :)

Cheers,

John.
 

Andrew Cowan

Senior Member
You could also load a unique value into a particular EEPROM location of each chip, then use the no_data so the new program doesn't erase it.

You can then have the program check to see if the EEPROM value is correct for that chip - if not, flash an LED/buzz a piezo etc.

A
 

hippy

Technical Support
Staff member
You could also use SERRXD and RECONNECT so each PICAXE can monitor the download serial and decide when to allow itself to be re-programmed, use a terminal emulator to send a command to say which should enable themselves, when they should start running their code.

Could get quite complicated though.
 

John O

Senior Member
I guess I was just being lazy :)

Something simple like the PE's message dialogue when you have, say, #Picaxe 18M2 at the top of the program and you try to download into something else. You're aware of the error before you make it.

I was thinking that, if there was a fixed EEPROM location which a running program could optionally WRITE with a unique ID - just a simple number 0 to 255 - a #directive (#ID 123) could tell the PE to check that location before it attempted the download.

If something went wrong and it wouldn't download into the correct chip, just removing the directive from the code would restore normal service.

As you say, though, if it introduced more risk of bricking the chip with very little to gain, it's definitely not worth it.

John.
 

PeteShep

Member
Can Anybody Play?

Roll all three programs into one.
Identify your three chips by EEPROM, or by the wired condition of a spare pair of inputs.
Program all three with the same program.
Then at the start of your humungous program:-
If its chip 1 then goto section1 ......

or if you prefer it
Select ChipID
case 1
goto section1
case 2
goto section2
else
goto section3
endselect

If you felt realy brave you could do it with a spare AnIn.
Tie one Hi, one Lo, and one in the middle!
 
Top