FX Series Programmable Controllers Devices in Detail 4
4-43
The reason this is not -7797 is because a ne
ative value is calculated usin
two’s
compliment (described later) but can quickl
be calculated in the followin
manner:
Because this is a ne
ative 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 ori
inal 16 bit - bit pattern. If the
ori
inal pattern was re-assessed as a hexadecimal number the answer would be
different.
b) A hexadecimal view
Takin
the same ori
inal bit pattern used in point a) and now addin
a hexadecimal
notation instead of the binar
(base 2) notation the bit patterns new meanin
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 thin
s become immediatel
obvious after a hexadecimal conversion. The first is that
there is si
n bit as hexadecimal numbers are alwa
s positive.
The second is there is an "E" appearin
in the calculated data. This is actuall
acceptable as hexadecimal counts from 0 to 15. But as there are onl
ten di
its (0 to 9),
substitutes need to be found for the remainin
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.
. A to F respectivel
.
As a result of base 16 countin
, 4 binar
bits are required to represent one base 16 or
hexadecimal number. Hence, a 16 bit data word will have a 4 di
it hexadecimal code.
There is actuall
a forth interpretation for this bit sequence. This is a BCD or Binar
Coded Decimal readin
. The followin
section converts the ori
inal bit pattern into a
BCD format.