We are planning on having an analog input module. The analog sockets are best to be utilized to plug in modules but then you can add an “analog module” to read external signals.
A sockets only have three pins to use as an output if you are using one as an analog input.
[/quote]
Yes pins 7,8,9 are marked as unconnected for socket A, but pin 6 is marked as GPIO for socket A so surely I could use all 4 pins (6,7,8,9) as digital output pins to drive the channel selection on the mux?
I had originally said no, but then changed my post.
socket 14 is also a Y socket which is all GPIO. The best way to answer your question is to look at the schematic. you would see that all the pins of socket 14 are connected to something.
Yes I was basing my assumption of using pins 6,7,8,9 based on the Y socket type that is listed plus the fact that pin 6 is marked as GPIO for the A socket type.
So I should be able to use the following code in my app?
GT.Socket socket = GT.Socket.GetSocket(14, true, null, null);
GT.Interfaces.DigitalOutput muxSelectionBit0 = new GT.Interfaces.DigitalOutput(socket, GT.Socket.Pin.Six, false, null);
GT.Interfaces.DigitalOutput muxSelectionBit1 = new GT.Interfaces.DigitalOutput(socket, GT.Socket.Pin.Seven, false, null);
GT.Interfaces.DigitalOutput muxSelectionBit2 = new GT.Interfaces.DigitalOutput(socket, GT.Socket.Pin.Eight, false, null);
GT.Interfaces.DigitalOutput muxSelectionBit3 = new GT.Interfaces.DigitalOutput(socket, GT.Socket.Pin.Nine, false, null);
GTInterfaces.AnalogInput analogIn = new GT.Interfaces.AnalogInput(socket, GT.Socket.Pin.Five, null);
Is there any way to write to all 4 digital outputs simultaneously to set the mux channel selection as opposed to writing to each output individually one after the other?
So ideally I’d like to set the 4 digital outputs to the analog mux chip simultaneously then read the analog input from the muxh chip.
I guess if we can’t the other option is to use another digital output to control the Enable line of the mux or just not worry about the 4 bits of channel selection being set serially before we read the analog input.
What I think Gus is saying is that if you use a gadgeteer socket for one “device type” then you can’t reuse that socket for any other purpose. So you can’t “borrow” the unassigned/unused pins in that socket for some other purpose.
In this case, what you would need to do is create a “combination driver” that allows you to use both the AnalogIn pin and the digital IO pins.
I guess you could also step out of the Gadgeteer world and back into netmf and use the pins - again, take all this with a grain of salt until someone else who knows more comes along and contradicts or confirms
I assume Gus’s comment about “not simultaneously” was in reference to my question on whether it was possible to get the CPU to set the state of a bunch of digital output lines, in this case the 4 lines making up the mux channel selection, simultaneously or whether you could only set the state of the digital output lines in a serial fashion.
Parallel signals are never simultaneous. If you change the state of 4 data lines at once there will always be slight timing differences in the time the signal arrives at the other end, and slight timing differences in detecting the the signals on all four inputs at the other end. This is why when you look at a parallel bus you will always find other control lines being used. Generally you set the data lines to the correct state wait for a short time period (settling time), then you toggle the state of a control line which tells the other end it is safe to read the data bus.