04-10-2017 10:21 PM
Hello,
I have made a VI to read some voltages from the Arduino pins, and also it generates a square signal. The problem I am having is that reading values from Arduino pins and generating the signal doesn't happen in the same time.
Is there a possible way to make this happen? I have heard that this is possible if I put the top part of the VI in a while loop and put a delay(WAIT) inside the loop. Does anyone experienced something similar ?
Thanks a lot.
04-10-2017 10:43 PM
Well, I can't tell what is supposed to be happening on the upper or lower Error Line (the picture is too small to see details, and the VI has question marks on all of the I/O functions). However, the entire loop takes 4 seconds per iteration, which means the upper functions also run at 0.25 Hz. Is this what you want? Note that Wait functions slow things down, and have nothing per se to do with synchronization ...
Are you trying to simultaneously read and write on the same USB/Serial port? Usually when one tries to do simultaneous or synchronous I/O, they use different channels or devices ...
Bob Schor
04-10-2017 10:47 PM
Thanks a lot for your response.
Yes, this is what I am trying to do. I need the labview to make the Arduino read and write in the same time.
04-11-2017 02:09 AM
Hi haalshaik,
general note: when you want to do things in parallel with LabVIEW you need to program them in parallel order! THINK DATAFLOW! (This is pretty basic LabVIEW stuff: did you take the beginner tutorials?)
DATAFLOW dictates: a loop will iterate, when all included code is executed. So your big while loop will wait until the sequence inside is executed…
Try to put that sequence in its own loop! (See if you get the results as expected even when you try to communicate with your Arduino from two loops in parallel.)
04-11-2017 12:35 PM
In addition, I would look up using error wires to control data flow. It's a really useful way to use them I found out a few months ago that is really helpful!