LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

simple question...Referencing channel outputs to each other?

This is probably easily answered, but I couldn't find what I was looking for anywhere.  I am sampling 4 analog input (raw voltage) channels from an NI USB-9215A using LabView 8.2.  I have my DAQmx set up correctly as the first item in my block diagram and from there would like to do the following.  My instrument has 3 specific voltages and a reference voltage.  I need the output data to be the ratio of the reference voltage to each specific voltage for each data point.  So, for my sampling at 10 Hz, I want 3 different values reported every 0.1 sec (one for each ratio, ref/read voltage).  I have tried this with scaling, conversions, etc, but there are never options to include data simultaneously being streamed into the "scaling" equations (ratios) I am trying to set up.  Thanks for any help.

Nick
0 Kudos
Message 1 of 7
(3,356 Views)
why dont you just do the scaling in software?

i.e. read all four voltages, (v1...v4) and then just scale (divide?) the signals by v4 to get your ratio every iteration.

(something like the pic in the attachment?, knocked up very quickly to give you an idea, the VI will not run for obvious reasons)


0 Kudos
Message 2 of 7
(3,351 Views)

Hello Nick,

There is not a way with DAQmx to include another channel in a custom scale.  Instead, it will be necessary to perform the data manipulation in LabVIEW.  The post that nrp made shows an excellent way to get the ratio of voltages from one channel to another. 

Getting Started with NI-DAQmx and Learn 10 Functions in NI-DAQmx and Handle 80 Percent of Your Data Acquisition Applications are great starting points for programming with DAQmx.  Have a great day!

Please post back if you have any questions. 

Regards,
Browning G
FlexRIO R&D
0 Kudos
Message 3 of 7
(3,320 Views)
Alright, I got that to work, but I need the values reported in 3 separate columns (one for each scaled voltage) instead of one column with every 3rd value being the same channel.  Can I get each channel it's own column, along with a x-value column of time starting at zero? I've attached what I have and what I want.  Also attached is the VI I started with where I'm getting the file output I want, I need the new VI w/array to integrate all these components, thought it might help to see.  I have another VI with the array/for loop all set up, this just what I'm working towards.  Thank you.
Download All
0 Kudos
Message 4 of 7
(3,308 Views)

Hello Nick,

Thanks for your reply. 

To make one channel per column in a LabVIEW Measurement File, it will be necessary to perform some additional software manipulation.  Using the VI image provided by nrp, I added some functionality (shown in the following screen shot) that makes a separate waveform for each channel.  This allows for the Write to Measurement File to know how many channels there are.  Make sure that when setting up the Write to Measurement File VI that you select to create “one column per channel” in the X Value Columns section. 



Message Edited by BrowningG on 11-19-2007 03:31 PM
Regards,
Browning G
FlexRIO R&D
0 Kudos
Message 5 of 7
(3,289 Views)
Attached is a jpg of what I have now.  My DAQ assistant is set with samples to read= 1k and Rate (Hz) = 10k.  I am compressing these to deliver data at 10Hz, but I do not see anything on my Signal readout on the front panel.  The axes will autoscale so I know the data is being read, but it won't give lines for a visual readout.  Did I set something up incorrectly?  Also, you can see I'm applying a formula to each channel, does this look correct?  Also, my saved data is coming out how I want it, but for the X-axis column I am getting all zeroes where I want time...it is the correct data in the right intervals (every 0.1 sec) but only the x-axis column is not registering time.  Thanks for the help!
0 Kudos
Message 6 of 7
(3,241 Views)

Hello Nick,

The issue you are seeing with the graph appears to be related to something earlier in your program.  The first Convert from Dynamic Data VI is only returning a 1D array of scalars (the default setting for this VI) where each point in the array is the data from one channel. Because the data has been converted to a 1D array, when you finally graph the data, each channel contains only one point instead of ten points like you expect.  If you choose the 1D array of waveforms option, the output from the Convert from Dynamic Data VI will contain all 1000 points for each channel.  You will need to modify the signal manipulation part of the VI to reflect these changes.  I have modified the image from a previous post that reads multiple samples from multiple channels and saves them to a measurement file. 

It is important to note that whenever data is converted from a Dynamic Data Type, the timing information is lost unless the data is converted to an array of waveforms.  The image below shows how this can be done. 



Message Edited by BrowningG on 12-03-2007 05:31 PM
Regards,
Browning G
FlexRIO R&D
0 Kudos
Message 7 of 7
(3,217 Views)