I am working on building for an Uno, a shield PCB with a chip that runs SPI. The chip is surface mount and I would like to make the traces leading to it as simple as possible.
My question is, can I move the SPI pins to any digital pin that I want? I found a code that ebw44 posted in the storage section and I want to know if I can modify it to work with Uno? I am guessing the biggest difference would be just setting the pins numbers between 2-13.
Any suggestions would be great,
Mark
The code is most likely out of order, I have more saved but, the rest is specific to his application.
void setupExternalADC(){
pinMode(SELPIN, OUTPUT);
pinMode(DATAOUT, OUTPUT);
pinMode(DATAIN, INPUT);
pinMode(SPICLOCK, OUTPUT);
//disable device to start with
digitalWrite(SELPIN,HIGH);
digitalWrite(DATAOUT,LOW);
digitalWrite(SPICLOCK,LOW);
}
there is an header file for pin configuration
#define SELPIN 25 //Selection Pin
#define DATAOUT 24//MOSI
#define DATAIN 26//MISO
#define SPICLOCK 22//Clock
I think you need to post more of the code, but it appears from that bit that other parts of the code are bit-banging SPI, rather than using the hardware SPI. Hardware SPI is implemented on specific pins that vary by board type. The hardware SPI pins can not be changed without a soldering iron.
PaulS:
I think you need to post more of the code, but it appears from that bit that other parts of the code are bit-banging SPI, rather than using the hardware SPI. Hardware SPI is implemented on specific pins that vary by board type. The hardware SPI pins can not be changed without a soldering iron.
Or even WITH a soldering iron... XD
Edit: Read too fast, thought you meant the chip...
Using digitalWrite() to bit bang SPI is going to be much slower than the hardware SPI, if this matters. Direct port manipulation can give a big speed up if the hardware SPI is out of the question.