LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

Custom Scale Input Problem

Hi,

 

I am having problems creating a linear scale for my Analog Input task. I want to scale up the input by 100x, and am creating a custom linear scale to do so. Here is my code:

 

DAQmxErrChk(DAQmxCreateTask("", &task2));
DAQmxErrChk(DAQmxCreateLinScale("cScale", 100, 0.0, DAQmx_Val_Volts, "pA"));
DAQmxErrChk(DAQmxCreateAIVoltageChan(task2, chan, "",DAQmx_Val_Diff, -1000, 1000,DAQmx_Val_FromCustomScale,"cScale"));
DAQmxErrChk(DAQmxCfgSampClkTiming(task2, "", fSamp, DAQmx_Val_Rising, DAQmx_Val_ContSamps, sampsPerChan));
DAQmxErrChk(DAQmxStartTask(task2));

 

However, this isn't working - it just gives the same regular input. I've played around with numbers and found that as long as the scale factor is less than 10 it works okay, as long as my "min" and "max" values are set to -10 and 10. Anything past that just causes it to be unscaled.

 

Any ideas why this could be happening/how to fix it? Thanks!

0 Kudos
Message 1 of 11
(5,332 Views)

Hello nano8874, 

 

Have you tried changing the values of your AI Voltage Channel? Right now you have it from -1000 and 1000, try and change this to a wider range.  

 

Regards,


Regards,
Daniel M.
Applications Engineering
National Instruments
www.ni.com/support
0 Kudos
Message 2 of 11
(5,225 Views)

Hi,

 

I can't increase the range - the maximum range for my device is -10 to 10 V. So the max range for 100x that is -1000 to 1000. If I try to increase it beyond that I get an error.

0 Kudos
Message 3 of 11
(5,208 Views)

Nano8874,

 

When you try to do this same thing on NI MAX, do you get the same behavior? 


Regards,
Daniel M.
Applications Engineering
National Instruments
www.ni.com/support
Message 4 of 11
(5,202 Views)

HI,

I am facing the same problem with CVI.

 

In NI MAX, I can adjust the "Signal Input Range" and the wave comes un-chopped, which seems good. How can I set this property in CVI.

 

AliBaba40_0-1608630372389.png

 

0 Kudos
Message 5 of 11
(2,377 Views)

I can suggest two different approaches to this problem:

 

  1. Create and save the scale in MAX and use is in your code (e.g. DAQmxCreateAIVoltageChan accepts the scale name as the last parameter: there you can specify the scale name you set in MAX). I normally use this approach and never had any problem
  2. Create the scale directly in code by means of some DAQmxCreateXXXScale () function. I have never used this approach but I am confident it will work as well


Proud to use LW/CVI from 3.1 on.

My contributions to the Developer Community
________________________________________
If I have helped you, why not giving me a kudos?
0 Kudos
Message 6 of 11
(2,365 Views)

I have applied both the approaches. The data samples are logged in .tdms file and viewed. The data samples are chopped as shown below. 

 

AliBaba40_0-1608723767849.png

 

However in case of NI MAX, the wave is chopped when the input range is reduced. 

AliBaba40_1-1608725149033.png

NI MAX allows me to set the highlighted values (in the above figure) to higher value than device limits(+-10 V) say 10000 and -10000. 

 

But the CVI gives me an error when I configure:

DAQmxErrChk(DAQmxCreateAIVoltageChan(MY_Task, "PXISlot1/ai0" , "ChnnelNo1" ,DAQmx_Val_Diff , -10000.0, 10000.0, DAQmx_Val_FromCustomScale, "MyScale") );

 

How can I configure CVI to pick the max and min values +10000 and -10000 so that my waveform is not chopped?

In other words, how to set the Signal Input Range in the task (input after scaling)?

 

Thanks.

0 Kudos
Message 7 of 11
(2,356 Views)

Please let me clarify some concept: the fact tat you can set in MAX values higher than ±10V does not imply that you can input in your DAQ board such values! The ±10V limit is a hardware boundary that states the maximum input range that your board can accept and elaborate to output a meaningful value; signals exceeding this range are clipped and ultimately could damage the board (see the overvoltage protection section in AI specifications).

 

So question is: is you signal within the ±10V range (peak-to-peak)? If it is then you can input it in the board and it will return a meaningful measure. After that step, you can map the raw output value to a meaningful scaled measure mapping your voltage value to pair the transducer characteristics.

 

Just as an example, supposing you have a tachometer with 1000 rpm / 10V characteristic, you can create a x100 linear scale and have the DAQ board output e.g. a value of 500 (rpm) for a 5V input



Proud to use LW/CVI from 3.1 on.

My contributions to the Developer Community
________________________________________
If I have helped you, why not giving me a kudos?
Message 8 of 11
(2,349 Views)

My input signal to NI DAQ card is actually pure sine wave of amplitude +2 and - 2V pk.

 

Now the actual signal is attenuated by about 1000V / 1V. 

 

In my calculations in NI, I want the actual values that are around 2000 units peak....

 

 

 

0 Kudos
Message 9 of 11
(2,344 Views)

Even if you set input values to ±10V, you are still using a custom scale ('MyScale') and the diagram is scaled to ±1.2k.

To examine the pure original signal you must set intput range to ±10V and Custom Scaling to <No Scale>: if you are able to see your sine wave signal unclipped then it can be read by the DAQ board, otherwise it exceeds board capabilities. You can also test the signal with a multimeter: it can be measured safely if it is <= 7V RMS



Proud to use LW/CVI from 3.1 on.

My contributions to the Developer Community
________________________________________
If I have helped you, why not giving me a kudos?
0 Kudos
Message 10 of 11
(2,323 Views)