So here's the setup:
-Arduino
-ADC chip providing data thru SPI (MISO)
[[EDIT: I'm using a ADS1252, see this post for details on how this is possible: Arduino Forum]]
-1.8' Sainsmairt TFT screen with SD card via SPI
What I would like to do is utilize the SD card slot on the TFT screen and a place to dump data logging files of the data from the ADC.
Since the ADC data is input (MISO) and the display control is output (MOSI) I should be able to easily run a little graphical plot of the values from the ADC without conflict.
The problem is accessing the SD card while accepting ADC data:
As far as I can tell from my research, I can access the SD card independently very easily by using SPI but I believe**(not sure) that in order to Write files to it, I need to briefly read feedback from the SD card to make sure it's valid and whatnot. If I'm wrong and it's possible to write to and SD card with just the MOSI line, then the following isn't an issue at all:
Assuming that SPI can only take input from one device at a time I am trying to design a transistor gate/latch thing. (I have very basic knowledge about this so please bare with me)
Ideally, I want to have one digital pin from the arduino be High or Low and depending on which one it is, one of the inputs (SD or ADC) to the MISO are ignored.
logically I figure its something like this:
Switch |
SD Data |
ADC Data |
Data to MISO |
|||
---|---|---|---|---|---|---|
0 |
1100... |
1010... |
1100... |
|||
1 |
1100... |
1010... |
1010... |
in terms of logic gates, this should be (a AND s) OR (b AND (NOT s))
Now, I know very little about transistors, My basic hunch was that this is actually a really simple circuit: Perhaps a PNP transistor and a NPN transistor with the bases connected to the Switch pin and the collectors connected as the output (with a couple resistors sprinkled around for safety (I do not know where yet)).
My instinct is that that is too simple, and I'll probably destroy my arduino somehow in the process... I'm not sure how sensitive the input is to current (help with this please)and I dont want to modify the original data in the process.
So to summarize:
question 1: does writing to SD card "really" need feedback in order for the library to function?
question 2: Can I use transistors to make a "relay" that toggles witch Data input is going to the arduino?
question 3: is it even possible to swap/interrupt the SPI input like this and is it safe?
Thank so much for your help