Measurement Studio for .NET Languages

cancel
Showing results for 
Search instead for 
Did you mean: 

Custom Scales

How do I setup a new custom scale in vb.net and set the slope and intercept values to use with a analog input channel?
0 Kudos
Message 1 of 6
(5,468 Views)

Hi,

 

Thank you for posting to the NI forums.  To create a custom scale using the .NET framework, I would recommend referring to the NI-DAQmx .NET Framework 2.0 Help.  Here you will find the documentation on creating a custom scale using the Scale class.

 

In the Contents section, navigate to:

NI Measurement Studio .NET Class Library >>

Reference >>

NationalInstruments.DAQmx >>

Scale Class

 

After going through this documentation, please feel free to post back with any further questions.  Thanks!

 

Ed W.

Applications Engineer

National Instruments

0 Kudos
Message 2 of 6
(5,452 Views)

I am also trying to use a custom scale in VB.Net, I have looked at the help file that you recommended but I cannot seem to find an example allowing me to load a custom scale when I create the task. Could you please provide a brief example of how to do this?

 

Thanks,

Charles

Message Edited by Charles_Chickering on 04-30-2007 05:16 PM

Charles Chickering
Architecture is art with rules.

...and the rules are more like guidelines
0 Kudos
Message 3 of 6
(5,377 Views)

Hi Charles,

 

You can specify a scale that you created in MAX by using the overloaded function CreateVoltageChannel, and supplying the name of the scale (as a string) as the last parameter, as follows.

 

//Create a virtual channel

myTask.AIChannels.CreateVoltageChannel(

physicalChannelComboBox.Text,

"",

(AITerminalConfiguration)(-1), Convert.ToDouble(minimumValueNumeric.Value),

Convert.ToDouble(maximumValueNumeric.Value),

"MyScale_0"); 

 

On the other hand, you could programmatically create a scale and, again, supply the scale’s name to the CreateVoltageChannel function.

 

myScale = new LinearScale("MyLinearScale", 5.0, 0.0);

 

Besides creating a linear scale, you can also create a polynomial, range map, or table scales.  This is all documented in the NI-DAQmx .NET Framework 2.0 Help.

 

Best regards,

 

Ed W.

Applications Engineer

National Instruments

0 Kudos
Message 4 of 6
(5,351 Views)

Ed,

Lets take this one step further.  If I have a custom scale, must it apply to all channels I am using? What would the code look like to use one scale for channel 0 and  a different scale for channel3?

0 Kudos
Message 5 of 6
(3,747 Views)

Hello tpVBuser,

 

This forum thread is over 6 years old. I would suggest that you create a new thread, which will be looked at by more people, and will get you a quicker answer. I do not know the exact code to do what you are asking, but I know it is possible to make custom scales for each channel, similarly to how you would using the NI-DAQmx drivers. 

Matthew R.
Field Applications & Systems Engineer
National Instruments

Certified-LabVIEW-Developer_rgb.jpg

Certified-TestStand-Developer_rgb.jpg


0 Kudos
Message 6 of 6
(3,722 Views)