09-18-2024 08:40 AM
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.
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)
Solved! Go to Solution.
09-18-2024 08:47 AM
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.
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…
09-18-2024 08:54 AM
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
09-18-2024 09:46 AM
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