Best way to program multiple picaxes 'in circuit'?

Jeremy Leach

Senior Member
I'm just wondering what the accepted wisdom is these days for programming multiple picaxes in circuit?

Of course each picaxe could have it's own serial connector and circuit.
Or there could be a single serial connector, and switches to select each Picaxe in turn (serin and serout I guess).
I guess there's no way to have multiple picaxes sharing the same serin and being programmed based on a chip 'address' (pins tied high or low, as used in things like EEPROM chips)?

I might end up with a board of 3 Picaxes, and it would be handy to be able to tweak the code for each in-circuit if possible.
 
Or there could be a single serial connector, and switches to select each Picaxe in turn (serin and serout I guess).
Jeremy,
There are already devices that do this. Here is a example listing I found on ebay that switches between 4 devices: 4 Port Switch Serial COM Device Console Selector.
On the back you plug your PC to the input and up to 4 PICAXE chips to the four outputs.
On the front you press the pushbuttons to choose which PICAXE your PC serial line is connected to.

I am not recommending this listing. It is only an example to show you what device I'm talking about.
I've already seen a couple of listings selling this same box so you can search for the best price+postage deal.
I've no idea what the quality of these particular boxes.
 
Thank you. And remind me - is the serout pin used when programming? I.e for a handshake etc.
The download process is bi-directional ... the programmer (PC) Reaches out, the PICAXE replies back ... then the programmer starts sending code .... it's not a one-way transaction, so SERIN and SEROUT are needed for a download.
 
Jeremy,
There are already devices that do this. Here is a example listing I found on ebay that switches between 4 devices: 4 Port Switch Serial COM Device Console Selector.
On the back you plug your PC to the input and up to 4 PICAXE chips to the four outputs.
On the front you press the pushbuttons to choose which PICAXE your PC serial line is connected to.

I am not recommending this listing. It is only an example to show you what device I'm talking about.
I've already seen a couple of listings selling this same box so you can search for the best price+postage deal.
I've no idea what the quality of these particular boxes.
Thanks for that.
 
Depending on your circumstances, would it be feasible to parallel all the programming pins and selectively power the chips one by one for programming?
 
Hi,
There are already devices that do this. Here is a example listing I found on ebay that switches between 4 devices: 4 Port Switch Serial COM Device Console Selector.

That might be rather overkill for the application, because the description suggests that all (7 ?) signal pins of the 9-pin Sub-D connectors might be switched? But you must selectively switch the PICaxe's Programming Output pins (not power-down any chips) because of the (active high) return/handshake path.

The normal PICaxe 3.5mm programming socket (which happens to have two break-on-insert switches - but these are rarely used) was introduced for more reliable "Educational" applications. However, the "Legacy" 3-pin (polarised) pin header can be just as useful for "compact" layouts. Or personally, I often use a simple 3-pin (unpolarised) 0.1 inch header with Earth to the centre pin. This is particularly easy to layout on Solderless or custom PCBs, and gives an easy escape route if RXD and TXD have been accidentally confused. ;)

Or you could use simple TTL or even Diode (Positive) Logic gating: AND for the Programming inputs and OR for the Return/Verification outputs.

ADDED: All modern PICaxes have the DISCONNECT command (to ignore programming commands) and the (Programming) Output pin can be tri-stated, so in principle their individual programming could be controlled entirely by (internal) software programming, through some type of Daisy-Chain configuration. But to be honest, I would probably KISS and use a simple DIP switch to select the target chip input and a Diode Logic OR gate for the Outputs.

Cheers, Alan.
 
Last edited:
That might be rather overkill for the application, because the description suggests that all (7 ?) signal pins of the 9-pin Sub-D connectors might be switched? But you must selectively switch the PICaxe's Programming Output pins (not power-down any chips) because of the (active high) return/handshake path.
AllyCat,

The device only connects the serial lines and in Jeremy's case that would be just the RS-232 TXD, RXD & GND pins. Power would not be provided via the serial cable so switching between the PICAXE chips would be like disconnecting a programming cable from one PICAXE chip and plugging it in to another. It would not power down the disconnected PICAXE chips, would it?

Each PICAXE chip would have to have the correct dowload circuit with the 10k/22k resistors to gnd on the Serin pin.
 
Jeremy,

I use a usb-to-db9 serial converter with a homemade cable to connect the DB9 connector to the PICAXE serin, serout and ground pins so the first example I thought of was a device that switched db9 serial cables. Using DB9 connectors probably won't be the most useful.

However, anytime you have a comms cable someone has a situation where they want to switch between more than one destination.

Here are examples of switches for USB cables and for 3.5mm Stereo Audio Cables.

The USB switch is described as connecting In from 4 PC's to Out to one printer, probably because that is the reason most people want a USB switch. The USB communication between the PC and the printer is both ways so I expect it would work to connect from 4 PICAXE chips to one PC, BUT I HAVE NOT TESTED THIS.

The total cost of a programming setup using a switch will be the cost of the cable from the PC to the switch plus the cost of the switch plus the cost of 4 cables from the switch to the PICAXE chips:

- 1 USB cable from the PC to the switch + the USB switch + 4 USB Type-B Male to USB Type-A Female adapters + 4 PICAXE USB download cables
vs
- 1 PICAXE USB download cable + the audio cable switch + 4 Male to Female Audio 3.6mm Stereo Extension Cables (these have the advantage that you get a choice of cable lengths from the switch to the PICAXE chips

As before, these links are only intended to show you the type of devices that are available.

UPDATE: The original USB switch example I posted would not work as I presented. If you look at the back of the switch is uses the square Type-B USB connectors so you would not be able to plug 4 PICAXE USB download cables, which have the rectangular Type-A connectors, into this type of switch. I have updated the USB example to include a USB Type-B Male to USB Type-A Female adapter
 
Last edited:
I might end up with a board of 3 Picaxes, and it would be handy to be able to tweak the code for each in-circuit if possible.
Hi,

That is the scenario I was considering. Thus 3 x 3 pin headers might be all that you need. Or a 3 way physical switch, and 3 x diodes to form an OR gate to return the active programming output pin level.

BTW, I always connect the serin pin to ground via a resistor (10k - 1M) so that it's easy to reprogram the PICaxe directly via its pads/pins (e.g. via "Pogo" pins or a clip-on adapter).

Cheers, Alan. (Sent from my phone)
 
Jeremy,

If you are comfortable soldering up your own cables & components a cheaper option might be;
1 x PICAXE USB download cable + 1 x 3.5mm Stereo Plug + 1 length of 3 Core Shielded Audio Cable + 1 x 3 Pole 4 Position Rotary Switch + 4 more lengths of 3 Core Shielded Audio Cable + 4 x 3.5mm Stereo Sockets + a project box to put the rotary switch into.

From the wiring image on the 3 Pole 4 Position Rotary Switch listing:
- You wire up the Serin, Serout and GND from the 3.5mm Stereo Plug to the switch pins A, B, & C
- You wire up the switch pins 1, 5, & 9 to the 3.5mm Stereo Socket for PICAXE 1, switch pins 2, 6, &10 to the 3.5mm Stereo Socket for PICAXE 2, etc
 
Hi,

That is the scenario I was considering. Thus 3 x 3 pin headers might be all that you need. Or a 3 way physical switch, and 3 x diodes to form an OR gate to return the active programming output pin level.

BTW, I always connect the serin pin to ground via a resistor (10k - 1M) so that it's easy to reprogram the PICaxe directly via its pads/pins (e.g. via "Pogo" pins or a clip-on adapter).

Cheers, Alan. (Sent from my phone)
Yes, the rotary switch could be a good solution. Cheers.
 
Jeremy,

I use a usb-to-db9 serial converter with a homemade cable to connect the DB9 connector to the PICAXE serin, serout and ground pins so the first example I thought of was a device that switched db9 serial cables. Using DB9 connectors probably won't be the most useful.

However, anytime you have a comms cable someone has a situation where they want to switch between more than one destination.

Here are examples of switches for USB cables and for 3.5mm Stereo Audio Cables.

The USB switch is described as connecting In from 4 PC's to Out to one printer, probably because that is the reason most people want a USB switch. The USB communication between the PC and the printer is both ways so I expect it would work to connect from 4 PICAXE chips to one PC, BUT I HAVE NOT TESTED THIS.

The total cost of a programming setup using a switch will be the cost of the cable from the PC to the switch plus the cost of the switch plus the cost of 4 cables from the switch to the PICAXE chips:

- 1 USB cable from the PC to the switch + the USB switch + 4 USB Type-B Male to USB Type-A Female adapters + 4 PICAXE USB download cables
vs
- 1 PICAXE USB download cable + the audio cable switch + 4 Male to Female Audio 3.6mm Stereo Extension Cables (these have the advantage that you get a choice of cable lengths from the switch to the PICAXE chips

As before, these links are only intended to show you the type of devices that are available.

UPDATE: The original USB switch example I posted would not work as I presented. If you look at the back of the switch is uses the square Type-B USB connectors so you would not be able to plug 4 PICAXE USB download cables, which have the rectangular Type-A connectors, into this type of switch. I have updated the USB example to include a USB Type-B Male to USB Type-A Female adapter
Thanks for taking the trouble here. All appreciated.
 
Yes, the rotary switch could be a good solution. Cheers.
Hi,

Small, PCB rotary switches (e.g. with a screwdriver slot) and 2-pole, 3-way slide switches (not centre-off) are available. Or even multi-pole, mult-way DIP switches (try ERG or RS) but at an apparently unrealistic price, now. However, even those seem rather overkill for a "nice to have" option. A 5-pin Header with a pin-link/bridge can emulate a 3-way switch; the linked, even-numbered pins would represent the "wiper" and the odd-numbered pins the I/O selected "ways".

Don't forget that the PICaxe programming inputs MUST be pulled to earth for normal operation, but a resistor of 100k - 1M is sufficient, and allows a normal programming circuit to be applied if/when required. Or you could duplicate just the "22k" resistor for each PICaxe and short-circuit the programming input pins directly to ground, for the chips Not required to be programmed (again a 5-pin header, but with two bridge-links).

ORing the Programming Output pins carries a minor risk because a virgin PICaxe continuously transmits its "Hello I am your PICAXE" message until programmed. So it might be necessary to program each PICaxe separately for a first time, before using it in a "multi" board.

Cheers, Alan.
 
Last edited:
Back
Top