PLC Programming-3

By IKTech May 29, 2017

Today you will see how Numeric data is used in PLC.

Numeric data in PLC

Most PLLs need to control application data. This is usually achieved in the counter and timer’s value. After reading the data from a particular function module it is then processed through informational or high-level mathematical computations. It is very difficult for a programmer to understand how a PLC can view and manage different types of data.

At the end of this lesson you can find out what:

* A PLC can handle the integer and decimal digits.

Integer integration

One very important fact is that PLC only handles integer data by default. This means that it can see only 1, 10, -2 of all numbers. PLC 3.14159 can not identify broken numbers. Trying to type such a number will cause an error. If the result of a mathematical operation is divided by 5 by 3, if the result is 1.667, then plc drops a decimal point and gives a result of 1. Note here that in this example, on the basis of the mathematical interaction, the data registers according to the register of data is deposited as 2.

16 bit number

Integers are 16 bits in PLC numbers. If it does not, otherwise it is announced by programming. We can go back to the binary number reading, this means that the numeric range for integer is 0000 0000 0000 to 1111 1111 1111 1111. Changing it to decimal, the integer range for PLC is 0 to 65,535.

The integer range is actually + 32,767 to -32,768. For this reason the bit that is at the far left (bit 15) is used as a sign bit by PLC. This bit is also known as the Most Significant Bit (“MSB”). If MSB is “1”, the number is negative. If MSB is “0” then the number is positive. So the actual largest positive number is 0111 1111 1111 1111 which is 32,767. If the program progresses to 32,767, it goes up to 32,768. If the program goes down a number below -32,768, it goes to 32,767.

1000 0000 0000 0000 = -32,768 Why is this like this?

To display negative numbers in PLC, using a contact as two’s complement in a numbering format. Easy to calculate the supplement of the two

1. Convert all 1 K 0 and 0 to 1. This new number is known as supplement.

2. Adding 1 number to the number.

0111 1111 1111 1111 This is 32,767.

1000 0000 0000 0000 This is supplementary (not included in the sign bit supplement, but 1 is required with this number to create negative numbers).

+ 1 1 is added.

1000 0000 0000 0001 This is -32,767

1000 0000 0000 0000 This is -1 less than -32,767, so this is -32,768.

The NEG command is used to execute a complement of two, by changing the data from negative to positive to 16 bits or 32 bits.

32 bit number

As already mentioned, the integer is 16 bytes on the default. When some commands are said to be discussed later, and when it is used, it is likely to be 32 bits. When this is done, PLC sees two 16-bit registers as a large register. 15 bits are not regarded as MSB. PLC now considers MSB to be 32bit considering. PLC will show this integer-ranging from -2,147,483,648 to 2,147,483,647. (Except for scientific notation use only, see below)

When 32 bit instructions are used, it is important to note that the number of destination registers and the following register (following register) occupy both. When you write program, it will take into account, because overwriting data can be a result of the second time in the register.

Decimal Numbers Management

As mentioned above, the default method for handling the decimal numbers will drop them. This limitation can be avoided by using the float flag (M8023) setting and floating point instructions. Which is provided at the programming manual of FX3U.

There are 2 formats for displaying decimal numbers: Scientific Notation and Floating Point Format.

Scientific Notation:

Scientific notation uses two registers, it is stored in mantissa and exponent. Particular is the first 4 significant digits of a number, and the indicator shows the position of the decimal. These will not be used to calculate the format, but are useful for displaying information.

Examples: 1238 x 10³ 1,238,900 as the number will be displayed. 1238 is the block and 10³ indicates that the decimal is three places on the right, this is an indicator.

A negative indicator represents a number between 0 and 1 or 0 and -1. The indicator shows that the amount of part that the constituent keeps obscuring and identifies as a decimal.

For example: .00123 number is displayed as 123 x 10-5.

This format will show the external 32bit range (~ + / – 2 billion) in the normal range. The number range is 9999 x 1035 to -9999×1035 Disrupting the business does not make a clear loss only

Leave a Reply

Your email address will not be published.