Analog outputs

In this tutorial, we are going to demonstrated how to use different modes of analog outputs.

Since some analog outputs are able to measure resistance, we will demonstrate how to directly transform measure values of resistive thermometers into temperature.


  • UniPi controller running Mervis OS
  • Basic project with attached controller a program in FBD mode
  • Knowledge of how the analog outputs work on UniPi units

In this tutorial, we will use Unipi Neuron L503.

The different analog outputs have different modes of operation, see Analog outputs. Change between modes in Mervis is done by configuring the UniPi module, therefor the changes in modes cannot be done in the program and the program has to be stopped during the configuration.

The default mode of each output is “Voltage” and the output value is set to 0V.

The changes are done on the prototype of the PLC or Extension. Double click on the prototype in the Left panel. The list of all available inputs and outputs will show up in the Main Window. Search for “AO_” and you will be presented with the list of all Analog outputs.

As you can see, for each physical Analog output you have two properties available: AO_X.Y_r and AO_X.Y_w. The one with suffix _w is for writing the values to the output. You will use this variable almost exclusively. The property with suffix _r is for reading back the current value set on the output. To change the mode, select appropriate “write” variable, head over to the Properties panel and select the desired mode in the “Analog Type” property.

We just changed the configuration of the PLC modules, which is not applicable by simply uploading the solution. To save the configuration, follow the UniPi - Configure Module tutorial.

Setting the output values for both Voltage and Curent modes is the same. Once you set the correct mode, you can just simple write a real value to the variable. As we learned before, the correct variable is called AO_X.Y_w depending on the Group (number X) and the position in the group (number Y). To include this variable into the program, you need to Set Autogen. After that, you will see the variable in Variable Browser and you will be able to change it in the Debugging mode.

When setting the value of AO_X.Y_w in Voltage mode, the value you enter is in volts (value 1.234 = 1.234V). When setting the value in Current mode, the value you enter is in miliampers (value 3.145 = 3.145mA)

The analog outputs can have a default value, which will be automatically set after starting the PLC. This functionality is for ensuring, that the connected technology will work right after the start of the PLC and not waiting until the Mervis Solution kicks in.

The default value is configured in the properties of the “write” variable for given input. The procedure is the same as with setting the mode of the output. Double click on the prototype in the Left panel, look for the desired variable, select it and in its Properties panel change the “Default value” to the desired one. The value is the same you would write to the variable itself. So for Voltage mode it is a float number in volts, for Current mode it is float number in miliampers.

And as with other changes to the configuration of the modules, you need to apply the configuration as we did above.

The analog output on Group 1 of Neuron and Axon (AO_1.1) is able to measure resistance as well. To set the AO_1.1 to the Resistance measurement mode, follow the configuration steps above.

The resistance measurement is mostly used for measuring resistive thermometers such are Pt100, Pt1000, Ni1000,… Those sensors have known temperature vs. resistance curve and Mervis can directly transform the measured values into degrees of Celsius. This transformation is done on the property of the “write” variable, as with all the previous changes. Look for the property “Transform” in the Properties panel. The default value is “identity”, which means the variable will always contain the measured resistance in Ohms. You can change the transformation to “ResistanceToTemperature” and box with other options will appear underneath. All you need to do is to change the “Kind” to the type of the resistive thermometer you are trying to read from. You can leave all the other parameters as is. And as with all the changes to the configuration of the PLC, apply it as we did above.

Note: apply the transformation only to the analog output read data point (AO_x.xx_r), not to write (AO_x.xx_w).