FX Series Programmable Controllers Devices in Detail 4
4-40
The reason this is not -7797 is because a negative value is calculated using two’s
compliment (described later) but can quickly be calculated in the following manner:
Because this is a negative number, a base is set as -32768. This is the smallest number
available with 16bit data. To this the positive sum of the active bits is added, i.e. -32768
+ 7797.
The correct answer is therefore -24971.
Remember this is now a decimal representation of the original 16 bit - bit pattern. If the
original pattern was re-assessed as a hexadecimal number the answer would be
different.
b) A hexadecimal view
Taking the same original bit pattern used in point a) and now adding a hexadecimal
notation instead of the binary (base 2) notation the bit patterns new meaning becomes:
Hexadecimal value = ((1 x 8) + (1 x 1)), ((1 x 8) + (1 x 4) + (1 x 2)),
((1 x 4) + (1 x 2) + (1 x 1)), ((1 x 4) + (1 x 1))
Hexadecimal value = 9E75
Two things become immediately obvious after a hexadecimal conversion. The first is that
there is sign bit as hexadecimal numbers are always positive.
The second is there is an "E" appearing in the calculated data. This is actually
acceptable as hexadecimal counts from 0 to 15. But as there are only ten digits (0 to 9),
substitutes need to be found for the remaining base 16 numbers, i.e. 10, 11, 12, 13, 14
and 15. The first six characters from the alphabet are used as the replacement indices,
e.g. A to F respectively.
As a result of base 16 counting, 4 binary bits are required to represent one base 16 or
hexadecimal number. Hence, a 16 bit data word will have a 4 digit hexadecimal code.
There is actually a forth interpretation for this bit sequence. This is a BCD or Binary
Coded Decimal reading. The following section converts the original bit pattern into a
BCD format.