Analog inputs

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



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

In this tutorial, we will use Unipi Neuron.

The different analog inputs have different modes of operation, see Analog inputs. 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 input is “Voltage”.

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 “AI_” and you will be presented with the list of all Analog input.

To change the mode, select appropriate variable from the list, 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.

Reading the input values for all modes is the same. Once you set the correct mode, you can just simple read a real value from the variable. The variable is called AI_X.Y 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 read it in the Debugging mode.

When reading the value of AO_X.Y in Voltage mode, the value is in volts (value 1.234 = 1.234 V⎓). When reading the value in Current mode, the value is in miliampers (value 3.145 = 3.145 mA). When reading the value in Resistance mode, tha value is in ohms (value 1012 = 1012 Ω)