Download as pptx, pdf, or txt
Download as pptx, pdf, or txt
You are on page 1of 53

DIGITAL FUNDAMENTALS

LOGIC AND DIGITAL TECHNICS


NUMBERING SYSTEMS
• A knowledge of numbering systems is fundamental to
understanding computers and their operation.
• All numbering systems are used to perform mathematical
calculations. Each numbering system has a unique number of
characters. The characters can be digits and alpha characters.
• Different numbering systems are characterized by the base of
that system.
• The base is the basis upon which any numbering system is
• Each numbering system has a unique base, a unique number of
characters and a unique positional weighting. The characters
can be digits or combinations of digits and alpha characters.
• in the aeronautical world switching circuits of one kind to
another are to be found in almost every piece of electronic
equipment. This may range from ground radar system to aircraft
flight system or communications equipment. The switching
maybe relatively simple or quite complex incorporating many
inter-related circuits in the form of gates and logic circuits
• the following are the numbering systems
• DENARY OR DECIMAL
• BINARY
• OCTAL
• HEXADECIMAL.
• Having learned what each numbering system means,
we shall then go on to see how we can convert from
one system to another and finally how normal
arithmetic computations are performed
• The number of digits used in a numbering system determines
the base or radix of the system, eg 10 digits are used in the
denary or decimal system and is called a base (radix)10 system.
• A binary system only uses two digits and is called base2 system.
People dealing with computer systems often find it convenient
to work with octal which is base 8 system or hexadecimal
which is base16 system.
• Unless the base of the system being used is clear, a subscript of
the base should be used. E.g. 12310 110112 276.38 OR 4F216.
DISADVANTAGES OF DECIMAL SYSTEM
• in this system, we know the base is 10. consider the number 7245,
we state this as seven thousand, two hundred and forty five. Written
in its full form it becomes; 7 X 103 + 2 X 102 + 4 X 101 + 5 X 100.
• in a digital computer calculations are carried out by a central
processor unit (CPU) which may consist of many transistors, diodes
etc. if a transistor is used to count on the decimal scale of base 10,
there would have to be 10 discrete levels of collector current, e.g.
0mA, might represent an input of 0, 1mA an input of 1, 2mA an
input of 2 etc.
• Such a system would be extremely difficult to operate and
would require very careful design with stabilized components.
• One requirement of a digital computer is that, it should be
accurate and therefore it must be able to distinguish between
numbers even if they are close to each other.
• In addition it is important that the number does not drift with
changes in power supply voltages or temperature.
• where accuracy and speed are important, there are only two
possible states in an electronic device on which adequate
reliance can be placed, ON or OFF.
• This state is the basis of the system which is used almost
universally today throughout digital processing and is called the
binary base 2 system.
• By using too widely spaced current values corresponding to the
output of a transistor at saturation (ON) and cut off (OFF), the
chance of error in representing a given number is minimized.
• The on/off state of a transistorized circuit represents
the binary numbers 0 and 1 and since they are well
defined and can be distinguished readily from each
other, even relatively large drifts in power supply
voltages or operating temperature will not affect
them.
• BINARY NUMBERING SYSTEM
• How to convert decimal to its binary equivalent.
• How to convert binary to its decimal equivalent.
OCTAL NUMBERING SYSTEM
• CONVERT DECIMAL TO OCTAL
• CONVERT BINARY TO OCTAL
• CONVERT OCTAL TO HEXADECIMAL
• CONVERT OCTAL TO DECIMAL
• CONVERT OCTAL TO BINARY
HEXADECIMAL NUMBERING SYSTEM
• CONVERT DECIMAL TO HEXADECIMAL
• CONVERT BINARY TO HEXADECIMAL
• CONVERT OCTAL TO HEXADECIMAL
• CONVERT HEXADECIMAL TO DECIMAL
• CONVERT HEXADECIMAL TO BINARY
• CONVERT HEXADECIMAL TO OCTAL
BINARY ARITHMETIC
• you learnt how to convert decimal no's into binary no's, which
is the system in which the digital computer works.
• One of the tasks which a digital computer must be able to do is
to compute, i.e. use various arithmetic processes to perform
sometimes very complex problems. Some problems require
more complex operations than the fundamental operations of +,
-, x, ÷, and =. Very often the problem will be written as a
computer program (software) rather than adding to the cost and
the complexity of the digital hardware. A few examples are
• HARDWARE OPERATIONS SOFTWARE OPERATIONS
• Addition square and higher roots
• Subtraction powers e.g. etc
• Multiplication sine
• Division tangent
• Equating sort
• You are going to learn how +, -, x, and ÷ are performed in
binary arithmetic.
• BINARY ADDITION BINARY SUBTRACTION
• Rules; • Rules
•0 + 0 = 0 •0 – 0 = 0
•0 + 1 = 1 • 0 – 1 = 1 BORROW 1
•1 + 0 = 1 •1 – 0 = 1
• 1 + 1 = 0 carry 1 •1 – 1 = 0
BINARY SUBTRACTION CONT
• the digital computer is essentially an adding device
and the above method for subtraction is not used in
computers. Instead, subtraction is performed by
adding the complement of the number to be
subtracted.
• The complement subtraction method is well known in
the field of computation, but it is rarely used in
decimal system since it is somewhat laborious and
normal subtraction is processes are easy.
• however it becomes a very simple and convenient
method to use when performing subtraction in the
binary system, since we are able to change a
subtraction problem into an addition.
• We first study the method when applied to the
decimal system, then apply the process to the binary
number system.
NINE’S COMPLEMENT
• the complement (9’s complement) of any decimal
digit is defined as the difference between the digit and
9, e.g. the complement of 3 is 6 (i.e. 9 – 3 = 6) and the
complement of 8 is 1 (i.e. 9 – 8 = 1) etc.
• The complement of any decimal number maybe found
by complementing each of its digits individually, e.g.
the complement of 17329 is 82620. let us now see
how we can use complementary numbers in the
subtraction of two decimal numbers.
• suppose we wish to subtract the decimal 428 from 815, then by
the conventional method of decimal subtraction; 815 – 428 =
387 --------1. The subtraction requires borrowing, to perform
operation. Now let us add the complement of 428 to 815 as
follows. 815 + 571 = 1386. --------2. if the carry 1 in the
thousands column is ignored, the remaining three digit number
is 1 less than the results found at 1 above. If the last carry is
added to the least significant digit, we obtain the correct answer,
i.e. 386 + 1 = 387. this system will give the correct answer with
any subtraction in the decimal system irrespective of the size of
• A very important point to note is that the number being
subtracted must have the same number of digits if not a zero
must be added in front of the most significant digit.
• TWO’S COMPLEMENT
• If the complement (2’s complement) subtraction method is
applied to the binary system, the procedure becomes very
simple. The 1’s complement of a binary digit is obtained by
subtracting the digit from 1, but since the system only uses two
digits, it can be seen that the complement of a binary number is
merely its digit inverse i.e.
• a 0 becomes 1 and a 1 becomes a 0. in digital hardware terms
this is easily accomplished because a single stage transistor
amplifier circuit gives an output which is the inverse of the
input. Example of how a binary number is converted into its
complement is shown below. The complement of 10101101 is
01010010. consider the problem of subtracting the two binary
numbers; 1011 – 111.
• 1011 + 1000 (complement of 0111) = 10011 (sum)
• +1 (final carry) = 100 (difference)
SIGNED NUMBERS
• We need to know how a computer stores numbers and in
particular how it stores negative numbers. So far we have only
solved problems which give positive answers, but of course
when subtracting, the answer may turn out to be negative e.g. 3
– 7 = -4.
• It is essential to be able to represent both positive and negative
numbers within a computer. In most computers negative
numbers are represented in 2’s complement form.
• Suppose we wish to store the number -7 in the computer, we
first write down the number for +7, putting a zero in front
which the computer recognizes as a positive sign. Then convert
this binary number to its 2’s complement as follows;
• +7 = 0111, invert it gives you 1000, add 1 = 1001. this is the
binary number which the computer stores as -7, and if it is to be
read out of the store, the computer notes that the most
significant bit is 1and therefore it is a negative number. It then
has to re-complement the binary number to read out as -7
• It should be noted that the stored negative number can
be converted to its decimal form as follows;
• 1001 ( + ) = (-8 + 1 ) = -7.
• Consider the simple problem of taking 5 from 4 to
give -1 as the answer. After converting the numbers
into binary form, proceed to carry out the subtraction
using the 2’s complement form i.e.
• + 5 = 0101 invert it gives you 1010, add 1 to make
1011 then add + 4 which is 0100 to get 1111.
•The 1 in the most significant place shows the number
is negative.
•This is how the number will be stored in the computer,
but if it is to be read out, the computer will then re-
complement the number as follows 1111 invert it will
be 0000 then add 1 to get 0001 110 the computer reads
out the number as -1.
•To convert a number held in the store to its decimal
equivalent, proceed as follows; 1111 + 4 + 2 + 1 = 1
SHIFTING
• In both multiplication and division, we shall make use of
shifting. In the decimal system, it will be recalled that shifting
the decimal point one column to the right is equivalent to
multiplying by 10, and shifting one place to the left is the same
thing as dividing by 10.
• In a similar manner, binary point shifting operations are
employed to multiply or divide binary numbers by 2 e.g. 1100 x
2 = 11000 (shifting right one column)
• 1100 ÷ 2 = 110 (shifting left one column) it follows that
multiple shifts of the binary point will occur if a binary number
is multiplied or divided by powers of 2 e.g. 101101 x =
101101000 (3 shifts right) 11001 x = 110.01 (2 shifts left).
• MULTIPLICATION & DIVISION OF BINARY NUMBERS
• 0 x 0 = 0, 0 x 1 = 0, 1 x 0 = 0, 1 x 1 = 1
• 0 ÷ 0 = 0, 0 ÷ 1 = 0, 1 ÷ 1 = 1. the process of multiplying
binary numbers is quite simple when carried out by the method
of shift and add. E.g.
• 1101 X 101 1101 X ( + ) Writing 101 in terms of powers of 2
1101 x + 1101 x 110100 + 1101 (shift point as appropriate). =
1000001. once again you will see that we have reduced the
multiplication operation to one of adding binary numbers,
which is the arithmetic process most favoured by the computer
hardware.
• DIVISION
• The process of division in any number system, is to determine
how many times one number (the divisor) can be subtracted
from another number (the dividend) while still leaving a
• This is of course when the
dividend divides exactly by the
divisor without a remainder.
When there is a remainder, i.e. the
number to be divided does not
divide exactly by the divisor, then
the subtraction is carried out as
far as it will go until a number is
reached which is less than the
divisor, this is then the remainder.
• It should be noted that the number
of subtractions which can be made
is a decimal number but the
remainder is still a binary number.
• It should be remembered that the
above subtractions would normally
be carried out by the 2’s
complement method of subtracting
binary numbers.
FLOATING POINT ARITHMETIC
• FLOATING POINT NUMBERS
• In a fixed point computer the location of the radix (equivalent to
decimal) point, once established during the design of the
computer, remains fixed, although no such a point physically
exists in the computer.
• In a binary computer for example the binary point of any number
is chosen so that the number is always greater than or equal to -1
and less than 1. numbers out side of this range require scaling or
shifting operations provided for in the programing.
• The programmer might have difficulties in keeping all
numbers to be handled within the range which the
computer hardware can cope with during
computation. In any event the programming becomes
more time consuming and painstaking.
• In a floating point computer, the radix point for each
number varies automatically and therefore results in
easy programming. The computer is also designed to
include built in logic units for floating point
arithmetic.
REPRESENTATION OF FLOATING POINT NUMBERS
• A floating point number x is represented in the following form;
x = m where m is called the mantissa or argument, r is called
the radix or base, e is called the exponent or index or power.
• NORMALISING
• As an example consider the number +2537, it can be rewritten
as; + .2537 x In this case the mantissa is +.2537, the radix is 10
and the exponent is+4. when the number is rewritten as shown
above, it is said to be normalized and it can be seen that this is
when it is scaled so that the most significant bit, in this case 2
• Exactly the same normalizing can be carried out on
binary numbers remembering of course that the radix
in this case is 2. a few e.g’s
• Number normalized form
• 1011 + . 1011 x ------(1)
• 1.001 + . 1001 x ------(2)
• -10.1 - . 101 x --------(3)
• 0.0101 + . 101 x ------(4)
• -0.00011 - . 11 x ---------(5)
• In (1) and (2) above, both mantissa and exponent would be
stored in the computer in normal binary form. In case (3) the
mantissa would be stored in binary 2’s complement form, as
would be the exponent of (4). Both mantissa and exponent
would be stored in 2’s complement form in the computer for
case (5).
• After an arithmetic operation, the result may not be in
normalized form. In this case, a process known as standardizing
is carried out to return it to its normalized form before returning
the result to the store.
ADDITION AND SUBTRACTION
• The numbers to be added or subtracted are normalized
and then scaled so that their exponent values are
equal. To do this the radix point of the smaller number
is shifted to the left until its exponent is the same as
the larger number. E.g.
• Add together 11.12 and 0.012 and standardize the
result if required.
• Subtract 10112 from 1111002.
MULTIPLICATION AND DIVISION
• When multiplying two numbers which are in
normalized form, we multiply their mantissas together
and add their exponents.
• When dividing, the mantissas are divided and the
exponents are subtracted. In general these rules can be
stated as follows;
• A x B = A.B.
•A÷ B =
CODING
• One way of entering a program into a computer is by using a
typewriter keyboard. Each key represents the normal letters of
the alphabet and numbers from 0 to 9, together with a good deal
of other information as well.
• Remembering that the computer can only handle information
expressed in binary form. When a key is depressed that letter,
number, instruction etc. must be converted into binary numbers
when it enters the computer.
• By coding we mean the method in which alphanumeric data can be
specified by means of other symbols which in turn can be easily
handled by digital machines.
• We have already learnt some coding methods in earlier lessons
although we did not particularly call them by that name. e.g. in
converting from decimal to binary we have seen that binary
equivalent of decimal numbers consists of a number bit (0’s and 1’s)
and so we can say the binary equivalent are the pure binary code for
the decimal numbers. We then went on to the octal and hexadecimal
numbering systems which again produce their appropriate codes.
• However pure binary codes are restricted in their application
and therefore other codes have been developed for digital
processing techniques and applications.
• BINARY CODED DECIMAL (BCD)
• The standard method of conversion using powers of 2 is very
long winded and although a computer can process numbers with
this method very rapidly, the human operators who program and
test the computers find it monotonous and time consuming to
convert long strings of binary numbers into decimals.
• In binary coded decimals (BCD) codes only the
decimal digits 0-9 are used for encoding. In the
computer each decimal digit of a number is translated
separately into an equivalent 4digit binary
combination.
• It should be noted that all 4 bits must be used for each
decimal digit and zeros added if required. Since there
are 16 possible combinations of binary digits in a 4
digit binary number, only 10 of these can be selected
to represent the 0-9decimal digits.
• There are several useful forms of BCD systems and
each one is identified by the WEIGHTS applied to the
columns of binary digits in the numbers.
• COMMON BCD CODES
DECIMAL 8, 4, 2, 1 2, 4, 2, 1 5, 4, 2, 1
O 0, 0, 0, 0 0, 0, 0, 0 0, 0, 0, 0
1 0, 0, 0, 1 0, 0, 0, 1 0, 0, 0, 1
2 0, 0, 1, 0 0, 0, 1, 0 0, 0, 1, 0
3 0, 0, 1, 1 0, 0, 1, 1 0, 0, 1, 1
4 0, 1, 0, 0 0, 1, 0, 0 0, 1, 0, 0
5 0, 1, 0, 1 1, 0, 1, 1 1, 0, 0, 0
6 0, 1, 1, 0 1, 1, 0, 0 1, 0, 0, 1
7 0, 1, 1, 1 1, 1, 0, 1 1, 0, 1, 0
8 1, 0, 0, 0 1, 1, 1, 0 1, 0, 1, 1
9 1, 0, 0, 1 1, 1, 1, 1 1, 1, 0, 0
8, 4, 2, 1 BCD
• The code is so called because the most significant digit in the
BCD number has the value decimal 8, the next is worth decimal
4 and so on. It is the easiest to remember because it consists of
the first 10 consecutive numbers in the conventional binary
scale, but that is where the similarity ends.
• In order to represent the decimal numbers from 10 and upwards
in BCD notation, the conversion is done by substituting the 4 bit
code appropriate to each to each of the decimal digits 0 to 9,
e.g.10 in BCD is 0001 0000 whilst in binary notation it is 1010.
• Convert 29510 Into BCD. Compare your answer to the
pure binary equivalent. The best way is to separate
each number and then place below it its binary 4 bit
equivalent.
• 2 9 5
• 0010 1001 0101
• in pure binary notation 29510 = 100100111. In order to
avoid confusing BCD code with pure binary code, a
space is left between each 4 bit group.
• Although in dealing with higher range decimal numbers more
bits are required to make up a BCD word requiring more digital
circuitry, better interface communication is possible in many
applications.
• This is very apparent when punched tape equipment is used to a
data processing installation where it is desired to avoid using
the binary number 1111 for arithmetic.
• This code is frequently referred to as the natural binary decimal
code.
2, 4, 2, 1 BCD
• This is the natural binary code but the weight 8 is replaced by
weight 2 giving the sum the weights as 9 (2+4+2+1). There is a
difficulty with this code because two columns carry a weight of
2, for example decimal 3is written as 0011 in this code but it
would appear that it could also be written as 1001.
• A rule has to be used to avoid this ambiguity when using this
code. A preferred digit rule is used which is that; the least
significant weight 2 is preferred for decimal digits 0 to 4 and the
most significant weight 2 is preferred for the remaining decimal
• The importance of this code is that it posses a valuable feature
in that it forms what is known as a self complementing code.
This can be seen if you note that the complement of the code
for decimal 0 is decimal 9, and the complement for decimal 1 is
decimal 8 and so on. Therefore the 9’s complement of any
decimal digit, in this code is formed automatically by changing
any 1 to 0 and any 0 to a 1. this makes this code particularly
useful when performing many arithmetic operations within a
computer. This makes it easier to produce hardware that will
invert binary digits.
5, 4, 2, 1 BCD.
• This code is again natural binary but the weight 8 is replaced by
weight 5. once again there is a chance of ambiguity with some
decimal numbers e.g. decimal 5 can be expressed as 1000 or
0101. in this code the weight 5 is preferred for decimal digits 5
to 9.
• The usefulness of this code is that the coded representation of
the decimal digits 0 to4 is the same as the digits 5 to 9 except
that the most significant binary digit changes from 0 to 1.
EXCESS 3 CODE (XS3)
• In all the BCDs looked at so far, decimal 0 is
represented by 0000 and in the case of 2, 4, 2, 1 code,
decimal 9 is represented by 1111.
• In many applications the binary combinations of 0000
and 1111 are undesirable and the excess 3 code (XS3)
is used to get round this difficulty. As will be seen in
the table below for XS3, 0000 and 1111 do not appear
for any decimal numbers 0 to 9.
DECIMAL EXCESS 3 COMPLEMENT COMPLEMENTED
DECIMAL

0 0 0 11 1100 9

1 0100 1011 8

2 0101 1010 7

3 0110 1001 6

4 0111 1000 5

5 1000 0111 4

6 1001 0110 3

7 1010 0101 2

8 1011 0100 1

9 1100 0011 0
• This table is formed by taking the conventional binary scale and
shifting it up three places so that the code for decimal 3 (0011)
now becomes decimal 0, decimal 4 (0100) becomes decimal 1
and so on.
• It can be seen that the first three and the last three of the 16
possible 4 digit binary combinations are not used. It can also be
seen that this code is self complementing as is the BCD 2, 4, 2,
1 code but it does not have the disadvantage of having 0000 and
1111 binary numbers included in it.
• To convert from XS3 to decimal, the decimal equivalent of each
4 bit group is written down and the 3 is subtracted from the
number. For example, if the XS3 binary number is 1000, this
converts to decimal eight using ordinary binary conversion, then
by taking decimal 3 from this we get 5 which you can see from
the table is correct.
• SOME COMPUTER TECHNOLOGY
• We have already made use of the word bit derived from Binary
digiT. consider the decimal number 347 when converted into
pure binary number form and 8, 4, 2, 1 BCD and the XS3 codes.
• Decimal 347
• Binary 101011011
• 8, 4, 2, 1 0011 0100 0111
• XS3 0110 0111 1010
• The corresponding groups of binary digits are known as a
WORD and each word is formed by a number of BITS and this
represents a word LENGTH. In the example above, the natural
binary number has a word length of 9 bits and in the 8, 4, 2, 1
BCD and XS3 the word length is 12.
• It should be noted that the word length of BCD or
XS3 codes is always equal to 4 times the number of
decimal digits.
• There are other codes also in use for example the
GRAY CODE and AMERICAN STANDARD CODE
for INFORMATION INTERCHANGE. The former of
these deals with decimal numbers whilst the later is a
code for representing alphabetic characters as well as
numbers.

You might also like