LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

how do i implement a loop every second

I am working on a program to collect load data from a load cell and voltage pulses from a wheel counter.  In order for the system to work properly the counter needs to be continously running, but i only want to write the load and total counts to a file every second or so.  if i slow the load data colection down then the counter only colecst counts at the same interval, and if i speed it up so the counter is counting all counts then i get hundreds of load readings per second as well.  any help on the process of running a loop every second that takes a load measurment, and writes everything to a file, would be helpful.  thank you
0 Kudos
Message 1 of 4
(2,753 Views)
There are two solutions to your problem and the right one depends on the complexity of your program.

The first is to have two separate loops. One does the counter update and runs at the fast speed. The second loop does the writing of the file and runs at the slow rate.

The second is to have one loop that runs at the fast speed so you to the counter update. You keep track of the time in a shift register and if an appropriate amount of time has passed (e.g., one second), you write to file. Meaning the file write is inside a case structure that's controlled by the "how much time has passed" check.
0 Kudos
Message 2 of 4
(2,743 Views)
Hi chazzeek:

Use a Elapsed Time VI Express configured for 1 second of Time Target and place it on your main loop. Then wire the Elapsed time? output to a Case Structure and place the Load Cell reading code inside the True case.

I've attached an screenshot and a simple VI showing how to do it.

Hope this helps.

Robst.


Robst - CLD

Using LabVIEW since version 7.0


Download All
0 Kudos
Message 3 of 4
(2,742 Views)
Oh yeah, the Elapsed Time Express VI. Forgot about that one. All these nifty little doo-dads with these new version of LabVIEW, it's hard to keep track of 'em all. Though I tend to stay away from Express VIs since I see them as somewhat bloated given what their basic function is. I mean, have you looked at the code for that VI? Gee, whiz. Still, an acceptable choice for this application. Thanks for pointing it out.

Message Edited by smercurio_fc on 04-04-2007 01:26 PM

0 Kudos
Message 4 of 4
(2,735 Views)