You can create scales to specify a conversion from the prescaled units measured by a channel to the scaled units associated with your transducer or actuator. For input channels, the scale converts samples read to the final scaled units. For example, a scale could convert a voltage to a linear position. For output channels, the scale converts samples written to the prescaled units of the channel. For example, a scale could convert a linear position to a voltage. You also can use scales to calibrate samples read or written so that the final scaled units are identical to the prescaled units of the channel.
Often, you do not need to create a scale because NI-DAQmx has explicit support for many of the most common transducers, sensors, and actuators. For example, when creating an analog input temperature channel, you can specify the type of transducer (for example, thermistor, RTD, or thermocouple) used to make the measurement when creating the channel. However, if NI-DAQmx does not explicitly support your transducer or actuator, you can create a scale that specifies how to convert from the prescaled units to the scaled units. You can associate the same scale with multiple channels. You do not need to create a scale for each channel if the scale is the same. After a scale is assigned to a channel, the scale applies to all attributes normally expressed in the prescaled units of the channel. For example, if a custom scale, which converts volts to meters, is assigned to a voltage channel, the channels minimum and maximum attributes are expressed in meters.
Prescaled refers to values expressed in the unit of the channel prior to the custom scale being applied. Usually, these prescaled units are volts or amps since scales are most often associated with channels that natively measure or generate signals using these units. However, it is possible to associate a scale with a channel that contains a transducer explicitly supported by NI-DAQmx. In this case, the prescaled units are the units of the channel including the explicitly supported transducer. For example, you can create a analog input resistance channel and associate a scale with this channel. In this example, the prescaled units would be ohms and the scale would specify how to convert from ohms to the desired scaled units.
Scaled refers to values expressed in the final unit after NI-DAQmx applies the custom scale. For example, a linear-position-to-voltage scale is assigned to a voltage output channel. In this case, the prescaled samples are in volts while the scaled samples could be specified in meters. Scaled units are the units that are most convenient for your application. You have complete control over the scaled units when specifying your scale. The scale specifies the conversion from the prescaled units of the signal measured or generated by the channel to your specified scaled units. When you read samples from a channel associated with a scale, the samples are in scaled units. Likewise, when you write samples to a channel associated with a scale, the samples are in scaled units.
You can create scales in the DAQ Assistant or programmatically. When you programmatically associate a scale with a channel, you must set the custom scale name attribute/property to the name of the scale and set the units attribute/property to From Custom Scale.
Imagine that you have connected an analog output voltage channel to a motor whose speed is proportional to the generated voltage, and you want to create a scale that specifies this conversion. The prescaled units in this case would be volts and the scaled units could be revolutions/minute. You would then specify the equation, table, or map that converts from volts to revolution/minute. After you have created this scale, you would associate the scale with an analog output voltage channel. Now, rather than having to convert between volts and revolutions/minute when operating your application or having to develop additional code in your application to perform this conversion, you can simply write samples in units of revolutions/minute directly to the channel associated with the scale and NI-DAQmx automatically performs the specified conversions. Scales can simplify your code and improve the usability of your application.
Some scale types allow scales that do not monotonically increase or decrease. This is problematic because application of the scale may not produce the desired results. For example, if multiple prescaled values map to the same scaled value, the conversion from the scaled value to the prescaled values is ambiguous. The conversion is well defined and predictable even in these cases. While not disallowed, non-monotonically increasing scales should be avoided or used with caution.