Thoughts on adding additional I/O

Mark.R

Member
Just been having a route about the forum and the picaxe website in the FAQ section and just wondered what fellow forumers (if that's a word) thoughts are on adding I/O.

There are the following options from what I can see:-

1. Use a bigger picaxe chip (probably the easiest thing to do)
2. MCP23017 I2C I/O expander
3. MCP23S17 SPI I/O expander
4. Using a second picaxe chip.

The last one, using a second picaxe I find quite interesting but from the looks of the example code given you can ether have the extra chip as an output or an input expansion and not a combination of the two.

Extra Outputs
Code:
        let dirsb = $FF
main:   serin C.0, N2400, b1
        let pinsb = b1
        goto main
Extra Inputs
Code:
        ; Input reading PICAXE
 main:  b1 = pinsC
        serout B.7, N2400, (b1)
        pause 10
        goto main
With all of these expansion options other than just using a larger picaxe how would you use these in a program as it doesn't look as simple as you cant just go "High C.1" to turn an output on and say "if pinB.1 then" for looking at an input?
 

Solar Mike

New Member
Depends somewhat on what extra IO are you wanting, Digital inputs\outputs or Analog and the required processing speed.
The port expanders you mentioned are digital logic only, if you require Analog readings then an analog multiplexer chip can be used, usually 4:16 or 3:8 are common.

If you are doing stuff with background PWM with the Picaxe, the I2C may interfere with the PWM, in which case I would use the SPI interface.

For fast signal processing, a bigger chip is probably easiest option; or distribute the processing load to a second cpu and use an interrupt scheme to tell the other when to do something with the data which can be sent serially between the two.

Cheers
Mike
 

premelec

Senior Member
@Mark.R you can add varying an analog input to indicate various states to the list - IF you can stand the extra time to "see" and process an analog pin state. An example is reading a 12 button matrix with one pin. There are caveats... ;-0
 

lbenson

Senior Member
As said, it depends on your requirements. Here's a thread about controlling 45 12V LEDs on a 24-hour timed schedule, with 256 possible turn-on times.

 

Mark.R

Member
Morning chaps, thanks for your replies to the thread, I will have a read through the posted links.

I wasn't looking at anything as complicated as analogue expansion (not yet anyway) just digital I/O. I was thinking that my 12 ish relays might be nicer fed from some sort of I/O expansion chip rather than just putting a bigger Picaxe in if I didn't need to. I have a 40X2 in stock which I may use as the main controller in my project to run all digital outputs and a few digital inputs, all the analogue temperature monitoring are done by separate Picaxe chips and sent to the pain one over serin/serout.

Mark
 

Aries

New Member
If you only need output from (and not input to) the Picaxe, you could consider using a series-to-parallel shift register like the 74HC595. This needs only 3 or 4 output pins on the Picaxe, and gives 8 digital outputs per shift register; they can be daisy-chained to any length, without needing any more Picaxe pins. If you are driving relays, you would then need suitable Darlington or transistor drivers as well (but you probably would anyway).
 

tmfkam

Senior Member
If you only need output from (and not input to) the Picaxe, you could consider using a series-to-parallel shift register like the 74HC595. This needs only 3 or 4 output pins on the Picaxe, and gives 8 digital outputs per shift register; they can be daisy-chained to any length, without needing any more Picaxe pins. If you are driving relays, you would then need suitable Darlington or transistor drivers as well (but you probably would anyway).
Or a TPIC high power output 595? Less available, and if memory serves, a different pin out to the standard '595, but a great option.
 
Top