LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

write only active channel channel

How can I write an active channel as a header?  For example, I have a pressure sensor connected to AI0 and one connected to AI1.  Now, I only want to record data corresponding to the sensor being pressed.  If I press the sensor connected to AI0, then I want to write
 
AI0
voltage data.
 
If I press the sensor connected to AI1 then I want to write
 
AI1
voltage data.
 
Currently my program writes both headers regardless of the signal.  For example, I have a sensor connected to AI0 and nothing connected to AI1 and my output is:
 
AI0    AI1
 
My code is attached.
 
Thanks,
Chris.
0 Kudos
Message 1 of 4
(2,763 Views)
If you still have both AI0 and AI1 defined in your DAQmx Task then what you see makes sense. Your getting an array of channels in that task (AI0, AI1) and then indexing through the array and converting each channel resource name to a string. So your looping twice, once for each channel and outputting just what your seeing..."AI0" and "AI1".

I'm not sure why you used the "ActiveChans" property but based on what you described, you need to do a DAQmx Read to see on which channel you get sensor data and then write your header based on that, i.e., AI0, AI1 or both.
0 Kudos
Message 2 of 4
(2,754 Views)
Thanks, Bill.  I gave it a try, but I'm new to LabView and still struggling my way through.  I defined ai0, ai1, and ai2 in the DAQ Assistant, and I have a 1.5 V battery attached to ai0.  The trigger records any signal that goes above 1.5V, but unfortunately I'm still getting all 3 signals.  I've attached my program.
 
Any help would be greatly appreciated.
 
Thanks,
Chris.
0 Kudos
Message 3 of 4
(2,736 Views)

Hi Leberkc,

From your original post it sounded like your final goal was to only acquire data when a certain voltage was met. If this is the case, then the easiest thing to do would be a little bit of analysis to ensure that acquired values that do not meet the minimum voltage threshold are filtered out and not written to the array/waveform graph that you are outputting.

Best regards,

Jordan D
Applications Engineering
National Instruments
0 Kudos
Message 4 of 4
(2,724 Views)