LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Metronomes, while-loops and flat sequences

I'm making a loop that is supposed to write a poll message to the serial port once every minute and read a message from the same port once every 256 ms. It is supposed to proceed untill a stop button is hit. It is based upon a while loop that contains two different flat sequence structures that each contains a metronome ("wait until next ms").

 

The intention of thisis that the program goes through the loop and every 256 ms it reads the serial port and every 60 000 ms it sends a polling message. However, the indicators I've connected to the metronomes doesn't seem so show a linear increase in the ms timer. The poll timer occasionally increases a little (in two minutes it might increase 20 ms). The read timer does not increase at all. Poll count increases very irregularly.

 

Does the flat sequences interfer with each other? Can this loop be changed in any manner in order to work properly?

0 Kudos
Message 1 of 5
(3,438 Views)
The loop is dominated by the "minute" timer, what will happen is that it will wait the minute, write, go to the 1/4 minute timer do it's read, the back to the minute timer. This is because LabVIEW is a data-flow language. There are a number of different ways to do this, one being having two loops, one writing, one reading, but with out some synchronization between the two they might drift. Another method would be to have an event structure, with the timeout value set to 250 mS, putting the read and write into a case structure in that timeout event. Having a time check, or even a resetable counter (use a shift register on the loop) to determine whether to write or read, with an event for the operator to stop the whole thing. I do a diagram, but have a meeting in a couple of minutes 🙂
Putnam
Certified LabVIEW Developer

Senior Test Engineer North Shore Technology, Inc.
Currently using LV 2012-LabVIEW 2018, RT8.5


LabVIEW Champion



0 Kudos
Message 2 of 5
(3,426 Views)
I've made a new attempt.
0 Kudos
Message 3 of 5
(3,387 Views)

And with an event structure:

 

0 Kudos
Message 4 of 5
(3,381 Views)

This thread has been continued here.

 

Please keep the discussion of the same topic in one thread. This makes it easier for people to find all the information. 

Message Edited by smercurio_fc on 04-02-2009 09:43 AM
0 Kudos
Message 5 of 5
(3,351 Views)