**Data Handling Instructions**

Timers, counters and individual relays are all concerned with the handling of individual bits, i.e. single on-off signal. PLC operations involve blocks of data representing a value, such blocks being

termed words.

Data handling consists of operations involving moving or transferring numeric information stored in one memory word location to another word in a different location, comparing data values and carrying out simple arithmetic operations.

A register is where data can be stored.

Each data register can store a binary word of usually 8 or 16 bits.

The number of bits determines the size of the number that can be stored (2n – 1).

4-bit register can store a positive number between 0 and +15.

8-bit: 0 and +255.

16-bit: 0 and +65535.

**Data movement instructions**

There are typically 2 common instruction “sets“:

The single instruction is commonly called MOV (move) copies a value from one address to another.

The MOV instruction needs to know 2 things:

Source – where the data we want to move is located.

Destination – the location where the data will be moved to.

We write an address here. Allso, the data can be moved to the physical outputs.

Data comparison

The data comparison instruction gets the PLC to compare two data values.

Thus it might be to compare a digital value read from some input device with a second value contained in a register.

__PLCs generally can make comparisons for:__

less than (< or LESS),

equal to (= or EQU),

less than or equal to (<= or LEQ),

greater than (> or GRT),

greater than or equal to (>= or GEQ), and

not equal to ( NEQ).

**Arithmetic (mathematical) Instructions**

PLCs almost always include math functions to carry out some arithmetic operations:

Addition (ADD) – The capability to add one piece of data to another.

Subtraction (SUB) – The capability to subtract one piece of data from another.

Multiplication (MUL) – The capability to multiply one piece of data by another.

Division (DIV) – The capability to divide one piece of data from another.

**Overflow**

Typically the memory locations are 16-bit locations. If a result is greater than the value that could be stored in a memory location then we get an overflow. The plc turns on an internal relay that tells us an overflow has happened. We get an overflow if the number is greater than 65535

(2^16=65536).

Depending on the plc, we would have different data in the destination location. Some use 32-bit math which solves the problem. If we’re doing division, and we divide by zero the overflow bit turns on.