Hi, I am running out of pins and a thought occoured to me that it should be possible to combine the required CS pins from multiple SPI interface requirements with a logic chip. The new Ethernet Shield uses 10 and 4 for ethernet and sd card respectively and I will be needing some more SPI's without losing all the available digital lines to do other things.
The idea is to use three digital pins as a binary number, which it should be possible to decode with a TTL chip to 8 lines. (now perhaps you don't want to use 000 so you can have an all off) I know this would mean a circuit board between the Uno and the shields but that would also allow A0 and A1 to be recovered for analog input with out cutting the pins off the back of the ethernet shield. Also there would need to be a routine to switch the SPI between whatever you wanted to talk to rather than just switching individual pins ( high ; do something; low). You probably have to go through the 000 state in each transition to make sure that no chip is listening before activating the next one.
Can anybody see anything wrong with this basic idea? or are switch on switch off functions already buried so deeply into the libaries that they would be dificult to doctor?
The basic idea of I/O expansion is sound but if you use it for SPI devices you will need to edit the library for each SPI-based device to change the way it sets Slave Select.
Perhaps some of your other pin usage would work better with I/O expansion based on a shift register and shiftIn() or shiftOut().
You have 20 pins to work with (13 if you use 0 and 1 for serial I/O and 5 for the Ethernet+SD Shield). What are you using them for?
I plan on testing a very similar setup as soon as I get around to it. Once I do I will post what I find out. If you could also share how it works out for you, that would be valuable for me.
I Thought that the idea would lead to hacking the Ethernet,SD libaries if I can avoid that then I will 'nonstandard' is always trouble. I'm trying to build an enviromental controller that uses PT1000 temperature sensors (for compatable with other things on site and eventually cut down the variety of spares needed) so I need all 6 analog inputs!! Hence the idea of separating the ethernet shield and uno with a custom board. Plus a local LED display is out the window unless I can get one with a SPI rather than a I2C interface. Trouble is I need all the uno's digital lines to drive relays for interfacing to the dreaded 240V.
To be fault tolerant I don't want to multiplex the relay drives, if something dies then they all need to failsafe.
I do'nt know how long this is going to take now. All other ideas welcome.
Have you thought of using DS18B20 temperature sensors? You can hook a whole series of them to a single data pin. That will leave A4 and A5 free for a I2C LCD display.
Thanks for the info folks. I've managed to keep all the analog inputs and put a 4 to decoder on the outputs using the strobe function to give me the fail safe.
My next problem is the HTML interface and a couple of methods that work when the code is embedded in the main code but dont work as methods. Thats another subject!!!