LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Reading the output of a written continuously sampling DAQmx task

Solved!
Go to solution

Hi,

 

I am trying to use this digital output module to switch a pump on and off, I have successfully implemented this using the DAQmx write, in a loop.

 

I would like to know when (I will later be writing this data to a TDMS file), the pump has been switched on and off.

 

Using this previous post, I have tried to follow the DAQmx write with a DAQmx read, but this doesn't seem to be working correctly.

https://forums.ni.com/t5/LabVIEW/How-can-I-read-what-I-wrote-to-a-DAQmx-digital-output-channel/td-p/...

 

I am not getting any errors, just not the expected output from the DAQmx read the sampling rate seems ok for the module.

 

(Using LabVIEW 24 (64bit) CRio 9055 with a NI-9476 Digital output module)

0 Kudos
Message 1 of 4
(122 Views)
Solution
Accepted by topic author R.jon8s

Hi R,

 


@R.jon8s wrote:

I would like to know when (I will later be writing this data to a TDMS file), the pump has been switched on and off.

 

Using this previous post, I have tried to follow the DAQmx write with a DAQmx read, but this doesn't seem to be working correctly.

https://forums.ni.com/t5/LabVIEW/How-can-I-read-what-I-wrote-to-a-DAQmx-digital-output-channel/td-p/...


Why do you need to read from the DAQmx channel when YOU KNOW what you wrote to that channel???

Simply write to your TDMS file in the same part of the code where you write to the DAQmx task…

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
Message 2 of 4
(108 Views)
Solution
Accepted by topic author R.jon8s

Hello, @R jon8s.

 

     You write that you are using a DO Module to switch a pump on and off, and want to know when the switch happens.  You don't do this with (directly) with DAQmx, but instead use the LabVIEW Timing Functions to tell you the Time (in a format you choose, probably "Human-Readable", and incorporate this into a "message" that you write to a file, put in an Indicator, float as a brief Pop-up, or whatever, that says something like "Pump on, 19 Sep 2024, 14:23:48".  You could even write this to a text file to keep a log of the pump switching.  You'd put this in the routine that turns the pump on and off (using DAQmx) -- it would add a few milliseconds (microseconds?) to the loop time, probably trivial.

 

     One other note -- like many long-time LabVIEW Users, I don't purchase and install every version of LabVIEW (especially if my colleagues aren't using them, as version-compatibility is often more important than the latest features).  Accordingly, when posting code, long-time users such as I won't be able to open your VI unless you do "Save for previous version" and specify LabVIEW 2019 or 2021 (these seem to be the most common requests on this Forum).

 

Bob Schor

Message 3 of 4
(105 Views)

Hi Gerd & Bob,

 

Thanks for both of your suggestions.

 

I have gone with the approach of reading the variable that I use to write the DAQmx task. Principally because this aligns better with how I am saving the rest of my data.

 

Apologies about the wrong version, I thought that I had managed to save to 16.0.

 

Cheers

0 Kudos
Message 4 of 4
(66 Views)