Showing results for 
Search instead for 
Did you mean: 

Looking for advice on adding a counter

Go to solution

I'm very new to block programming, this is the first VI I've had to make so far, but i see more in the future coming up.  I'm using a cDaq, and I'm having a heck of a time blocking in a counter for my system.  Either what I put keeps the system running in a continual while loop, or it doesn't count.  I've tried using the "Fill VI" to set a count, but I'm not having success.  


Essentially, I'd like for a single count to be added every fill.

0 Kudos
Message 1 of 6

The same way you'd be annoyed if I sent you a PNG of a 300 line Matlab program (with very tiny type) and asked your help in fixing it, I'm very annoyed if you provide a (very tiny) picture of your LabVIEW code.  I cannot easily examine the code, I certainly can't edit it, I can't see the "hidden Cases" of Case Structures, and I can't try to run it (unless I spend my own time trying to "copy" and reproduce your code).


Please help us to help you by attaching your VIs.


Bob Schor

0 Kudos
Message 2 of 6

It would also be good to include the hardware and software you are using for this data acquisition.

0 Kudos
Message 3 of 6

Cards: 9205 x 3, and a 9482.   Apparently the snipped that was attached didn't function.

0 Kudos
Message 4 of 6
Accepted by topic author NNehring

Two tips, unrelated to counters.


1.  You don't want to create and clear tasks every iteration of your while loop.  You should create before the loop starts, clear after its done.  Only put the Reads in the Loop.

2.  You are at risk of locking up your VI cold.  You have a lone event structure set to wait for the start button, but the event is set to Lock Front Panel until Event Completes.  That is fine the first time you press the start button.  But if you happen to press it again, you'll lock up your VI and there is no execution path to get back handling that event in the event structure again.  Caveats and Recommendations when Using Events in LabVIEW - LabVIEW 2016 Help

0 Kudos
Message 5 of 6

Thanks all.  I've noted the comments, and will wait for help with some of the more experienced folks in my company so that however the final write is made, anyone of them can work on it at a later time.  


Have a great day Bob Schor.

0 Kudos
Message 6 of 6