06-14-2019 10:57 AM
There really is no timeout to worry about for VISA Write. Whatever you write to it will go out pretty much right away.
You don't want Write and Read to occur at the same time. You want to Write a command, then Read the response. You do it in series!
I see other issues with your code with an abuse of local variables. Use wires, not local variables.
06-14-2019 10:59 AM
I need to write a command and read teh data from arduino at the same time, so what should I do ?
06-14-2019 11:03 AM
How can your read a response "at the same time" as you write the command? You have given your device enough time to react tot he command you sent to it.
06-14-2019 11:10 AM
the command is use to move my robot via Arduino, and my robot always sent the data posisition all the time to Arduino even there is no command to it. So I have to always read the data posisition in my Arduino with or without my command to move the robot.
06-14-2019 11:33 AM
Hello everyone
I need some help about visa open duplicate session. Anyone can explain about this ? Can I use this to make my program can read and write at the same time ? Because I have a program with same port that have send data serial to Arduino and the Arduino send data too to LabVIEW all the time, so sometimes, my VI have to read and write using visa at the same time. I really expect someone can explain so clearly because I'm new in labview
thank you
06-14-2019 11:39 AM - edited 06-14-2019 11:47 AM
DO NOT open a VISA session for one read or write close it and open a new one every single time!
Here's a very simple example...
06-14-2019 11:50 AM
06-14-2019 11:53 AM - edited 06-14-2019 11:54 AM
As I have stated, you can do this quite simply with a queued message handler. Have a loop specifically for communicating with the instrument and talk to it using a queue. Here is a quick framework for you to work with.
06-14-2019 11:53 AM - edited 06-14-2019 12:10 PM
@Reiza wrote:
So if i want to make visa write and visa read work at the same time, I have to use shift register in my loop ?
Yes, here's a little better example for you. Notice I have the Termination Character enabled and set to the default \n or Line Feed and I have set the VISA Read to read far more bytes than I ever expect to receive.
Now when you send a command the VISA read will read until it receives the Termination Character or times out.
This is how you do serial communications with VISA and any serial device.
In your Arduino sketch use the PrintLn command as it appends a Line Feed onto everything for you.
06-14-2019 11:58 AM
Can you explain how the shift register works to make visa write and read at the same time ?