LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Making two procedures in the same time

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 ?

 

labview.png

 

Thanks a lot.

0 Kudos
Message 1 of 5
(3,509 Views)

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

0 Kudos
Message 2 of 5
(3,497 Views)

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.

 

 

0 Kudos
Message 3 of 5
(3,496 Views)

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.)

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 4 of 5
(3,443 Views)

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!

Chase
NI Technical Support Engineer
0 Kudos
Message 5 of 5
(3,414 Views)