Measurement Studio for .NET Languages

cancel
Showing results for 
Search instead for 
Did you mean: 

Custom Scale for NI-DAQ using C#

I'm trying to use a custom scale (linear) for a few of the channels I'm reading in from a USB-6009 in c#. All of the examples I find are in labview. I've written the code but only seem to get the prescaled values to save. Any help would be greatly appreciated.

 

private LinearScale myCustomScale;

double scale_m = 60;

double scale_b = -150;

myCustomScale = new LinearScale("CustomScale", scale_m, scale_b);

myTask.AIChannels.CreateVoltageChannel("Sim/ai1", "", (AITerminalConfiguration)(RSE), 0, 5, "CustomScale");

0 Kudos
Message 1 of 3
(3,760 Views)

Hi,

It looks OK but the min and max parameters must be in the scaled units. If your input voltage range is 0-5 V your scaled range is -150-150:

 

myTask.AIChannels.CreateVoltageChannel("Sim/ai1", "", (AITerminalConfiguration)(RSE), -150, 150, "CustomScale")

 

Untitled.png

BR,

Ilkka

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

That worked! THANKS!!!

0 Kudos
Message 3 of 3
(3,713 Views)