LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Fast acquisition with DAQ

Dear members, this is my 1st Labview code.

What I have : Labview 2018 + USB-6361 BNC card

What I need : (to monitor an electrolytic process that last for about 1 hour)

a- record multiple analog input channels

     - for a time window of about ~0.5ms

     - every ~5 minutes

     - for about 45 minutes

b- (desired/not needed) show the results "live" during the whole 45minutes and the last recorded "event"

 

So the code I have gets this done... but :

- the waveform chart is not readable... the time elapsed between acquisitions is too big so my events only show as a line... still, solving this is desired but not mandatory.

- if I put the STOP DAQ TASK outside the while loop, the trigger only works once, so my acquisitions start in a random moment. If I put the END TASK inside the while loop I get a very heavy code taking a lot of time to complete one iteration (with virtual signals works fine, but not with the real card and a signal generator).

- I apologize, the code is in french

- I need to record at ~100kHz / 0.5ms --> about 50 samples

 

So, the lower half of the code seems to work I even disabled it for testing, but it changes nothing.

 

2024-10-17_02.png

0 Kudos
Message 1 of 17
(326 Views)

We can't really analyze "pictures" of code, so please attach your VI.

 

What I can tell immediately is that you have glaring race conditions due to blatant overuse of local variables. You cannot tell in which order the terminal is written or the locals are read, but the result depends on correct order. LabVIEW does not execute left to right and execution order is purely determined by dataflow. There is no way to determine execution order of all your disconnected code islands.

 

0 Kudos
Message 2 of 17
(305 Views)
Have you looked at the "Continuous Measurement and Logging (DAQmx)" project template that ships with LabVIEW and DAQmx? You can access that excellent code from the menu>>File>>New...>>Project from Template.

"Should be" isn't "Is" -Jay
0 Kudos
Message 3 of 17
(275 Views)

Hi, I don't seem to have project templates

GeorgeMartin_1-1729228935224.png

 

And from help>>search for examples >> I got a few hints that led me to my actual code, but none of the ones I saw actually used a continuos acquisition with analog trigger

GeorgeMartin_2-1729229082735.png

 

0 Kudos
Message 4 of 17
(253 Views)

Hi,

I got rid of most of the local variables... There is still one to modify a control... a shift register would not be useful for this, would it?

I thought I was making the vi "more readable" by using local variables (I guess that should be a common excuse to justify bad coding practices among us, newbies)

The "new" vi is attached

 

0 Kudos
Message 5 of 17
(246 Views)

@GeorgeMartin wrote:

Hi, I don't seem to have project templates

GeorgeMartin_1-1729228935224.png

 

And from help>>search for examples >> I got a few hints that led me to my actual code, but none of the ones I saw actually used a continuos acquisition with analog trigger

GeorgeMartin_2-1729229082735.png

 


Those are VI Templates! You want the Project Templates.  Possible easier to get to from the Getting Started Window.  There is a menu option to show the GSW too!  ???View>>GSW??? I think.


"Should be" isn't "Is" -Jay
0 Kudos
Message 6 of 17
(224 Views)

So "I got it"...

 

but I cannot run it

GeorgeMartin_1-1729504437477.png

GeorgeMartin_0-1729504370132.png

 

but from what I could see, this code (that is clearly beyond my current skills) doesn't seem to be triggering

GeorgeMartin_2-1729504649602.png

 

 

 

0 Kudos
Message 7 of 17
(167 Views)

anyone with an idea?

0 Kudos
Message 8 of 17
(115 Views)

Hi George,

 


@GeorgeMartin wrote:

anyone with an idea?


Activate the missing "professional" license as indicated by that error message…

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 9 of 17
(113 Views)

I doubt that my company will accept to buy a different licence from the one we already paid, in order to get running an example that might not help at all with the problem that I have.

But thank you for your answer.

0 Kudos
Message 10 of 17
(108 Views)