Current location - Plastic Surgery and Aesthetics Network - Plastic surgery and beauty - What is the function of integer in PLC and what is it used for? Let's talk in a popular way! The great god knelt down and begged
What is the function of integer in PLC and what is it used for? Let's talk in a popular way! The great god knelt down and begged
Perform arithmetic operations such as addition, subtraction, multiplication and division on data. Integer is 1 word (2 bytes), which means any integer between -32768 and -32767. It takes up the same space as word data, but the difference is that integer can represent negative numbers, such as -235, or positive numbers, such as 32 12. These are the basic knowledge in the computer field, and the integer depends on the type, but it is general. For example, the integer of 16 bit machine is 16 bit, with two bytes. A 32-bit machine is 4 bytes. And integers of type int64. The same concept exists in PLC. The data used in our life and work can be divided into binary, octal, decimal, hexadecimal and so on. In order to facilitate all kinds of mathematical statistics and calculations and solve the laws of natural operation by mathematical methods.

And PLC is an electronic device made by solving these laws. For example, BOOL quantity (bit) can be used to unlock the on-off and on-off changes of external states (0 and1); The number of bytes (8 bits) can also be used to represent the calculation of simple data and characters of positive integers less than 255 (decimal). This is the data representation law of computer, which is related to the design principle of computer. And PLC is also a kind of computer.

Take Siemens 200PLC as an example. For example, a byte of data in the V storage area is 8 bits, and this byte is represented by B, then the address of this byte is VB, such as VB 100, which is a byte of data. The data address is in the V storage area 100, which contains 8 bits, namely V 100.0 ~ V65438+. A word (integer) is represented by W, so for example, VW 100 is a word and consists of VB 100 and VB 1 0/,and a double word (double integer) is represented by D and consists of two words, such as VD/kloc-0.