Page 120 - Mechanical Engineers Reference Book
P. 120
Summary of number systems 3/3
Summary of number systems Since there are only ten unique symbols in the decimal
numbering system. the first six letters of the alphabet are used
In the manipulation of data within a computer a two-state to denote the additional six symbols in the hexadecimal
numbering system is used. This is termed the binary system, system, i.e.
and it is based on a simple OPUOFF principle. For the Decimal 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
semiconductor integrated circuits which make up the com- Hexadecimal 0 1 2 3 4 5 6 7 8 9 A B C D E F
puter system, 5 V denotes ON (or logic level ‘1’) while 0 V
denotes OFF (or logic level ‘0’1. In practice, a tolerance band Using hex notation then, 8-bit binary numbers may be
is adopted, with 2.4-5 V representing logic ‘1’ and M.8 V replaced by two hex symbols, e.g.
logic ‘0’.
The microelectronic devices in the system handle the 167 decimal = 1010 0111 binary = A7 hex
transfer of information in 1’s and 0’s which are referred to as Higher numbers are similarly handled:
’BITS’, being a short form for BInary digiT. A group of eight
bits is termed a ‘byte’ and a number of computer systems are 6836 decimal = 0001 1010 1011 0100 binary = 1AB4 hex
based on &bit technology with the handling of data codes as
8-bit ‘words’. Sixteen- and 32-bit machines are also available. 3.1.1 ASCII code
The ‘computer operates with three numbering systems,
which are decimal, binary and hexadecimal (often simply In the interchange of information between the constituent
called ‘hex’). Numerical data would normally be entered by a parts of a computer or a peripheral device a binary code is
human operator in decimal form since this is the most familiar used to represent the alphanumeric characters. The most
number system. The computer. however, must ultimately commonly used code for digital communication links is the
convert the decimal number into a binary code, since this is American Standard Code for Information Interchange
the eventual form in which the number will be processed and (ASCII, pronounced Askey). ASCII is a 7-bit code which can
stored. The hexadecimal system is an in-between state and accommodate 128 definable characters.
represents a particularly compact method of handling binary When communication takes place in a serial fashion the
numbers as groups of four bits. ASCII code is extended to &bits, usually by inserting a zero in
In binary representation the only possible logic levels are 0 the most significant bit. Additionally, one or two start bits, a
and 1. The base is chosen as 2 and integer numbers can be parity bit and a stop bit are also included. The start bit(s)
represented using 8-bit codes as shown below: inform the receiving device that a character code follows. The
parity bit provides a check that no bits have been corrupted
bit number 7 6 5 4 3 2 1 0 during transmission, by ensuring that the sum of all the 1’s in
27 26 25 24 23 22 21 20 the ASCII group give either an even number for ‘even parity’
or an odd number for ‘odd parity’. The stop bit. set to logic ‘l’,
128 64 32 16 8 4 2 1 terminates the transmission of the character.
The transmission rate in bitdsecond is termed ‘baud’. Since
Most Least there are 11 bits associated with the transmission of one
significant signifi- character, a speed of 2400 baud corresponds to 2400/11 = 218
bit cant characters per second.
WSBI bit
(LSB)
The conversion from binary to decimal is illustrated as follows: 3.1.2 Gray code
binary number 1 0 1 1 1 0 0 1 The Gray code is but one of many binary codes in which only
giving 128 + 0 + 32 + 16 + 8 + 0 + 0 + 1 one of the digits change between successive consecutive
= 185 decimal numbers. The main application is in the sensing of rotational
and translational position in mechanical systems (see Section
Conversion from decimal to binary is the reverse process to 3.5.2.7).
the above. In converting from Gray to binary code the most significant
It is aipparent that the highest number which can be accom- bit of the binary number, B, is equal to the most significant bit
modated in 8-bit binary notation is 1111 1111, which is of the Gray code, G. For all other bits, the relationship
equivalent to 255 decimal. Generally, therefore, computer between binary and Gray is given by
systems handle integer numbers in four consecutive bytes, i.e.
as 32-bits. The most significant bit is used to denote the sign of B(n) = G(n) @ B(n + 1) (3.1)
the number and the resulting range of integer numbers is where n denotes the bit reference number and @ is an
exclusive-OR logic comparison.
-Z3’ -1 to Z3’. or -2, 147, 483, 648 to 2, 147. 483, 647
The conversion of 1101 Gray to binary is shown below:
Real numbers are handled in five bytes with the most
significant byte representing an exponent and a sign bit and bit number 3 2 1 0
the other four bytes the mantissa and a sign bit. The resultant Grav code 1 1 0 1
range of real numbers is 2-lZx to 212’, with either a positive or
a negative sign for the mantissa.
The handling of numbers in binary notation is extremely
cumbersome for a human and a shorthand notation is adopted binary number 1 = 0 = 0 = 1
i.e. 1101 Gray = 1001 binary
for con.venience. This is the hex system in which the binary
number is arranged into groups of four bits. Four bits, which is In practical position-sensing applications the conversion pro-
half of a byte, is called a ‘nibble’. A byte therefore consists of cess can be programmed in the software or implemented in a
an upper and a lower nibble. hardwired logic circuit using logic gates.

