Numbering Systems
Numbering Systems
Numbering Systems
Numbering systems
Weight 104 103 102 101 100 . 10–1 10–2 10–3 10–4 10–5
0 3 4 2 1 . 1 9 0 0 0
Table A.1
Decimal weighting structure
The most significant digit (or MSD) in this number is 3. This refers to the left most
digit that has the greatest weight (103 or 1000) assigned to it.
The least significant digit (or LSD) in this number is 9. This refers to the right most
digit that has the least weight (10-2 or 0.01) assigned to it.
This represents the number calculated below:
326 Practical Data Communications For Instrumentation and Control
– – –
...0×10 4 +3×10 3 +4×10 2 +2×10 1 +1×10 0 +1×10 1 +9×10 2 +0×10 3 +...
Binary numbers
Binary numbers are commonly used with computers and data communications because
they represent two states – either ON or OFF. For example, the EIA-232-C standard has
two voltages assigned for indicating ON (say, –5 Volts,) or OFF (say, +5 Volts). Any
other voltages outside a narrow band around these voltages are undefined.
The word bit, referred to often in the literature, is a contraction of the words binary
digit.
The same principles for representing a binary number apply as in section 1 above. For
example, the number 1011.12 means the following using Table A.2.
Table A.2
Binary weighting system
contd… 11 1011
12 1100
13 1101
14 1110
15 1111
Table A.3
Equivalent binary and decimal numbers
1101. 01 2 =13.25
The conversion process from a decimal number to a binary number is slightly more
complex. The procedure here is to repeatedly divide the decimal number by 2 until the
quotient (the result of the division) is equal to zero. Each of the remainders forms the
individual bits of the binary number.
For example, to convert decimal number 4310 to binary form:
2 43 remainder 1 (LSB)
2 21 remainder 1
2 10 remainder 0
2 5 remainder 1
2 2 remainder 0
2 1 remainder 1 (MSB)
0
Table A.4
Illustration of decimal to binary conversion
Hexadecimal numbers
Most of the work done with computers and data communications systems is based on the
Hexadecimal number system, with the base of 16 and uses the sequence of symbols:
0,1,2,3,4,5,6,7,8,9,A,B,C,D,E,F
328 Practical Data Communications For Instrumentation and Control
Weight 164 163 162 161 160 . 16– 1 16– 2 16– 3 16– 4 16– 5
0 0 F A 9 . 0 2 0 0 0
Table A.5
Hexadecimal weighting structure
The most significant digit (MSD) in the above number is the left most symbol and is F
with weighting of 162. The right most symbol is the least significant digit (LSD) and is
valued at 2 with a weighting of 16–2.
Table A.6
Relationship between decimal, binary and hexadecimal numbers
As can be seen from the table, the binary numbers are grouped in fours for the largest
single digit hexadecimal character or symbol. A similar approach of grouping bits in
fours is followed in expressing a binary number as a Hexadecimal number.
In converting the binary number 10000100111101112 to its hexadecimal equivalent the
following procedure should be adopted. First, break up the binary number into groups of
Appendix A – Numbering systems 329
four commencing from the least significant bit. Then equate the equivalent Hex symbol
to it (derived from Table A.6 above).
1000010011110111 becomes:
or 84F716.
In order to convert a hexadecimal number back to binary the procedure used above
must be reversed.
For example, in converting from C9A4 to binary this becomes:
C ... 9 ... A ... 416
1100 ... 1001 ... 1010 ... 01002
or 11001001101001002.
Binary arithmetic
'JJOZOUT
Knowledge of binary addition is useful although it can be cumbersome. It is based on the
following four combinations of adding binary numbers:
0 0 1 1
0 1 0 1
0 1 1 0 and carry 1
The carry 1 (or bit) is the only difficult part of the process. This addition of the
individual bits of the number should be done sequentially from the LSB to the MSB (as in
normal decimal arithmetic).
An example of addition is given below:
10100010012
00111010102
11011100112
9[HZXGIZOUT
The most commonly used method of binary subtraction is to use 2’s complement. This
means that instead of subtracting two binary numbers (with the attendant problems such
as having ‘carry out’ bits); the addition process is applied.
For example, take two numbers and subtract the one from the other as follows:
12 which is equivalent to: 1100
–4 Subtrahend –0100
8 Result 1000
The two’s complement is found by first complementing all the bits in the subtrahend
and then adding 1 to the least significant bit.
Complementing the number results in 0100 becoming: 1011.
Add 1 to the least significant bit gives a two’s complement number of: 1100.
330 Practical Data Communications For Instrumentation and Control
+^IR[YO\K58>58
Exclusive-OR is a procedure very commonly used with binary numbers in the error
detection sequences of data communications. The result of an XOR operation on any two
binary digits is the same as the addition of two digits without the carry bit.
Consequently, this operation is sometimes also called the Modulo-2 adder. The truth table
for XOR is shown below:
Table A.7
Exclusive-OR truth table