LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

long term discontinuous logging DAQ-assistant

Hello,

 

I need to log information of load cells (NI9219) and strain gauges (NI9237) with a compactDAQ 9178. This logging will be discontinous. Let's say 10 minutes logging and 50 minutes nothing (repeating). The logging has to be triggered by a digital edge. The digital signal is continious and when it falls the logging has to stop. I thought of using a while loop with a case structure within. The case structure has 2 cases with one for logging and the other one doing nothing (state machine). So the first case must be activated by the trigger signal. But how do you do this? I know the basics of labview but I never worked with DAQ-assistant before...

 

If anyone could help, I'll appreciate it very much

 

Thank you

0 Kudos
Message 1 of 19
(3,389 Views)

What you're describing is a Simple State Machine which actually is the most common architecture for a data logger.  There is a template available and many threads about them to help you set one up.

 

As far as your digital signal input goes, you didn't tell us what kind of hardware you have.  There are many examples that come with LabVIEW to help you get started there.  They don't generally use the DAQ Assistant though and I would recommend you learn the basics of DAQmx programs rather than relying on it. 

LabVIEW Pro Dev & Measurement Studio Pro (VS Pro) 2019
0 Kudos
Message 2 of 19
(3,356 Views)

I've looked at the examples but I don't understand how you can stop the logging with a digital signal - falling edge. Starting is easy but stopping is something very different. The only 2 options that are available I see are because of an error or by hand with a stop-button.

0 Kudos
Message 3 of 19
(3,340 Views)

You should read the digital signal and analog signals continuously.  Put the write to file in the true case of a case structure.  Wire your digital signal to the case structure.  When the signal is high, the value  is true, you log the data.  When it is low, the value is false, you don't log the data.

0 Kudos
Message 4 of 19
(3,329 Views)

Remember that a stop button is just a boolean, same as a digital line.  Look at the little example I attached.  It's VERY basic to show you the concepts.  I would add more timing control, a "quit" state to close your file and DAQ, an event structure to allow on-the-fly changes, etc. but this should get you started.

 

It's in 2013, let me know if you need it back-saved but I'm about to head home...Smiley Wink

LabVIEW Pro Dev & Measurement Studio Pro (VS Pro) 2019
0 Kudos
Message 5 of 19
(3,325 Views)

Thank you for the help

 

I added a DAQ-assistant in the idle state which reads the digital sigal. With a select signal function, the first digital signal from the module is selected (which I need) and this boolean will decide if the state changes to log or back to idle. If it's true (log state), then a DAQ-assistant for the strain gauges will begin to log and write it to a measurement file. I don't know what I have to put in the init state.

 

Is it good what I've done?

 

The file is in 2013 version

 

Thank you

0 Kudos
Message 6 of 19
(3,309 Views)

@Stephny wrote:

Is it good what I've done?

 


 

 

The answer depends on does it work the way you want?

 

I don't think you need anything in the initialization state.  If you weren't using the DAQ assistant, I would put DAQmx configure task functions in the init state, and use normal DAQ reads for the other states.

 

Do you want the strain data to be read continuously without breaks in timing?  Right now you read the digital data, when you determine it is high, then you proceed to read 1 second worth of data at 25 kHz.  Then you go to idle and read the digital line again.  If it is still true, you read another 1 second worth of data, but there is a break in time between the first second and the 2nd second worth of data.

 

I don't think you need the state machine.  Put your digital and analog reads in the loop and read continuously.  Put the Log to File in the case structure that is strictly true or false based on the digital signal.

 

The next improvement would be to eliminate the Express VI's and use the lower level DAQmx functions to configure, start, read, and stop the tasks.

0 Kudos
Message 7 of 19
(3,295 Views)

Ok, I changed my program to a while structure with a case structure with 2 cases (writing to file or doing nothing).

 

How can I use a signal from the PFI0 or PFI1 line for selectecting the case (so I don't need an extra module for reading the signal)? So if the signal (from the PFI line) shows a rising edge I want case 1 (writing to file) and if the signal shows a falling edge I want case 2 (not writing to file).

 

Any thoughts?

 

Thank you

0 Kudos
Message 8 of 19
(3,269 Views)

I don't know enough about PFI lines to comment on using them instead of regular digital lines.

 

But don't worry about rising and falling edges.  Turning on with a rising edge and turning off at a falling edge is just a more complicated way of saying you want to log when the signal is high and not log when the signal is low.

0 Kudos
Message 9 of 19
(3,256 Views)

The problem is that I only can use a PFI-signal for triggering another signal. I can't read the PFI-signal alone and use it for activating something else (like a case structure).

0 Kudos
Message 10 of 19
(3,237 Views)