Hobbyist Toolkit

Showing results for 
Search instead for 
Did you mean: 

Can I use Linx arduino to do analog read and SPI write at the same time?

Simultaneously, for example to control a  SPI DAC chip output and read back the  output by the analog input of an Arduino.

0 Kudos
Message 1 of 11

Sure can do, but not simultaneously, but sequentially at very close data rate. That for Arduino can be called simultaneously

Jorge Augusto Pessatto Mondadori, PhD
Sistema Fiep
0 Kudos
Message 2 of 11

But, I am getting error with this vi. Couldn't figure out. I am new to Labview.

0 Kudos
Message 3 of 11

What errors are you getting? can you use only SPI? can you use only analog read?
how is your circuit wired?

try to avoid those red coercion dots on analog read, by using expected data type.

Jorge Augusto Pessatto Mondadori, PhD
Sistema Fiep
0 Kudos
Message 4 of 11

Apparently, I got rid of the error. By try and error.. I don't know if this is the correct way of doing. Please advise.

0 Kudos
Message 5 of 11

Note that I don't have LINX or a newer version of LabVIEW.

But let me quote a LINX Makerhub FAQ 

"When you call the LINX Initialize VI it establishes a connection to the LINX device and the Init VI passes out the LINX Ref wire. You can think of this wire as the connection to the device and it contains all of the info needed to 'talk to' the device. You really shouldn't branch / split this wire because you only have one connection to the device. If you split the wire you don't get a new connection, you juts get the same connection. If you split the LINX Ref wire, the VIs downstream might both try to talk to the device at the same time. In this case a command might be sent to the LINX device before the previous one is complete, and the responses to the commands might get swapped resulting in incorrect data being returned. Since only one command can be sent at a time splitting the LINX Ref wire doesn't result in any performance increase and adds risk for incorrect data. When you call the close VI the connection is closed. This includes any copies of the connection in branched / split wires. Once the connection is closed you can no longer talk to the device unless you establish a new connection with the LINX Init vi."

So just keep those vi's inline. 

Now Using LabVIEW 2019SP1 and TestStand 2019
0 Kudos
Message 6 of 11

But it seems to work for  multiple devices in the same wire. You can see the demo here: https://www.facebook.com/groups/291993951488587


Download All
0 Kudos
Message 7 of 11

Linx and the firmware for arduino is transactional. It sends a command, waits for the command to finish, returns the result. As posted previously, you shouldn't really branch the Linx wire.


If you want more simultaneous action you'd need to implement your own firmware and serial communication protocol to run on the arduino; Linx is designed to be simple. Usually though, you can just do the "quick" stuff first and then do the action that takes a bit more time. So in series do the digital I/O, then the analog, then external comms (SPI).

0 Kudos
Message 8 of 11

Somehow, I managed to cheat controlling 4 peripherals at the same time. SPI, PWM, Analog In, Digital I/O. Please see attached.

0 Kudos
Message 9 of 11

Linx isn't principally not capable to do that. What is usually the difficulty is that various pins have multiple purposes, so if you try to use multiple functions at the same time, you have to be very careful which pins you use for what.

Rolf Kalbermatter
My Blog
0 Kudos
Message 10 of 11