From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

DAQ read

I have an application in which I created a DAQmx task to read few pressure sensor. I am using USB-6225 and AI 0 - 60

to read all pressure and vacuum sensors. It is inside the state machine where I have scan state which executes the DAQ assistant vi to scall all the channels, then I move to scale state where I scale the voltage to respective pressure and vacuum and store in two different array one as pressure data and one as vacuum data. Next state is check threshold where I use a threshold_peak_deteck.vi because only one channel will trigger at a time and it should go from -12psi to +32psi. So I have my threshold setup at +1psi and when I detect that I want to read just that particular channel follow it till it reaches +32psi and stays within a limit for some timeout and continue the same for other channels.

 

1) Is it possible to dynamically change the AI read DAQ to let the DAQ know that I want to read this channel on fly

 

THanks

0 Kudos
Message 1 of 3
(2,305 Views)

THe first choice would be to read from all of the channels all of the time and only pay attention to the reading you care about at that time.

 

Another approach would use multiple DAQmx tasks but only start the one required at the moment.

 

Ben

Retired Senior Automation Systems Architect with Data Science Automation LabVIEW Champion Knight of NI and Prepper LinkedIn Profile YouTube Channel
0 Kudos
Message 2 of 3
(2,290 Views)

Thanks for the reply. I am doing the first approach now.

1) "Scan state" - Use DAQ assitant to scan AI 0 - 60 from my DAQ

2) "Scale state" - scale all voltage to respective pressure and vacuum (PSI) and store in two array one as pressure sensor data and one as vacuum sensor data

3) "Check pressure state" -  Used threashold_peak_detect viwith pressure sensor data as an array input and 1psi as threshold. When the trigger happens I use that particular index to read a particular data from pressure sensor data array

4) "Check vacuum state" - read the vacuum sensor data 

5) "continue scan state" - jump to step 1

 

The problem I am facing right now is I am not able to calculate the pressure flow rate as my pressure changes so fast. In my application as the trigger happens I check and see when my pressure reaches 2psi and I take a capture of current time using get_date_time.vi and store it in local variable start time  and when it reaches 32psi I get an another capture of current and this time store it in end_time variable. When I know that pressure reaches 32psi and stays within some threshold for some time I calculate the flow rate using delta pressure/delta time and most of the time I get INF value. I thought this action was becuase I scan all the 60 channels in scan state and scale each one of them in "scale state" and process just one data from the entire array using the index from threshold_peak_detect.vi in check pressure state.

 

2) I can define each channel as a seperate task but how would I choose which channel to read at run-time and how would I pass that argument to AIread_DAQmx block. It doesn't take any integer or unsigned_8 as input for me to tell read this channel. I can form an task constant array and use some indexing logic to address this issue.

 

What I wanted to do is go through step 1 and step 2 and in step 3 when I find the trigger just be in a while loop reading that particular channel until I met all the condition to stop or timeout.

 

Thanks

 

0 Kudos
Message 3 of 3
(2,275 Views)