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 scaling and input error

Solved!
Go to solution

I have a USB 6211 device configured in MAX for 11 different channels: the first 10 channels are setup with a scaling factor of 2 while the last channel is configured with a scale of 1.  I connected 9 V battery to the first two channels, ai0 & ai1, ( scale of 2) and the last channel, ai10, (scale 1). The input pins were 15, 17, and  20 for the voltage inputs with pin 28 connected as ground. Then I checked the functionality in MAX.  Surprise! I expected to see 18 volts for the first two channels and 9 volts for the last channel, but much to my surprise I got all the channels showing data of around 10.86 volts and the last channel showing a value of 7.79 volts!  How come I'm seeing values for the unconnected channels! Furthermore, why are the values in the wired up channels so screwed up! With a 9 V battery and a scale of 2, I would expect to see 18 volts, not 10.86, and where did the 7.79 volts come from for the channel that has a scale of 1!  If I run MAX in continuous mode instead of N Sample mode I get some other strange results: I get one horizontal line and 1 sinewave!!  This is amazing since I have a 9 volt battery connected to the device! I won't even get into what the charts in the VI that uses these signals looks like since they are all screwed up.  Please advise me on this one as I am completely perplexed.

0 Kudos
Message 1 of 13
(4,401 Views)

Well today I used the same code on a different laptop with the USB 6211 device connected up and ran MAX once again. For some unknown reason the channels configured in MAX with scale factors of one and two show up exactly as expected! The unwired terminals show values that float all over the place near the values of the teminals that are wired! If I ground the unused teminals obviously the signal levels go to zero, so there must me some sort of crosstalk between channels.  Now I go back into the VI that uses these signals and find that all the signals coming out of the DAQmx Read (Multi-Chan Multi Sample 1D Wfm) vi are all showing unscaled values: they are all scaled  by 1 which is not what MAX showed! What is going on here?

0 Kudos
Message 2 of 13
(4,379 Views)

 

After nosing around through the various DAQ VIs that I am using in my code to show scaled voltages made in MAX I noticed from the help information for the DAQmx Create Channel (AI-Voltage-Basic) VI there is a little known part of the description of this VI that describes an input to create a custom scale name. The help says to set units to 'From Custom Scale'  and put in the custom scale name into that terminal. Could this fix my scaling problem?  I am going to try this out and see if this is true.

0 Kudos
Message 3 of 13
(4,377 Views)

Aftergoing into the DAQmx Create Virtual Channel VI and selecting 'FromCustom Scale' for the units terminal and then at the custom scale name terminal, I added in the names of the custom scales configured in MAX. This sounded reasonable, so I ran the code.  Now I have an error -200447,

Possible reason: Units for the channel most be set to 'From Custom Scale' when a custom scale is used with the channel.

I since I named the scales in the custum scale name the same as the custom scales made in MAX this sounded OK.

Property: AI.Voltage.Units , Corresponding value: Volts

Appropriate value: from custom scale, channel name/ Temperature

Property AI.CustomScaleName, Corresponding value: TemperatureScale

Can anyone decypher what is going on here?

0 Kudos
Message 4 of 13
(4,369 Views)

Now the scaling seems to work. I went into the DAQmx Create Virtual Channel VI, and after researching the documantation on this VI I noticed there were inputs for custom scale name and units. The units input gives the user the option to select 'From Custom Scale' which I chose and entered the custom scale names created in MAX and now the plots and data coming out of the DAQmx Read VI is actually scaling to the same scales as set up in MAX.  For the most part!  When I input an input that is scaled by 2 with the input voltage range of from 0 - 5 VDC the waveform data shows up with the correct values of 0 -10. So far so good! However, when I input a VDC of 7 VDC the output data is is ok for the scaled by 1 channel, but for the scaled by 2 channels the voltage output is 10.86! Not 14 VDC as expected! So while I'm trying to figure this one out maybe someone can tell me what is going on here.

0 Kudos
Message 5 of 13
(4,359 Views)

Hi hounddog, I believe that the source of the error (200447) lies with the DAQmx AI Voltage VI that is downstream of your DAQmx Create Scale VI. On the AI Voltage VI, there is an input labeled "Units". I believe that the error is being generated because you have a custom scale, but have not indicated on the DAQmx channel where to get the units. In order to correct this, right click on the "Units" input on the AI Voltage channel and create a constant. Once created, click inside the constant and set the value to "From Custom Scale." This should eliminate the error that you are experiencing.

 

 

Yupeng J.
0 Kudos
Message 6 of 13
(4,358 Views)

thanks for info. I did go into the create virtual channel VI and did select form custom scale and added in the scale names that were in
MAX and the thing did start up with the correct scaling when I input a signal between 0 - 5 VDC the thing workd perfectly.   However, when I input 7 VDC I don't get 14 VDC but instead get a value of 10.86 which is a lot different than the 14 VDC that I expected!  Any thoughts on that problem?

0 Kudos
Message 7 of 13
(4,353 Views)

Are your analog input channels set to a range that has 5V as the maximum? Examples: -5V to +5V or 0V to 5V as teh range? THat may be why id does not work for anything over 5V.

 

-AK2DM

~~~~~~~~~~~~~~~~~~~~~~~~~~
"It’s the questions that drive us.”
~~~~~~~~~~~~~~~~~~~~~~~~~~
0 Kudos
Message 8 of 13
(4,349 Views)

What do you have set for the input range? If you have a x2 scale, then you should set the min/max x2 as well. If you left it at the default of +/- 10, then the actual range of the DAQ will be set for +/-5 volts so an input of 7 would be clipped to the maximum.

0 Kudos
Message 9 of 13
(4,347 Views)

I set up the range for the 2X scales to +20 & - 20 VDC  and left the +10 - -10 for the scale 1X channel and now MAX does show the correctly scaled voltages! Even with the inputs over 5 VDC.  Nowever, there is one item left to resolve: the data taken out of the DAQmx Read (Multi-Chan Multi-Sample 1D Wfm) vi is still showing values that are not the same as displayed in MAX!! MAX is now showing 0 - 18 VDC for inputs of 0 - 9 VDC at 2X scale, but the data seen be the probe tool shows data that is still maxed out at 10.86 VDC for a voltage input of 7 VDC on the 2X scaled channels!! This definately is strange!

0 Kudos
Message 10 of 13
(4,331 Views)