# Detailed explanation of analog programming of Mitsubishi PLC and Siemens PLC

Both Mitsubishi and Siemens PLCs have their own unique advantages. Let’s talk about the Mitsubishi 2AD module first. The 2AD module provides a 12-bit resolution module. The largest number is 4096. This 4096 follows the What is the relationship of 12-bit resolution? 12 binary 1s are 4096. Of course, the largest digital quantity 4096 can be adjusted by the gain potentiometer on the 2AD module.

I will take a PT100 temperature sensor at 200 degrees as an example. The analog current corresponding to 0 degrees of this sensor is 4mA. The analog current corresponding to 200 degrees is 20mA. The first step is to calibrate the gain and offset of 2AD The so-called gain and offset are actually the digital quantities corresponding to the analog current 4mA and 20mA. We use a current generator to generate a 20mA current, and then connect it to the analog current input terminal of 2AD. After the PLC is powered on, find the data register corresponding to the analog quantity to see the current value in it. Maybe the data in it is an unknown data. This is because the 2AD was not adjusted to a standard when it left the factory, so we adjust the gain potentiometer. Let the digital quantity be 4000, why should it be adjusted to 4000? Because the range of the temperature sensor is 200 degrees, they are just a 20 times relationship. The next step is biasing. Adjust the current generator to output a current of 4mA, depending on the number of digits in the data register. If the digital quantity of the data register is 0, then we don’t need to adjust it. After the gain and offset are adjusted, the sensor is connected to the actual detection. The program in the PLC needs to use the division command, because the data in the data register must be divided by 20 to get the actual temperature. Of course, this is not enough because in many automatic control systems The occasion requires very precise temperature, so the floating-point number conversion instruction and floating-point number division instruction are used. Mitsubishi’s floating-point number can retain 3 decimal places, that is, 0.000 degrees.

Special attention should be paid to the fact that the above analog functions can be completed, but the temperature changes we see are very fast. This is because the PLC performs an analog acquisition and analog calculation every scan cycle. It is very fast, usually it is executed once in 20ms, so the number inside changes very quickly. In this case, we require the average value. The specific method is to use the accumulation instruction to divide the accumulated data by the number of accumulation times. Can. Generally, the accumulation times are between 5 and 10 times.

The analog quantity of Siemens is different from that of Mitsubishi. Its resolution is higher than that of Mitsubishi. Siemens EM231 provides aThe maximum digital quantity of a 16-bit resolution module is 32000, which is the capacity of one word. Siemens’ analog quantities are also different from Mitsubishi in terms of usage, because Siemens does not have gain and bias adjustment potentiometers, and all corresponding digital quantities are calculated by formulas. Even so, Siemens’ program modularization is much simpler in program design, and the original data can be obtained directly in the AIW data register.

Let me briefly talk about a 200-degree sensor. The analog current output by this sensor is 4 to 20mA, and the digital value of Siemens is 0 to 32000. If you follow the algorithm of Mitsubishi, it will be wrong, because 4mA is not the corresponding digital value. 0 instead of 6400, because they are 1600 times the relationship, 4mA multiplied by 1600=6400, so we have to find a coefficient of the digital quantity 6400 and 32000 and the temperature 200, the specific formula is this (32000-6400) divided by 200 =128. This 128 is their coefficient. If the temperature sensor is 400 degrees, divide it by 400.

Finally, we divide the data in the AIW data register by 128 to get the current temperature. It should be noted that the analog value of Siemens is best in the interrupt program.