EC207-LCD-notes
EC207-LCD-notes
Number Systems
The present daytechnology and the way of life require the usage of several number systems.
Usageof decimal numbers starts very early in one’s life. Therefore, when one is
confrontedwith number systems other than decimal, some time during the high-school
years, it
calls for a fundamental change in one’s framework of thinking.
There have been two types of numbering systems in use throughout the world.
One type is symbolic in nature. Most important example of this symbolic numbering
system is the one based on Roman numerals
I = 1, V = 5, X = 10, L = 50, C = 100, D = 500 and M = 1000
IIMVII - 2007
While this system was in use for several centuries in Europe it is completely
superseded by the weighted-position system based on Indian numerals. The Roman
number system is still used in some places like watches and release dates of movies.
The weighted-positional system based on the use of radix 10 is the most commonly
used numbering system in most of the transactions and activities of today’s world.
However, the advent of computers and the convenience of using devices that have
two well defined states brought the binary system, using the radix 2, into extensive
use. The use of binary number system in the field of computers and electronics also
lead to the use of octal (based on radix 8) and hex-decimal system (based on radix
16). The usage of binary numbers at various levels has become so essential that it
is also necessary to have a good understanding of all the binary arithmetic
operations.
Here we explore the weighted-position number systems and conversion from one
system to the other.
Except for possible leading and trailing zeros, the representation of a number in
positional system is unique (00256.230 is the same as 256.23). Obviously the
valuesdi’s can take are limited by the radix value. For example a number like
(356)5, where the suffix 5 represents the radix will be incorrect, as there can not be
a digit like 5 or 6 in a weighted position number system with radix 5.
If the radix point is not shown in the number, then it is assumed to be located near
the last right digit to its immediate right. The symbol used for the radix point is a
point (.)
As much of the present day electronic hardware is dependent on devices that work
reliably in two well defined states, a numbering system using 2 as its radix has
become necessary and popular. With the radix value of 2, the binary number system
will have only two numerals, namely 0 and 1.
Consider the number (N)2= (11100110)2.
It is an eight digit binary number. The binary digits are also known as bits.
Consequently the above number would be referred to as an 8-bit number. Its
decimal value is given by
From here on we consider any number without its radix specifically mentioned, as a
decimal number.
With the radix value of 2, the binary number system requires very long strings of 1s
and 0s to represent a given number. Some of the problems associated with handling
large strings of binary digits may be eased by grouping them into three digits or four
digits. We can use the following groupings.
Octal (radix 8 to group three binary digits)
Hexadecimal (radix 16 to group four binary digits)
In the octal number system the digits will have one of the following eight values 0, 1,
2, 3, 4, 5, 6 and 7.
In the hexadecimal system we have one of the sixteen values 0 through 15.
However, the decimal values from 10 to 15 will be represented by alphabet A (=10),
B (=11), C (=12), D (=13), E (=14) and F (=15).
Conversion of a binary number to an octal number or a hexadecimal number is very
simple, as it requires simple grouping of the binary digits into groups of three or
four.
Consider the binary number 11011011. It may be converted into octal or
hexadecimal numbers as
(11011001)2 = (011) (011) (001) = (331)8
= (1101) (1001) = (D9)16
Note that adding a leading zero does not alter the value of the number. Similarly for
grouping the digits in the fractional part of a binary number, trailing zeros may be
added without changing the value of the number.
Number System Conversions
In general, conversion between numbers with different radices cannot be done by
simple substitutions. Such conversions would involve arithmetic operations. Let us
work out procedures for converting a number in any radix to radix 10, and viceversa.
The decimal equivalent value of a number in any radix is given by theformula
wherer is the radix of the number and there are p digits to the left of the radix point
and n digits to the right. Decimal value of the number is determined by converting
each digit of the number to its radix-10 equivalent and expanding the formula using
radix-10 arithmetic.
Some examples are:
This forms the basis for converting a decimal number D to a number with radix r. If
we divide the right hand side of the above formula by r, the remainder will be d 0,
and the quotient will be
Thus, d0 can be computed as the remainder of the long division of D by the radix r.
As the quotient Q has the same form as D, another long division by r will give d 1 as
the remainder. This process can continue to produce all the digits of the number
with radix r.
CODES: Introduction
When we wish to send information over long distances unambiguously it becomes
necessary to modify (encoding) the information into some form before sending, and
convert (decode) at the receiving end to get back the original information. This
process of encoding and decoding is necessary because the channel through which
the information is sent may distort the transmitted information. Much of the
information is sent as numbers. While these numbers are created using simple
weighted-positional numbering systems, they need to be encoded before
transmission. The modifications to numbers were based on changing the weights,
but predominantly on some form of binary encoding. There are several codes in use
in the context of present day information technology, and more and more new codes
are being generated to meet the new demands.
Coding is the process of altering the characteristics of information to make
it more suitable for intended application
By assigning each item of information a unique combination of 1s and 0s we
transform some given information into binary coded form. The bit combinations are
referred to as “words” or “code words”. In the field of digital systems and computers
different bit combinations have different designations.
Bit - a binary digit 0 or 1
Nibble - a group of four bits
Byte - a group of eight bits
Word - a group of sixteen bits;
a word has two bytes or four nibbles
Sometimes ‘word’ is used to designate a larger group of bits also, for example 32 bit
or 64 bit words.
We need and use coding of information for a variety of reasons
to increase efficiency of transmission,
to make it error free,
to enable us to correct it if errors occurred,
to inform the sender if an error occurred in the received information etc.
for security reasons to limit the accessibility of information
tostandardise a universal code that can be used by all
Coding schemes have to be designed to suit the security requirements and the
complexity of the medium over which information is transmitted.
Decoding is the process of reconstructing source information from the
encoded information. Decoding process can be more complex than coding if we
do not have prior knowledge of coding schemes.
In view of the modern day requirements of efficient, error free and secure
information transmission coding theory is an extremely important subject. However,
at this stage of learning digital systems we confine ourselves to familiarising with a
few commonly used codes and their properties.
We will be mainly concerned with binary codes. In binary coding we use binary digits
or bits (0 and 1) to code the elements of an information set. Let n be the number of
bits in the code word and x be the number of unique words.
If n = 1, then x = 2 (0, 1)
n = 2, then x = 4 (00, 01, 10, 11)
n = 3, then x = 8 (000,001,010 ...111)
From this we can conclude that if we are given elements of information to code into
binary coded format,
where j is the number of bits in a code word.
For example, if we want to code alphanumeric information (26 alphabetic characters
+ 10 decimals digits = 36 elements of information), we require
j> 3.32 log1036
j> 5.16 bits
Since bits are not defined as fractional parts, we take j = 6. In other words a
minimum six-bit code would be required to code 36 alphanumeric elements of
information. However, with a six-bit code only 36 code words are used out of the 64
code words possible.
In this Learning Unit we consider a few commonly used codes including
1. Binary coded decimal codes
2. Unit distance codes
3. Error detection codes
4. Alphanumeric codes
Binary Coded Decimal Codes
The main motivation for binary number system is that there are only two elements in
the binary set, namely 0 and 1. While it is advantageous to perform all
computations on hardware in binary forms, human beings still prefer to work with
decimal numbers. Any electronic system should then be able to accept decimal
numbers, and make its output available in the decimal form.
One method, therefore, would be to
convert decimal number inputs into binary form
manipulate these binary numbers as per the required functions, and
convert the resultant binary numbers into the decimal form
However, this kind of conversion requires more hardware, and in some cases
considerably slows down the system. Faster systems can afford the additional
circuitry, but the delays associated with the conversions would not be acceptable. In
case of smaller systems, the speed may not be the main criterion, but the additional
circuitry may make the system more expensive.
We can solve this problem by encoding decimal numbers as binary strings, and use
them for subsequent manipulations.
There are ten different symbols in the decimal number system: 0, 1, 2, . . ., 9. As
there are ten symbols we require at least four bits to represent them in the binary
form. Such a representation of decimal numbers is called binary coding of decimal
numbers.
We wish to choose codes that have some desirable
properties like
ease of coding
ease in arithmetic operations
minimum use of hardware
error detection property
ability to prevent wrong output during transitions
In a weighted code the decimal value of a code is the algebraic sum of the weights
of 1s appearing in the number. Let (A)10be a decimal number encoded in the binary
form as a3a2a1a0. Then
(A)10= w3a3 + w2a2 + w1a1 +w0a0
where w3, w2, w1 and w0 are the weights selected for a given code, and a3,a2,a1and
a0are either 0s or 1s. The more popularly used codes have the weights as
The decimal numbers in these three codes are
In all the cases only ten combinations are utilized to represent the decimal digits.
The remaining six combinations are illegal. However, they may be utilized for error
detection purposes.
Consider, for example, the representation of the decimal number 16.85 in Natural
Binary Coded Decimal code (NBCD)
(16.85)10 = (0001 0110 . 1000 0101)NBCD
1685
There are many possible weights to write a number in BCD code. Some codes have
desirable properties, which make them suitable for specific applications. Two such
desirable properties are:
1. Self-complementing codes
2. Reflective codes
When we perform arithmetic operations, it is often required to take the
“complement” of a given number. If the logical complement of a coded number is
also its arithmetic complement, it will be convenient from hardware point of view. In
aself-complementing coded decimal number, (A)10, if the individual bits of a
number are complemented it will result in (9 - A)10.
Example: Consider the 2421 code.
The 2421 code of (4)10 is 0100.
Its complement is 1011 which is 2421 code for (5)10 = (9 - 4)10.
Therefore, 2421 code may be considered as a self-complementing code. A necessary
condition for a self-complimenting code is that the sum of its weights should be 9.
A self-complementing code, which is not weighted, is excess-3 code. It is derived
from 8421 code by adding 0011 to all the 8421 coded numbers.
Another self-complementing code is 631-1 weighted code.
Three self-complementing codes are
A reflective code is characterized by the fact that it is imaged about the centre
entries with one bit changed
These Gray codes listed here have also the reflective properties.
The most popular use of Gray codes is in the position sensing transducer known as
shaft encoder.
There are two convenient methods to construct Gray code with any number of
desired bits. The first method is based on the fact that Gray code is also a reflective
code.However, this method requires Gray codes with all bit lengths less than ‘n’ also be
generated as a part of generating n-bit Gray code.
The second method allows us toderive an n-bit Gray code word directly from the
corresponding n-bit binary codeword:
The bits of an n-bit binary code or Gray code words are numbered from right
to left, from 0 to n-1.
Bit i of a Gray-code word is 0 if bits i and i+1 of the corresponding binary
code word are the same, else bit i is 1. When i+1 = n, bit n of the binary
code word is considered to be 0.
Example: Consider the decimal number 68.
(68)10 = (1000100)2
Binary code: 1 0 0 0 1 0 0
Gray code : 1 1 0 0 1 1 0
Gray to binary
Gray code : 1 1 0 1 1 0 1 0 0 0 1 0 1 1
Binary code: 1 0 0 1 0 0 1 1 1 1 0 0 1 0
Alphanumeric Codes
When information to be encoded includes entities other than numerical values, an
expanded code is required. For example, alphabetic characters (A, B, ....Z) and
special operation symbols like +, -, /, *, (, ) and other special symbols are used in
digital systems. Codes that include alphabetic characters are commonly referred to
as Alphanumeric Codes. However, we require adequate number of bits to encode all
the characters. As there was a need for alphanumeric codes in a wide variety of
applications in the early era of computers, like teletype, punched tape and punched
cards, there has always been a need for evolving a standard for these codes.
Alphanumeric keyboard has become ubiquitous with the popularization of personal
computers and notebook computers. These keyboards use ASCII (American
Standard Code for Information Interchange) code
Al
phanumeric codes like EBCDIC (Extended Binary Coded Decimal Interchange Code)
and 12-bit Hollerith code are in use for some applications. However, ASCII code is
now the standard code for most data communication networks.
Hamming Code
Module II
Logic Functions
Karnaugh Maps