LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Queue Functions with Delay

Hi,

 

I'm sending commands over serial, in psuedo code this is what I want to achieve:

 

serial write -> wait 7 seconds -> serial write

 

..and that sequence will be called 15 times with different write buffer elements.

 

What is the best way to queue these commands while implementing a 7 second delay? 

0 Kudos
Message 1 of 5
(2,606 Views)

Do you want to be able to handle any other commands out of the queue while the 7 second delay is occurring?

 

You could just do the serial write, and the delay, then the serial write all as part of 1 command passed by the queue.  You'd use a wait statement in a sequence structure, or even an Express time delay function so that you have the error wires to enforce the order of execution with the delay.

Message 2 of 5
(2,589 Views)

Hi Synbios,

 

some more pseudo code:

 

For Each string in string-array

  SerialWrite string

  Wait 7000ms

Next

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
Message 3 of 5
(2,588 Views)

No I'm not doing any other commands during the wait. What is an effective way just to impelement a basic delay/wait?

0 Kudos
Message 4 of 5
(2,584 Views)

Use the wait function.

 

I would implement this as a master slave and include the "wait" as one of the commands sent to the slave.

 

This would put the waiting in the slave loop allowing the master to do other things.

 

Ben

Retired Senior Automation Systems Architect with Data Science Automation LabVIEW Champion Knight of NI and Prepper LinkedIn Profile YouTube Channel
Message 5 of 5
(2,575 Views)