How Do I Program Analog Signals?

The Data Memories of analog modules must first be completed. This can be done in CX-Programmer through the I / O table by double clicking on the type of unit. This is necessary to indicate which entrances and exits are active. (For further settings see Operation Manual)

The first analog values are entered at address CIO n +1, the second on CIO n +2, etc. The first analog output is driven by CIO n +1 a value (see below). N CIO address must be enabled for high bits, to start the conversion and output driven.
N 9 at  contact CIO, the alarm and the disconnection bits. These can be read into the program eg to detect the connected sensors are present.
What to do with the data?

When using analog input and output modules, analog input signals are converted to a hexadecimal number between 0 and FFF and an analog output signal is a hexadecimal number from 0 to FFF converted to an analog signal. We go from a resolution of 12 bits (4000) There are converters with another resolution, but for processing the signals it makes no difference. Positive and negative signals (eg-10V to +10 V) have to do with a signbit. (For conversion dates See Operation Manual)

This means that we must treat the data as hexadecimal (binary) numbers and therefore those commands, which are suitable for binary processing.

CX-Programmer has the capability for binary values shown in decimal numbers. This makes it easier to work with binary instructions. If you are working with decimal numbers, then the incoming and outgoing values are converted. This one uses the command BCD (024) for conversion of binary (HEX) to decimal (BCD), when setting analog input values, and the command BIN (023) for conversion of decimal (BCD) to binary (HEX), the conversion to analog outputs.

It is also dependent on what you want to do with values. If  the incoming signals are level or temperature values, for example, then they must be at a maximum or minimum level, in this case use the comparison commands (eg CMP (020)). If the data is Should the data be stored, for example, to conduct a process to analyze, then use the movement instructions (eg MOV (021)).

The converted values are between 0 and FFF in binary processing or 0 to 4095 in decimal processing (assuming 12-bit resolution). One can also scale these signals, such as pressure, temperature or level measurement, in order to get the exact value (0-10bar, -50 / 50 degrees). This one uses the "Scaling" instructions SCL (194), SCL2 (486) and SCL3 (487).

With the APR (069) command you can make a 12-point chart. This can be a level measurement into a volume of a non-legal barrel. (see illustration).

In fact, there are many more commands, which can be used, but these are the most common.