LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Conditions in labview with myDAQ

Hello everybody,

 

I have a program but it is not work like i want it. i attach my program.

My problem is that I don not know how can i do time measure between 2 high digital input. I want the first one (exactly Digital input 0) start the measurement and the next pulse (exactly digital input 1) is stop my measurement. Furthermore I want the analog input save the actual position when it is get only one sign from digital input 0 but the loop should be stop when the elapsed time is measured.

Thank you for your answers.

Download All
0 Kudos
Message 1 of 5
(2,183 Views)

Hi Greg,

 

some notes:

- depending on your DAQ hardware you could setup the DAQmx task to use those DI signals directly as triggers. See the example VIs coming with LabVIEW…

- you should call your GetTime FGV with "Reset" before the loop to initialize it!

- when you read the whole port0 you need to get the single bits for each of the DI lines. You may use IntegerToBooleanArray…

- Using AutoCleanup on both your VIs improves them a lot…

- there is a combined Sin&Cos function…

 

the loop should be stop when the elapsed time is measured.

You need to combine this condition with your "stop" button. An OR function could help here…

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 2 of 5
(2,175 Views)

Thank you very much for your answer!

 

Unfortanately with myDAQ the example programs did not work. I use these simple and useful tricks. But I have a problem when i connect my wire to the stop of the while loop ( I use directly the cables of the digital input ) and I want to put the analog measurement in a while loop to get the last details of the measurement (because it is the useful information for me ) when it is get the high signal so i put the same input with one of the digital signals. How can I stop the analog measurement when the digital signal is high and why the loop is not stop on the way i connect?

0 Kudos
Message 3 of 5
(2,141 Views)

Hi Greg,

 

How can I stop the analog measurement when the digital signal is high and why the loop is not stop on the way i connect?

Your VI is very convoluted now…

Using loops inside loops is surely not the way to go (here)!

 

- You still don't reset your MeasureTime FGV!

- Your inner loop in case 1 runs as fast as the CPU allows: what is this good for? Why do you need to invert the button and AND with TRUE (pure RubeGoldberg!) just to end this loop? Why not connect the button with the stop condition and invert the stop condition?

- why do you need the inner loop for those DAQmx functions?

- why do you build an array of exactly one element, just to index its first element? Pure RubeGoldberg!

- why do you NOT two boolean signals, just to AND them? Why not NAND them? Pure RubeGoldberg!

 

What about a state machine with just 4 states:

1. Initialize

2. Wait for DigIn signal

3. Do measurement until DigIn signal

4. Deinitialize/Cleanup

 

 

Unfortanately with myDAQ the example programs did not work.

You are using DAQmx functions, so you could use most of the DAQmx examples…

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 4 of 5
(2,127 Views)

@GerdW wrote:

 

- why do you NOT two boolean signals, just to AND them? Why not NAND them? Pure RubeGoldberg!


Actually, that would be a NORSmiley Wink

Message 5 of 5
(2,116 Views)