# 4.3 - Conversions Vs. Direct Expressions

In the previous section we displayed the voltage reading from our analog input channel. However, in most cases you really want to view your data in more appropriate units than volts. With pressure, for example, you might want PSI or millibar. There are two ways you can convert your data into different units.

The first way is to simply put the desired formula in the Expression area of the component properties. So, if you had a 0-5V pressure sensor with a range of 0-500 psi, you would put:

Pressure[0] * 100

to convert your voltage signal to PSI. You would also, of course, probably want to change the unit display. You can put much more complicated calculations as well, even ones based on multiple channels. DAQFactory supports a wide variety of operators and mathematical functions to make this easy. They are all listed in the Expressions chapter of the DAQFactory help.

Entering formulas directly into the Expression area of a component is handy because you can create another component to display the same input reading in different units. If, however, you always want your reading in particular units, you can instead use Conversions. This has the added benefit of allowing you to log your data in these units. Using our pressure example and a 0-5V : 0-500psi sensor, here is how you would create a conversion to put the readings into PSI:

1) Click on CONVERSIONS: in the Workspace.

This will display the conversion table.

3) Give the conversion a name, say VoltsToPSI

4) In the Expression column put: Value * 100

You'll notice that we used the word "Value" instead of the channel name in the conversion's expression. This allows a single conversion to be used on multiple channels. The actual channel reading is substituted wherever "Value" appears in the formula.

5) Click Apply to save the new conversion.

6) Click on CHANNELS: in the Workspace to bring up your list of channels.

7) In the row with you Pressure channel, go over to the column labeled Conversion and select VoltsToPSI.

8) Click Apply to save your changes.

If you then go back to Page_0 you will see that your values are now 100 times their previous size.

Note: just to reinforce this: Value is a keyword and not the name of a channel or variable. When you apply the conversion to the channel, that channel's current reading is substituted where Value is found in the conversion.

Sample file: LJGuideSamples\Conversions.ctl