kk logo

Analog inputs are needed to read sensors for temperature, level, distance and much more. The Coolmay L02ML24T/R has 4 analog inputs that can read 0-10 volts. These 0-10 volts form a value between 0 and 4095, which the PLC can then calculate with. For my example, I connected a 10 k.Ohm to the PLC and read it out with the Melsoft GX Works 2.

To change the 24VDC to 10VDC I used a 10 k.Ohm resistor. Since the potentiometer is a voltage divider, VCC and GND are connected and the output of the potentiometer is connected to input AD0.

1 Coolmay GX Works 2 LADDERFBD analog input

The analogous functions can be found either in the selection bar or on the right with the elements.

2 Coolmay GX Works 2 LADDERFBD analog input

Both times it's the same functions, one time you have to type them in yourself, whereas they are on the right with the element with abbreviations.

4 Coolmay GX Works 2 LADDERFBD analog input

With analog functions, you must always pay attention to the correct "value" or the correct variable. There are several ways to query the analog input. In the example below, the same AD0 is always queried, but always with a different "abbreviation".

  • Via a global variable, which I called "analogue" here
  • Via the abbreviation D8030
  • Via the abbreviation %MW0.8030

In the online mode below you can see that it is always the same value. The next analog input is then the D8031 or %MW0.8031.

3 Coolmay GX Works 2 LADDERFBD analog input

If you want to query the analog input via a global variable, you must create a variable of the type "Word unsigned", enter D8030 as "Device" and %MW0.8030 as "Address".

6 Coolmay GX Works 2 LADDERFBD analog input

In online mode you will then see that the value of the analog input is always the same. Since the input is a "Word", the analog value can be read directly in many cases, for example with GT (greater than) or LE (less than). If you want to calculate with this value (here ADD) you need an integer variable. The "WORD_TO_INT" function is required for this.

8 Coolmay GX Works 2 LADDERFBD analog input

In order to display the whole thing on the Coolmay HMI, it only needs two "lamps" and two "number fields".

9 Coolmay GX Works 2 LADDERFBD analog input

Create a new folder for "TAG" and then enter the appropriate digital variables.

10 Coolmay GX Works 2 LADDERFBD analog input

 Enter the same for the analog variables and you're done.

11 Coolmay GX Works 2 LADDERFBD analog input

The whole thing should then be displayed on the HMI. When turning the potentiometer, the two values should change and the lamps should come on one after the other.

12 Coolmay GX Works 2 LADDERFBD analog input

King of my heart

Let the King of my heart
Be the mountain where I run
The fountain I drink from
Oh, He is my song

Ronnie

schwäbischer tüftler und bastler, kraftsportler, ADHS power, 43 Jahre, 1 Frau, 5 Kinder und 1003 Ideen. 

ronnie berzins at mee