Sei sulla pagina 1di 102

SIX MONTHS INDUSTRIAL TRAINING REPORT DUCAT,NOIDA

SIX MONTHS INDUSTRIAL TRAINING

TRAINING REPORT
UNDERTAKEN AT

DUCAT, NOIDA
IN
EMBEDDED SYSTEM TECHNOLOGIES

ON

EMBEDDED HARDWARE & SOFTWARE


SUBMITTED IN PARTIAL FULFILLMENT OF THE DEGREE
OF
BACHELOR OF TECHNOLOGY
IN
ELECTRONICS AND COMMUNICATION ENGINEERING

Under the Guidance of: Submitted By:


Name: Mr. Sonu Verma Name: Mr. Surinder Singh
Designation: Sr. Embedded Sys. Consultant College Roll No.: EC/06/6306
Department: Embedded H/w(R&D) University Roll No.: 6170406213

INSTITUTE OF ENGINEERING AND TECHNOLOGY-BHADDAL


PO : MIANPUR, District: Ropar, Punjab

1
SIX MONTHS INDUSTRIAL TRAINING REPORT DUCAT,NOIDA

ACK

I express my gratitude to the Pu


opportunity for the six months i
Electronics & Communication En
training period, and i want to tha
incharge MR. Sonu Verma who as
taught me the basics very well as w

I would like to thank Dr. H.R.V


2

Technology, Bhaddal for his kind


SIX MONTHS INDUSTRIAL TRAINING REPORT DUCAT,NOIDA

This train
application in various fields of rea
surrounded with many embedded
functioning of these gadgets. Telev
Oven in our kitchen, Card readers, A
to do many of our tasks very effectiv
car take care of car operations be
regularly dish out details about lates
believe that our basic survival is co
the fact S.NO
that these embedded produ TI
Embedded System? 3
SIX MONTHS INDUSTRIAL TRAINING REPORT DUCAT,NOIDA

S.NO TI

1 EMBEDDED
2 COMPONEN
3 C LANGUAG
4 8051 MICRO
5 SERIAL COM
6 REAL TIME
7 RS232 4
SIX MONTHS INDUSTRIAL TRAINING REPORT DUCAT,NOIDA

Company Profile - Ducat I

A-43 & A-5

Ducat is a technology training part


development platform and applica
extensible tools and frameworks tha 5

for modeling, language developmen


SIX MONTHS INDUSTRIAL TRAINING REPORT DUCAT,NOIDA

1.EMBEDDED SYSTEMS

1.1 What are embedded systems?

• Embedded System is a system which takes some inputs and Process them based on some

s/w written on it and output the Corresponding results. It is a part of large system.

• It is a system that has computer hardware with software embedded in it as one of its most

important component.

Figure 1.1 Embedded system

• Embedded systems are computer systems that monitor, respond to, or control an external

environment.

• Environment connected to system through sensors, actuators and other I/O interfaces.

• Embedded systems must meet timing & other constraints imposed on it by environment .

• “Any sort of device which includes a programmable computer, but itself is not intended

to be a general-purpose computer” (Wayne Wolf)

• It does not need secondary memories as in computers.

• It has one single dedicated operation

6
SIX MONTHS INDUSTRIAL TRAINING REPORT DUCAT,NOIDA

1.2 Embedded System Composition

Figure1. 2 Embedded System Composition

1.3 Classification of Embedded Systems

• It is classified in to 3 types:

1.3.1 Small scale (8 to16 Bit )

Little S/W and H/W complexity on board.

Battery operated,editor,compiler specific to processor,assembler are the basic tools.

Less s/w ,limiting power dessipation.

1.3.2 Medium Scale(16 to 32 bit)

7
SIX MONTHS INDUSTRIAL TRAINING REPORT DUCAT,NOIDA

Contains RISC processors with h/w and s/w complexity.

Tools, debuggers, simulators, IDE in addition.

1.3.3 Sophesticated embedded systems(16 to 32 bit)

More s/w and h/w complexity that medium as it contains scalable processors, have

processing speed constraints.

1.4 Embedded Systems components

• The hardware for an embedded system can come in many styles and flavours. It can be as
complex as a Linux system with 64 megabytes of memory, a disc, specialty input/output
devices Internet or other communications capability.It can be as simple as a single
microprocessor with the requisite input/output devices integrated on the microprocessor
integrated circuit.

• Microprocessors (µP)

– The “engine” that processes instructions

– These instructions are stored in Read Only Memory (ROM)

– No real time capability.

• Busses (data, address, Input/Output)

• System clock - steps µP through each instruction

• Read Only Memory (ROM):

– Permanently loaded with instructions (firmware):Basic Input Output System


(BIOS) - primitive operating system that allows chips to interface with each other.
Also known as micro kernel. Application code (provides functionality)

• Random Access Memory (RAM)

8
SIX MONTHS INDUSTRIAL TRAINING REPORT DUCAT,NOIDA

– Stores Data in Processing (eg: Temperature Readings)

– Shares data with external partners (eg: Sensors)

• Real Time Clock RTC

– Required for keeping long times and for operation with Real Time Operating
System (RTOS), which controls the coordinated Operations of multiple systems.

• Communication Circuitry

– Ethernet Port, Printer Port

– Communication Port (RS232C, RS422, IEEE488)

1.5 Von-Neumann architecture

Fig.1.3 Von-Neumann architecture

1.6 Harvard Architecture

Fig.1.4 Harvard Architecture

1.7 Examples of embedded systems

9
SIX MONTHS INDUSTRIAL TRAINING REPORT DUCAT,NOIDA

Keyboard and other controllers for computers, CD players and consumer electronics, Timing
and control electronics in microwave ovens, coffee makers. Controllers for vacuum cleaners
and washing machines for sensing dirt loads. Control of the dashboard, ignition, fuel
injection, suspension stiffness and environmental temperature and noise in automobiles.
Parking meter controllers. Elevator, environmental and security systems in buildings,
Internal operation of medical instrumentation such as infusion pumps, pulse ox meters, Disc
controllers for computer systems, Control of data communications routers for wide-band
communications and many more. Ibo, the Robotic Dog of Sony Corp., incorporates Emotion-
Detecting Sensors, Voice Recognition System, a CCD Camera, and Distance Measurement
Sensor. It has 18 Joints that can generate different types of movements.LG Electronics has
introduced Refrigerators that can check E-Mail, Surf the Web, Watch TV, and make
Videophone Calls. Users have access to information like Real-Time Grocery Prices and
Stock Prices. Carrier and IBM are developing Air-conditioners that can be controlled over
the Internet.

10
SIX MONTHS INDUSTRIAL TRAINING REPORT DUCAT,NOIDA

2.COMPONENTS OF A COMPUTER SYSTEM

Fig.2.1 Components of a computer system

2.1 Types of computer

• Microcomputers
- desktop, laptop, notebook and palmtop personal computers (PCs)
- used in businesses, schools/colleges and homes
- cost from a few hundred pounds to a few thousand
• Minicomputers
- often used as multi-user systems, with 100’s of workstations or terminals attached to
central minicomputer, e.g. EPOS.
- cost from £10,000 to about £150,000.
• Mainframe computers
- used by large organisations which may have 1000’s of terminals, often remote
- cost ££ hundreds of thousands
• Supercomputers
- largest category of computer used mostly by scientific & industrial research
departments, NASA, the Weather Centre, stock exchanges
- cost ££ millions

11
SIX MONTHS INDUSTRIAL TRAINING REPORT DUCAT,NOIDA

2.2 CPU

Controls the transmission of data from input devices to memoryProcesses the data held in main
memory.Controls the transmission of information from main memory to output devices. A
microprocessor -- also known as a CPU or central processing unit -- is a complete computation
engine that is fabricated on a single chip. Using its ALU (Arithmetic/Logic Unit), a
microprocessor can perform mathematicaloperations like addition, subtraction, multiplicationand
division. Modern microprocessors contain complete floating point processors that can perform
extremely sophisticated operations on large floating point numbers. A microprocessor can move
data from one memory location to another. A microprocessor can make decisions and jump to a
new set of instructions based on those decisions.

Figure 2.1 CPU

2.2.1 Clock Speed

To synchronize the steps of the fetch-decode,execute cycle, All processors have an internal
clock which generates regularly timed pulses. All activities of the fetch-decode-execute cycle
must begin on a clock pulse.

2.2.2 Word Size


12
SIX MONTHS INDUSTRIAL TRAINING REPORT DUCAT,NOIDA

The number of bits that the CPU can process simultaneously. Normally groups of 8, 16, 32, 64,
128 bit words are processed as a unit during input, output and logic instructions.Word size is a
major factor in determining the speed of a processor.

2.2.3 Bus Size

Buses are the lines along which data is transmitted. This data can be in the form of data and
instructions as well the addresses of the data and the instructions.The width of a data bus
determines how many bits can be transmitted simultaneously and the maximum address which
can be referenced. For 8 bits 28 – 1 = 255 i.e. 0 to 255 which is 256 locations. An address bus
(that may be 8, 16 or 32 bits wide) that sends an address to memory. A data bus (that may be 8,
16 or 32 bits wide) that can send data to memory or receive data from memory An RD (read) and
WR (write) line to tell the memory whether it wants to set or get the addressed location. A clock
line that lets a clock pulse sequence the processor. A reset line that resets the program counter to
zero (or whatever) and restarts execution

2.2.4 Instruction Set

Instructions in machine language are in the form of binary codes, with each different processor
using different codes for the instruction set supported by its hardware. The instruction set for a
typical computer includes the following types of instructions:

• Data Transfer
• Arithmetic Operations
• Logical Operations
• Test and Branch Instructions

2.3 Memory
13
SIX MONTHS INDUSTRIAL TRAINING REPORT DUCAT,NOIDA

2.3.1 Main memory

Instructions and data are held in main memory, which is divided into millions of individually-
addressable storage units called bytes. One byte can hold one character, or it can be used to hold
a code representing, for example, a tiny part of a picture, a sound, or part of a computer program
instruction. The total number of bytes in main memory is referred to as the computer’s memory
size. Computer memory sizes are measured as follows:

1 Kilobyte (Kb) = 1000 bytes (to be exact, 1024 bytes)


1 Megabyte (Mb) = 1,000,000 (1 million) bytes
1 Gigabyte (Gb) = 1,000,000,000 (1 billion) bytes
1 Terabyte (Tb) = 1,000,000,000,000 (1 trillion) bytes

2.3.2 Random Access Memory (RAM)

It is an ‘Ordinary’ memory. Used for storing programs which are currently running and data
which is being processed. This type of memory is volatile - it loses all its contents as soon as the
machine is switched off.

2.3.3 Read Only Memory (ROM)

It is a non-volatile memory with contents permanently etched into the memory chip at the
manufacturing stage. Used for example to hold the bootstrap loader, the program which runs as
soon as the computer is switched on and instructs it to load the operating system from disk into
memory.

2.3.3 Programmable read only memory(PROM)

14
SIX MONTHS INDUSTRIAL TRAINING REPORT DUCAT,NOIDA

Short for programmable read-only memory, a memory chip on which data can be written only
once. Once a program has been written onto a PROM, it remains there forever. Unlike RAM,
PROMs retain their contents when the computer is turned off. The difference between a PROM
and a ROM (read-only memory) is that a PROM is manufactured as blank memory, whereas a
ROM is programmed during the manufacturing process. To write data onto a PROM chip, you
need a special device called a PROM programmer or PROM burner. The process of
programming a PROM is sometimes called burning the PROM. An EPROM (erasable
programmable read-only memory) is a special type of PROM that can be erased by exposing it to
ultraviolet light. Once it is erased, it can be reprogrammed. An EEPROM is similar to a PROM,
but requires only electricity to be erased.

2.3.4 Erasable Programmable read only memory(EPROM)

EPROM(Erasable Programmable Read Only Memory) can be programmed and erased enabling
them to be re-used. Erasure is accomplished using an UV (Ultra Violet) light source that shines
through a quartz erasing window in the EPROM package. Acronym for erasable programmable
read-only memory, and pronounced ee-prom, EPROM is a special type of memory that retains its
contents until it is exposed to ultraviolet light. The ultraviolet light clears its contents, making it
possible to reprogram the memory. To write to and erase an EPROM, you need a special device
called a PROM programmer or PROM burner. An EPROM differs from a PROM in that a
PROM can be written to only once and cannot be erased. EPROMs are used widely in personal
computers because they enable the manufacturer to change the contents of the PROM before the
computer is actually shipped. This means that bugs can be removed and new versions installed
shortly before delivery.Pronounced double-ee-prom or e-e-prom, short for electrically erasable
programmable read-only memory. EEPROM is a special type of PROM that can be erased by
exposing it to an electrical charge. Like other types of PROM, EEPROM retains its contents
even when the power is turned off. Also like other types of ROM, EEPROM is not as fast as
RAM. EEPROM is similar to flash memory (sometimes called flash EEPROM). The principal

15
SIX MONTHS INDUSTRIAL TRAINING REPORT DUCAT,NOIDA

difference is that EEPROM requires data to be written or erased one byte at a time whereas
flash memory allows data to be written or erased in blocks. which makes flash memory faster.

2.3.5 Flash EPROM

A flash EPROM is similar to an EEPROM except that flash EPROMs are erased all at once
while a regular EEROMs can erase one byte at a time. In- circuit writing and erasing is possible
because no special voltages are required. To accomplish in-circuit operation, you have to write
special application software routines. Flash EPROMs are also called nonvolatile memory.

2.3.6 Cache Memory

Ita a very fast memory used to improve the speed of a computer, doubling it in some cases. Acts
as an intermediate store between the CPU and main memory. Stores the most frequently or
recently used instructions and data for rapid retrieval Generally between 1Kb and 512Kb. It is
much more expensive than normal RAM.

Figure 3 Cache Memory

16
SIX MONTHS INDUSTRIAL TRAINING REPORT DUCAT,NOIDA

2.3.7 Virtual memory

Figure 4.3 Virtual Memory

2.3.8 Auxiliary Storage

• Hard disks

- all standalone PCs have in-built hard disk

- typical capacity for Pentium PC is >= 40 Gb

- used for storing software including the operating system,

other systems software, application programs and data

• Floppy disks

- thin sheet of mylar plastic in hard 3½” casing

- capacity 1.44Mb

17
SIX MONTHS INDUSTRIAL TRAINING REPORT DUCAT,NOIDA

• CD-ROM

- holds about 700Mb

• Zip disks

- hold up to 250Mb

18
SIX MONTHS INDUSTRIAL TRAINING REPORT DUCAT,NOIDA

3. ‘C’ LANGUAGE

3.1 Machine Language through High-Level Languages and C

Compilers turn high level languages into object code, and the linker changes the object code into
machine code. In many IDE's the compile and link steps are done with one command. On the
command line, it is normally a 2 step process. High level languages are usually only platform
dependant after compiling, and assuming you do not use specific OS or compiler functions. If
you stick to the language standards, nearly every language is platform independant. If you write
a standard C or C++ programm the only thing you have to do is recompile it for a different
platform.

• The C and C++ compiliation is done in 3-stages.

• Stage 1. The source files are processed by the pre-processor, whose job it is to combine
all the include files and source files into one file. It also strips all comments and expands
all defines and other macros.

• Stage 2. the compiler takes the ourput of the pre-processor to produce the *.obj file.

• Stage 3. The linker combines all the *.obj files in the project with *.lib libraries to
produce a *.exe program, or a DLL.

19
SIX MONTHS INDUSTRIAL TRAINING REPORT DUCAT,NOIDA

• How is a program converted into a form that a computer can use?

• What is the form of data that the computer uses?


– All data is converted into a set of binary codes, strings of 1s and 0s
– Binary codes are distinguished by the manner in which the computer uses them.
– Machine language

• Machine language to High-level languages

• Machine language
o made up binary-coded instructions used directly by the computer
o tedious and error prone
o programs were difficult to read and modify

20
SIX MONTHS INDUSTRIAL TRAINING REPORT DUCAT,NOIDA

• Assembly language
o Low-level programming language in which a mnemonic is used to represent each
of the machine language instructions for a particular computer
Assembly Language Machine Language
ADD 100101
SUB 010011

• Assembly language
– Computer not able to process instructions directly hence a program, written in
machine language, was used to translate from assembly language to machine
language: Assembler
– Easier for humans to use than machine language however programmers still
forced to think in terms of individual machine instructions
• High-level languages
– Closer to English, and other natural languages, than assembly and machine
languages.

3.1.1 Language-Processing System

21
SIX MONTHS INDUSTRIAL TRAINING REPORT DUCAT,NOIDA

3.1.2 Memory model

• Whilst near pointers simplify memory access in the segmented memory of Intel
processors by allowing direct arithmetic on pointers, they limit accessible memory to 64
kilobytes.
• Far pointers can be used to access multiple code segments, each 64K, up to 1 megabyte,
by using segment and offset addressing.
• The cost is that the programmer cannot use the simple pointer arithmetic that is possible
with near pointers.
• The default model is Small, which is effective for the majority of applications.
• The Tiny model is specifically designed for the production of TSR (memory-resident)
programs, which must fit into one code segment and be compiled as .COM rather than
.EXE files.
• The remaining models are selectable in the compilation process, through the IDE or in
the make file.
• Careful use of alternative memory models is one the hallmarks of thoughtful C
programming.

3.2 Cygwin
22
SIX MONTHS INDUSTRIAL TRAINING REPORT DUCAT,NOIDA

Cygwin is free software that provides a Unix-like environment and software tool set to users of
any modern version of MS-Windows for x86 CPUs (95/98/NT/2000/ME/XP). Cygwin consists
of a Unix system call emulation library, cygwin1.dll, together with a vast set of GNU and other
free software applications organized into a large number of optional packages. Among these
packages are high-quality compilers and other software development tools, a complete X11
development toolkit, GNU emacs, TeX and LaTeX, OpenSSH (client and server), and much
more, including everything needed to compile and use PhysioToolkit software under MS-
Windows.Cygwin does not provide a means for running GNU/Linux or other Unix binary
executables under MS-Windows. In order to run such software using Cygwin, that software must
be compiled from its sources. Cygwin provides all of the components needed to do this in most
cases; most POSIX-compliant software, including X11 applications, can easily be ported to MS-
Windows using Cygwin. Cygwin is a UNIX-compatible environment that runs on Windows
systems. It consists of cygwin1.dll, a library that takes POSIX calls and translates them into
Win32 calls (kind of like winelib in reverse); a shell (GNU BASH, the shell used on most Linux
systems, is the default); an implementation of the X Window System and, of course, GCC.

3.3 C Data Types

All C variables are defined with a specific type. C has the following built-in types.

char - characters
int - integers (whole numbers)
float - real numbers
void - valueless

23
SIX MONTHS INDUSTRIAL TRAINING REPORT DUCAT,NOIDA

3.4 Data Modifiers

• Data Modifiers enable you to have greater control over the data:
1. signed 2. unsigned 3. short 4. long

• The signed Modifier:


• Used to enable the sign bit.
• Used to indicate to the compiler that the int or char data type uses the sign bit.
• All int variables in C are signed by default.
• The unsigned Modifier:
• used to tell the C compiler that no sign bit is needed in the specified data type.
• Like the signed modifier, the unsigned modifier is meaningful only to the int and
char data types
• By default, ‘unsigned’ means ‘unsigned int’.
• The short Modifier:

24
SIX MONTHS INDUSTRIAL TRAINING REPORT DUCAT,NOIDA

• A data type can be modified to take less memory by using the short modifier.
• By default, a short int data type is a signed number.
• %hd, %hi or % hu is to specify that the corresponding number is a short int or
unsigned short int.
• The long modifier:
• It is used to define a data type with increased storage space.
• The ANSI standard allows you to indicate that a constant has type long by
suffixing l or L to the constant.
• %ld or %Ld specifies that the corresponding datum is long int. %lu or %Lu is
then used for the long unsigned int data.

25
SIX MONTHS INDUSTRIAL TRAINING REPORT DUCAT,NOIDA

3.5 Control Flow statements

• The if statement

• The if-else statement

• The switch statement

• The break statement

• The continue statement

• The goto statement

3.6 Call by Value and Call by Reference

• The arguments passed to function can be of two types namely

• 1.Values passed
2. Address passed

• The first type refers to call by value and the second type refers to call by reference.

3.7 Array

• An array is a collection of variables that are of the same data type. Each item in an array
is called an element. All elements in an array are referenced by the name of the array and
are stored in a set of consecutive memory slots.

• The general form to declare an array:

data-type Array-Name[Array-Size];

eg. int array_int[8];

26
SIX MONTHS INDUSTRIAL TRAINING REPORT DUCAT,NOIDA

• In C Array subscripts start at 0 and end one less than the array size.

• In above example the size of array_int starts with 0 and ends with 7.

• Indexing the Arrays all arrays in C are indexed starting at 0.

3.8 Pointers

• We can make a pointer that refers to the first element of an array by simply assigning the
array name to the pointer variable.

– A pointer is said to refer to an array when the address of the first element in the
array is assigned to the pointer. The address of the first element in an array is also
called the start address of the array.

– To assign the start address of an array to a pointer, you can either put the
combination of the address-of operator (&) and the first element name of the
array, or simply use the array name, on the right side of an assignment operator
(=).

3.9 Sorting Algorithm

One of the fundamental problems of computer science is ordering a list of items. There's a
plethora of solutions to this problem, known as sorting algorithms. Some sorting algorithms are
simple and intuitive, such as the bubble sort. Others, such as the quick sort are extremely
complicated, but produce lightening-fast results.The common sorting algorithms can be divided
into two classes by the complexity of their algorithms.

27
SIX MONTHS INDUSTRIAL TRAINING REPORT DUCAT,NOIDA

• Algorithmic complexity

• It is generally written in a form known as Big-O notation, where the O represents


the complexity of the algorithm and a value n represents the size of the set the
algorithm is run against.

• Relative Effeciency

• The run times on your system will almost certainly vary from these results, but
the relative speeds should be the same - the selection sort runs in roughly half the
time of the bubble sort.

There are four types of sorting techniques:-

1. Bubble sort

2. Insertion sort

3. Selection sort

4. Quick Sort

3.9.1 Bubble sort

The bubble sort is the oldest and simplest sort in use. Unfortunately is the slowest.The bubble
sort works by comparing each item in the list with the item next to it, and swapping them if
required. The algorithm repeats this process until it makes a pass all the way through the list
without swapping any items (in other words, all items are in the correct order). This causes larger
values to "bubble" to the end of the list while smaller values "sink" towards the beginning of the
list. The bubble sort is generally considered to be the most inefficient sorting algorithm in
common usage.

28
SIX MONTHS INDUSTRIAL TRAINING REPORT DUCAT,NOIDA

3.9.2 Insertion Sort

The insertion sort works just like its name suggests - it inserts each item into its proper place in
the final list. The simplest implementation of this requires two list structures - the source list and
the list into which sorted items are inserted.To save memory, most implementations use an in-
place sort that works by moving the current item past the already sorted items and repeatedly
swapping it with the preceding item until it is in place. Although it has the same complexity, the
insertion sort is a little over twice as efficient as the bubble sort.And almost 40% faster than the
selection sort.The insertion sort is a good middle-of-the-road choice for sorting lists of a few
thousand items or less. The algorithm is significantly simpler than the shell sort, with only a
small trade-off in efficiency.The insertion sort shouldn't be used for sorting lists larger than a
couple thousand items or repetitive sorting of lists larger than a couple hundred items.

3.9.3 Selection Sort

The selection sort works by selecting the smallest unsorted item remaining in the list, and then
swapping it with the item in the next position to be filled. It is simple and easy to implement. It
yields a 60% performance improvement over the bubble sort, but the insertion sort is over twice
as fast as the bubble sort and is just as easy to implement as the selection sort. In short, there
really isn't any reason to use the selection sort - use the insertion sort instead. If at all made in
use, try to avoid sorting lists of more than a 1000 items.

3.9.4 Quick Sort

The quick sort is an in-place, divide-and-conquer, massively recursive sort. As a normal person
would say, it's essentially a faster in-place version of the merge sort.The quick sort algorithm is
simple in theory, but very difficult to put into code (computer scientists tied themselves into
knots for years trying to write a practical implementation of the algorithm, and it still has that
effect on university students). The efficiency of the algorithm is majorly impacted by which
element is choosen as the pivot point. The worst-case efficiency of the quick sort occurs when

29
SIX MONTHS INDUSTRIAL TRAINING REPORT DUCAT,NOIDA

the list is sorted and the left-most element is chosen. Randomly choosing a pivot point rather
than using the left-most element is recommended if the data to be sorted isn't random.

• The recursive algorithm consists of four steps (which closely resemble the merge sort):

• If there are one or less elements in the array to be sorted, return immediately.

• Pick an element in the array to serve as a "pivot" point. (Usually the left-most
element in the array is used.)

• Split the array into two parts - one with elements larger than the pivot and the
other with elements smaller than the pivot.

• Recursively repeat the algorithm for both halves of the original array.

30
SIX MONTHS INDUSTRIAL TRAINING REPORT DUCAT,NOIDA

4.8051 MICROCONTROLLER

The AT89C51 is a low-power, high-performance CMOS 8-bit microcomputer with 8K bytes of


Flash programmable and erasable read only memory (PEROM). The device is manufactured
using Atmel’s high-density nonvolatile memory technology and is compatible with the industry-
standard MCS-51 instruction set and pin out. The on-chip Flash allows the program memory to
be reprogrammed in-system or by a conventional nonvolatile memory programmer. The Atmel
AT89C51 is a powerful microcomputer, which provides a highly flexible and cost-effective
solution to many embedded control applications. It also provides 32 I/O lines, 256bytes of RAM
for data storage.

Microprocessor, by-itself, completely useless . It does not have RAM,ROM and no I/O ports on
the chip itself. Must have external peripherals to Interact with outside world. Makes system
bulkier and expensive. A Microcontroller has a CPU along with fixed amount of RAM, ROM
and I/O ports and timer on a single chip.

• There are four major 8 bit microcontrollers.

» Freescale-68111

» Intel's -8051

» PIC 16x

» Microchip.

Each one has its own instruction set and register set so not compatible with each other.

31
SIX MONTHS INDUSTRIAL TRAINING REPORT DUCAT,NOIDA

4.1 Features Of Microcontroller

• 8051 is an 40 pin IC.

• 8051 is an 8-bit Microcontroller.

• 128 byes of RAM

• 4KBytes of inbuilt ROM.

• It have one serial port i.e. UART

• Four parallel ports i.e. P0,P1,P2&P3.

• It have two 16-bit Timers i.e. Timer0 ,Timer1.

• It have five sources and six Interrupts.

• It have four Register Banks (Bank0-3) .

• 16-bit Program Counter.

• DPTR(16-bit).

• 8-bit stack pointer (sp).

• External code and data memory up to 64KB.

• 8-bit PSW (program status word).

• On chip Oscillator.

• 8K Bytes of In-System Reprogrammable Flash Memory

• Low-power Idle and Power-down Modes

32
SIX MONTHS INDUSTRIAL TRAINING REPORT DUCAT,NOIDA

• 4v to 5.5v operating range.


4.2 8051 Architecture

33
SIX MONTHS INDUSTRIAL TRAINING REPORT DUCAT,NOIDA

PIN Configuration

34
SIX MONTHS INDUSTRIAL TRAINING REPORT DUCAT,NOIDA

4.2.1 Pin configuration of AT89C51

• VCC -Supply voltage.

• GND- Ground.

• RST -Reset input.

– A high on this pin for two machine cycles while the oscillator is running resets the
device.

• Port 0

– Port 0 is an 8-bit open drain bidirectional I/O port.

– When 1s are written to port 0 pins, the pins can be used as high impedance inputs.

– Port 0 may also be configured to be the multiplexed low order address/data bus
during accesses to external program and data memory.

– Port 0 also receives the code bytes during Flash programming, and outputs the
code bytes during program verification.

– External pullups are required during program verification.

• Port 1

– Port 1 is an 8-bit bidirectional I/O port with internal pullups .

– When 1s are written to Port 1 pins they are pulled high by the internal pullups
and can be used as inputs.

– It also receives the low-order address bytes during Flash programming and
verification.

35
SIX MONTHS INDUSTRIAL TRAINING REPORT DUCAT,NOIDA

• Port 2

– Port 2 is an 8-bit bidirectional I/O port with internal pullups.

– When 1s are written to Port 2 pins they are pulled high by the internal pullups and
can be used as inputs.

– Port 2 emits the high-order address byte during fetches from external program
memory and during accesses to external data memory that use 16-bit addresses
(MOVX @DPTR).

– During accesses to external data memory that use 8-bit addresses (MOVX @ RI),
Port 2 emits the contents of the P2 Special Function Register.

– Port 2 also receives the high-order address bits and some control signals during
Flash programming and verification.

• Port 3

– Port 3 is an 8-bit bidirectional I/O port with internal pullups.

– When 1s are written to Port 3 pins they are pulled high by the internal pullups and
can be used as inputs.

– Port 3 also receives some control signals for Flash programming and verification.

– Port 3 also receives some control signals for Flash programming and
programming verification. RST Reset input. A high on this pin for two machine
cycles while the oscillator is running resets the device.

36
SIX MONTHS INDUSTRIAL TRAINING REPORT DUCAT,NOIDA

• Port Pin Alternate Functions:


– P3.0 RXD (serial input port)
– P3.1 TXD (serial output port)
– P3.2 INT0 (external interrupt 0)
– P3.3 INT1 (external interrupt 1)
– P3.4 T0 (timer 0 external input)
– P3.5 T1 (timer 1 external input)
– P3.6 WR (external data memory write strobe)
– P3.7 RD (external data memory read strobe)

• ALE/PROG:
– Address Latch Enable is an output pulse for latching the low byte of the address
during accesses to external memory. This pin is also the program pulse input
(PROG) during Flash programming.
– In normal operation, ALE is emitted at a constant rate of 1/6 the oscillator
frequency and may be used for external timing or clocking purposes. Note,
however, that one ALE pulse is skipped during each access to external data
memory. If desired, ALE operation can be disabled by setting bit 0 of SFR
location 8EH. With the bit set, ALE is active only during a MOVX or MOVC
instruction. Otherwise, the pin is weakly pulled high. Setting the ALE-disable bit
has no effect if the Microcontroller is in external execution mode.

PSEN:
– Program Store Enable is the read strobe to external program memory. When the
AT89C52 is executing code from external program memory, PSEN is activated
twice each machine cycle, except that two PSEN activations are skipped during
each access to external data memory.
• EA/VPP:
– External Access Enable: A must be strapped to GND in order to enable the device
to fetch code from external program memory locations starting at 0000H up to
FFFFH. Note, however, that if lock bit 1 is programmed, EA will be internally

37
SIX MONTHS INDUSTRIAL TRAINING REPORT DUCAT,NOIDA

latched on reset. EA should be strapped to VCC for internal program executions.


This pin also receives the 12-volt programming enable voltage (VPP) during
Flash programming when 12-volt programming is selected.

XTAL1:
– Input to the inverting oscillator amplifier and input to the Internal clock operating
circuit.

XTAL2:
– Output from the inverting oscillator amplifier.

4.2.2 Memory Organisation

• MCS-51 devices have a separate address space for program and data memory up to 64k
bytes each of external program and data memory can be addressed.

Program Memory:
• If the EA pin is connected to GND, all program fetches are directed to external memory.
In the AT89C51RC if EA is connected to Vcc, program fetches the addresses 0000H
through 7FFFH are directed to internal memory and fetches to addresses memory.

Data Memory:
• The AT89C51RC has internal data memory that is mapped into four separate segments.
The lower 128 bytes of RAM, upper 128 bytes special function register (SFR) and 256
bytes expanded RAM (ERAM).

The four segments are:

1. The lower 128bytes of RAM (addresses 00H to 7FH) are directly and indirectly addressable.
2. The upper 128 bytes of RAM (addresses 80H to FFH) are indirectly addressable only.

38
SIX MONTHS INDUSTRIAL TRAINING REPORT DUCAT,NOIDA

3. The special function registers, (SFR’s) (addresses 80H to FFH) are directly addressable only.
4. 256 bytes expanded RAM (ERAM, 00H-FFH) is indirectly accessed by MOVX instruction
and with the EXTRAM bit cleared.
Either direct or indirect addressing can access the lower 128 bytes. The upper 128 bytes
can be accessed indirect addressing only. The upper 128 bytes occupy the same address but are
physically separate from the SFR space. When an instruction accesses an internal location above
address 7FH, the CPU knows whether the accesses is to the upper 128 bytes of data RAM or to
SFR space by the direct addressing mode used in the instruction. Instructions that use direct
addressing access SFR space. For example MOV OAOH, #data.

• SFR (Special Function Register):

39
SIX MONTHS INDUSTRIAL TRAINING REPORT DUCAT,NOIDA

A map of the on-chip memory area is called the special function registers (SFR) space. Note
that in the SFR's not all the addresses are occupied. Unoccupied addresses are not implemented
on the chip. Read accesses to these addresses will in general return random data and write
accesses will have no-effect. The functions of SFR's are described as follows:
• Accumulator:

Acc is the accumulator register. The mnemonics for accumulator, specific Instructions.
However, refer to the accumulator simply as "A".

• PSW (Program Status Register):


The PSW contains several status bits that reflect the current state of the cpu.the psw resides
in the SFR space.

• Stack Pointer:
This is of 8-bit wide. It is incremented before data is stored during PUSH and CALL
executions. While the stack pointer may any where in on chip RAM the stack pointer is
initialized to 07h after a reset. This causes the stack to begin at location 08h.
• Data Pointer (DPTR):
This consists of a high type and a low byte. Its intended function is to hold a 16-bit address.
It may be manipulated as a 16-bit register or as two independent 8-bit registers.

• Ports 0 to 3:
P0, P1, P2, and P3 are the SFR of ports 0,1,2 & 3 respectively. Writing a one of a port SFR
causes the port output pin to switch low. When used as an input, the external state of a pin will
be held in the port SFR.

40
SIX MONTHS INDUSTRIAL TRAINING REPORT DUCAT,NOIDA

• Serial Data Buffer:


The serial buffer is actually two separate registers transmit buffer and a receive buffer. When
data is involved to SBUF. It goes to transmit buffer and is held for serial transmission. When
data is moved from SBUF. It comes from SBUF. It comes the receive buffer.

• Timer Register Basic to 89C51:


Register pins (TH0, TL0), (TH1, TL1), (TH2, TL2) are 16-bit counting registers for
timer/counters 0,1&2, respectively.

• Control Register For The 89C51:


SFR, IP, IE, TMOD, SCON and PCON contain and status bits for the interrupt system. The
timer/counters and the serial port.

4.3.3 Instruction Set:

The 89C52 instruction set has 111 instructions. It includes


• Arithmetic
• Logical
• Data transfer
• Boolean and
• Branching instructions
4.4.4 Addressing Modes:

There are five addressing modes in the 89C52 instruction set explained as follows:
• Direct addressing
• Indirect addressing
• Register instructions
• Immediate addressing
• Indexed addressing

41
SIX MONTHS INDUSTRIAL TRAINING REPORT DUCAT,NOIDA

5.SERIAL COMMUNICATION PROTOCOL

• Different Serial Communication Protocols

o USB.

o CAN.

o FIREWIRE.

o SPI - Serial Peripheral Interface.

5.1 Introduction to USB

USB stands for universal serial bus

• Complex, hierarchical standard

• Requires software layers both on the host computer and on the USB device

• Serial Protocol and Physical Link

• Hierarchy: PC is the host

– Upstream points towards the host

– Downstream points away from the host

• Data transmitted serially

• Data transmitted differentially on a pair of wires (D+ and D-)

• 2 other wires are used to supply power to USB devices

42
SIX MONTHS INDUSTRIAL TRAINING REPORT DUCAT,NOIDA

• USB devices may be Bus Powered or Self-Powered

• USB includes specs on power consumption and voltage drops etc.

• Data transmitted serially

• Data transmitted differentially on a pair of wires (D+ and D-)

• 2 other wires are used to supply power to USB devices

• USB devices may be Bus Powered or Self-Powered

• USB includes specs on power consumption and voltage drops etc .

• Evolution

– USB 1.0 (1996)

– USB 1.1 (1998)

– USB 2.0 (2000)

• Advantages of serial buses:

– Signal Integrity
Fewer coinciding signal transitions. Less crosstalk. Less noise. Less inter-signal
skew.

– Cost
Drivers, connectors, cables, receivers

• Disadvantage of serial buses:

– Higher clock-rates required for given bandwidth

5.1.1 Types of USB Cable

• High Speed Cables

– Shielded, jacketed - use twisted pair wiring

43
SIX MONTHS INDUSTRIAL TRAINING REPORT DUCAT,NOIDA

– Support max data rates of 12Mb/s

– Support Cable lengths of 5m

• Low Speed cables

– Not shielded, pairs not twisted, cheaper

– Support 1.5Mb/s

– Support Cable lengths of 3m

5.1.2 USB Connectors

• Connectors

– 4-Position with shielded housing

– Positive Retention

– Blind Mating Capabilities

• Cables

– 28 AWG twisted pair for signalling

– 20-28 AWG pair for power

– Shielding for fully rated segments

• Type A Connector connects to Upstream Ports

44
SIX MONTHS INDUSTRIAL TRAINING REPORT DUCAT,NOIDA

• Type B Connector connects to Downstream Ports

• Each USB Cable has a Type A & Type B Connector

5.1.3 USB Bandwidth

• USB 1.0 / 1.1

– 12 Mb/s Full Speed (FS) bit rate

– 1.5 Mb/s Low Speed (LS) bit rate

• USB 2.0 (May 2000)

– additionally: 480 Mb/s High Speed (HS)

– Applications: USB HDD. Video

5.1.4 USB Pipes

USB Communication uses the idea of a Pipe. The USB connection consists of a big pipe
(12Mb/s) and up to 127 small pipes. Each of the small pipes connects to a USB device. Each
small pipe can connect to a smaller pipe (tiny pipe) – up to 16 tiny pipes per small pipe.

S m a ll P ip e t o e a c h U S B
d e v ic e ( u p t o 1 2 7 )

H O ST PC

T in y P i p e s ( e n d p o in t s )

B ig U S B P ip e
1 2 M b /s

45
SIX MONTHS INDUSTRIAL TRAINING REPORT DUCAT,NOIDA

5.2 CAN

The Controller Area Network (CAN) is a serial communications protocol which efficiently
supports distributed real time control. Used in high speed networks to low cost multiplex wiring.
In automotive electronics, engine control units, sensors, anti-skid-systems, etc. are connected
using CAN with bitrates up to 1 Mbit/s. It is cost effective to build into vehicle body electronics,
e.g. lamp clusters, electric windows etc. to replace the wiring harness otherwise required.

• CAN has been subdivided into different layers.

– the (CAN-) object layer

– the (CAN-) transfer layer

– the physical layer

The object layer and the transfer layer comprise all services and functions of the data link layer
defined by the ISO/OSI model. The scope of the object layer includes finding which messages
are to be transmitted deciding which messages received by the transfer layer are actually to be
used, providing an interface to the application layer related hardware. The scope of the transfer
layer mainly is the transfer protocol, i.e. controlling the framing, performing arbitration, error
checking error signalling and fault confinement.

5.2.1 Layered Structure of a CAN

46
SIX MONTHS INDUSTRIAL TRAINING REPORT DUCAT,NOIDA

5.3 Firewire Bus

The 1394 protocol is a peer-to-peer network with a point to point signaling environment. Nodes
on the bus may have several ports on them, each of these ports act as repeaters, retransmitting
any packets that are received by other ports within the node.

1394 is a peer to peer implementation, no need for specific host required, such as a PC in USB.
Digital Camera could easily stream data to both the Digital VCR and the DVD-RAM without
any assistance from other devices on the bus. There is the concept of a Cycle Master and Root
Node. The determination of what device plays the Cycle Master role is determined dynamically

47
SIX MONTHS INDUSTRIAL TRAINING REPORT DUCAT,NOIDA

and can change whenever a new device is added or a bus reset occurs. Configuration of the bus
occurs automatically whenever a new device is plugged in. Configuration proceeds from leaf
nodes (those with only one other device attached to them) up through the branch nodes. A bus
that has three or more devices attached will have a branch node as the Root Node. A 1394 bus
appears as a large memory mapped space with each node occupying a certain address range.
Each node supports up to 48 bits of address space (256 TeraBytes ). Each bus can support up to
64 nodes and the 1394 serial bus specification supports up to 1024 busses.

5.3SPI - Serial Peripheral Interface

The Serial Peripheral Interface is used primarily for a synchronous serial communication of host
processor and peripherals. However, a connection of two processors via SPI is just as well
possible . In the standard configuration for a slave device two control and two data lines are
used. The data output SDO serves on the one hand the reading back of data, offers however also
the possibility to cascade several devices. The data output of the preceding device then forms the
data input for the next IC.

There is a MASTER and a SLAVE mode. The MASTER device provides the clock
signal and determines the state of the chip select lines, i.e. it activates the SLAVE itwants

48
SIX MONTHS INDUSTRIAL TRAINING REPORT DUCAT,NOIDA

to communicate with. CS and SCKL are therefore outputs. The SLAVE device receives
the clock and chip select from the MASTER, CS and SCKL are therefore inputs. This
means there is one master, while the number of slaves is only limited by the number of
chip selects. A SPI device can be a simple shift register up to an independent subsystem.
The basic principle of a shift register is always present. Command codes as well as data
values are serially transferred, pumped into a shift register and are then internally
available for parallel processing. The length of the shift registers is not fixed, but can
differ from device to device. Normally the shift registers are 8Bit or integral multiples of
it. Of course there also exist shift registers with an odd number of bits. For example two
cascaded 9Bit EEPROMs can store 18Bit data. A SPI device can be a simple shift register
up to an independent subsystem. The basic principle of a shift register is always present.
Command codes as well as data values are serially transferred, pumped into a shift
register and are then internally available for parallel processing. The length of the shift
registers is not fixed, but can differ from device to device. Normally the shift registers are
8Bit or integral multiples of it. Of course there also exist shift registers with an odd
number of bits. For example two cascaded 9Bit EEPROMs can store 18Bit data. A SPI
device can be a simple shift register up to an independent subsystem. The basic principle
of a shift register is always present. Command codes as well as data values are serially
transferred, pumped into a shift register and are then internally available for parallel
processing. The length of the shift registers is not fixed, but can differ from device to
device. Normally the shift registers are 8Bit or integral multiples of it. Of course there
also exist shift registers with an odd number of bits. For example two cascaded 9Bit
EEPROMs can store 18Bit data.

49
SIX MONTHS INDUSTRIAL TRAINING REPORT DUCAT,NOIDA

• Serial communication uses a single data line is used instead of the 8-bit data line of
parallel communication.

• It is cheaper and also makes it possible for two computers located in two different cities
to communicate over telephone.

• At the transmitter bytes of data is converted to serial bits using a parallel-in-serial-out


shift register.

• At the receiver serial data is packed in to bytes by serial-in-parallel-out shift register

• Data is transferred through the telephone line by converting 0s and 1s to audio tones
(sinusoidal shaped signal), by a peripheral device called Modem
(Modulator/Demodulator).

• Serial communication uses two methods:

• Asynchronous.

• Synchronous.

• Synchronous: Transfers a block of data (characters) at a time.

• Asynchronous: Transfers single byte at a time.

• There are special IC chip made by many manufacturers for serial data communications.

• UART (Universal Asynchronous Receiver-Transmitter ).

50
SIX MONTHS INDUSTRIAL TRAINING REPORT DUCAT,NOIDA

• USART (Universal Synchronous –Asynchronous Receiver-Transmitter).

• In data transmission if the data can be transmitted and received, it is a duplex


transmission.

• Half duplex: data is transmitted one way at a time.

• Full duplex: data is transmitted both ways at the same time.

• Each character is placed between a start bit and a stop bits.

• Start bit is always a 0(low) and the stop bit is always 1(high).

• Baud rate: The rate of data transfer in serial data communication. Also stated as bps (bits
per second).

51
SIX MONTHS INDUSTRIAL TRAINING REPORT DUCAT,NOIDA

RS-232 Standards:

• To allow compatibility among data communication equipment made by various


manufacturers, an interfacing standard called RS232 was set by the electronics industries
association (EIA) in 1960.

• In RS232, a 1 is represented by -3 to -25v, while a 0 bit is +3 to 25v, making -3 to +3


undefined.

52
SIX MONTHS INDUSTRIAL TRAINING REPORT DUCAT,NOIDA

Data Communication Classification

Current terminology classifies data communication as DTE (Data Terminal Equipment) or


DCE (Data Communication Equipment).

• DCE refer to communication equipment, such as modems.


• DTE refer to terminals and computers that send and receive data

MAX232.:

53
SIX MONTHS INDUSTRIAL TRAINING REPORT DUCAT,NOIDA

• 8051 has two pins that are used specifically for transferring and receiving data serially.
• These pins are called TXD and RXD.
• These pins are TTL compatible;
• They require a line driver to make them RS232 compatible.
• One such driver is the MAX232 chip.
BAUD RATE

8051 transfers and receives data serially at many different baud rates.
• The baud rate in the 8051 is programmable.
• 8051 divides the crystal frequency by 12 to get the machine cycle frequency.
• UART circuitry divides the machine cycle frequency by 32 before it is used by timer 1 to
set the baud rate.
SBUF Register
• SBUF is an 8-bit register used solely for serial communication in the 8051.
• For a byte of data to be transferred via the TXD line, it must be placed in the SBUF
register.
54
SIX MONTHS INDUSTRIAL TRAINING REPORT DUCAT,NOIDA

• Similarly SBUF holds the byte of data when it is received by the 8051’s RXD line.
• The moment a byte is written into SBUF, it is framed with the start and stop bit and
transferred serially via the TXD pin.

SCON REGISTER

SM0,SM1: Mode select register


SM0 SM1
0 0 mode0
0 1 mode1
1 0 mode2
1 1 mode3

55
SIX MONTHS INDUSTRIAL TRAINING REPORT DUCAT,NOIDA

6. Real Time Clock DS1307 (RTC)

The DS1307 serial real-time clock (RTC) is a low-power, full binary-coded decimal (BCD)
clock/calendar plus 56 bytes of NV SRAM. Address and data are transferred serially through an
I2C™, bidirectional bus. The clock/calendar provides seconds, minutes, hours, day, date, month,
and year information. The end of the month date is automatically adjusted for months with fewer
than 31 days, including corrections for leap year. The clock operates in either the 24- hour or 12-
hour format with AM/PM indicator. The DS1307 has a built-in power-sense circuit that detects
power failures and automatically switches to the battery supply. The DS1307 is a low-power
lock/calendar with 56 bytes of battery-backed SRAM. The clock/calendar provides seconds,
minutes, hours, day, date, month, and year information. The date at the end of the month is
automatically adjusted for months with fewer than 31 days, including corrections for leap year.
The DS1307 operates as a slave device on the I2C bus. Access is obtained by implementing a
START condition and providing a device identification code followed by a register address.
Subsequent registers can be accessed sequentially until a STOP condition is executed. When
VCC falls below 1.25 x VBAT, the device terminates an access in progress and resets the device
address counter. Inputs to the device will not be recognized at this time to prevent erroneous data
from being written to the device from an out-oftolerance system. When VCC falls below VBAT,
the device switches into a low-current battery-backup mode. Upon power-up, the device switches
from battery to VCC when VCC is greater than VBAT +0.2V and recognizes inputs when VCC
is greater than 1.25 x VBAT. The block diagram in Figure 1 shows the main elements of the
serial RTC.

6.3.1 Features

• Real-Time Clock (RTC) Counts Seconds,


• Minutes, Hours, Date of the Month, Month,
• Day of the week, and Year with Leap-Year
• Compensation Valid Up to 2100
• 56-Byte, Battery-Backed, Nonvolatile (NV)
• RAM for Data Storage
• I2C Serial Interface
• Programmable Square-Wave Output Signal
• Automatic Power-Fail Detect and Switch
• Circuitry
• Consumes Less than 500nA in Battery-

56
SIX MONTHS INDUSTRIAL TRAINING REPORT DUCAT,NOIDA

• Backup Mode with Oscillator Running


• Optional Industrial Temperature Range:
• -40°C to +85°C
• Available in 8-Pin DIP or SO
• Underwriters Laboratory (UL) Recognized

57
SIX MONTHS INDUSTRIAL TRAINING REPORT DUCAT,NOIDA

7.RS232:

RS-232 (Recommended standard-232) is a standard interface approved by the Electronic


Industries Association (EIA) for connecting serial devices. In other words, RS-232 is a long
established standard that describes the physical interface and protocol for relatively low-speed
serial data communication between computers and related devices. An industry trade group, the
Electronic Industries Association (EIA), defined it originally for teletypewriter devices. In 1987,
the EIA released a new version of the standard and changed the name to EIA-232-D. Many
people, however,still refer to the standard as RS-232C, or just RS-232. RS-232 is the interface
that your computer uses to talk to and exchange data with your modem and other serial devices.
The serial ports on most computers use a subset of the RS-232C standard.

RS232 on DB9 (9-pin D-type connector):

There is a standardized pinout for RS-232 on a DB9 connector, as shown below

Pin No
Signal Description
1 DCD Data carrier detect
2 RxD Receive Data
3 TxD Transmit Data
4 DTR Data terminal ready
5 GND Signal ground
6 DSR Data set ready
7 RTS Ready to send
8 CTS Clear to send
9 RI Ring Indicator

58
SIX MONTHS INDUSTRIAL TRAINING REPORT DUCAT,NOIDA

Signal Description:

TxD: - This pin carries data from the computer to the serial device
RXD: - This pin carries data from the serial device to the computer
DTR signals: - The computer to signal that it is ready to communicate with the serial device like
modem uses DTR. In other words, DTR indicates to the Dataset (i.e., the modem or DSU/CSU)
that the DTE (computer) is ON.
DSR: - Similarly to DTR, Data set ready (DSR) is an indication from the Dataset that it is ON.
DCD: - Data Carrier Detect (DCD) indicates that carrier for the transmit data is ON.
RTS: - This pin is used to request clearance to send data to a modem
CTS: - The serial device to acknowledge the computer’s RTS Signal uses this pin.
In most situations, RTS and CTS are constantly on throughout the communication session. Clock
signals (TC, RC, and XTC): - The clock signals are only used for synchronous communications.
The modem or DSU extracts the clock from the data stream and provides a steady clock signal to
the DTE. Note that the transmit and receive clock signals do not have to be the same, or even at
the same baud rate.
CD: - CD stands for Carrier Detect. Carrier Detect is used by a modem to signal that it has a
made a connection with another modem, or has detected a carrier tone. In other words, this is
used by the modem to signal that a carrier signal has been received from a remote modem.
RI: - RI stands for Ring Indicator. A modem toggles (keystroke) the state of this line when an
incoming call rings your phone. In other words, this is used by an auto answer modem to signal
the receipt of a telephone ring signal. The Carrier Detect (CD) and the Ring Indicator (RI) lines
are only available in connections to a modem. Because most modems transmit status information
to a PC when either a carrier signal is detected (i.e. when a connection is made to another
modem) or when the line is ringing, these two lines are rarely used.

7.4.2 Limitations of RS-232:

59
SIX MONTHS INDUSTRIAL TRAINING REPORT DUCAT,NOIDA

RS-232 has some serious shortcomings as an electrical interface. Firstly, the interface
presupposes a common ground between the DTE and DCE. This is a reasonable assumption
where a short cable connects a DTE and DCE in the same room, but with longer lines and
connections between devices that may be on different electrical busses, this may not be true. We
have seen some spectacular electrical events causes by "uncommon grounds". Secondly, a signal
on a single line is impossible to screen effectively for noise. By screening the entire cable one
can reduce the influence of outside noise, but internally generated noise remains a problem. As
the baud rate and line length increase, the effect of capacitance between the cables introduces
serious cross talk until a point is reached where the data itself is unreadable. Using low
capacitance cable can reduce cross talk. Also, as it is the higher sequences that are the problem,
control of slew rate in the signal (i.e., making the signal more rounded, rather than square) also
decreases the cross talk. The original specifications for RS-232 had no specification for
maximum slew rate. Voltage levels with respect to ground represent the RS 232 signals. There is
a wire for each signal, together with the ground signal (reference for voltage levels). This
interface is useful for point-to-point communication at slow speeds. For example, port COM1 in
a PC can be used for a mouse, port COM2 for a modem, etc. This is an example of point-to-point
communication: one port, one device. Due to the way the signals are connected, a common
ground is required. This implies limited cable length - about 30 to 60 meters maximum. (Main
problems are interference and resistance of the cable.) Shortly, RS 232 was designed for
communication of local devices, and supports one transmitter and one receiver.

Converters:

Converters in general can be used to change the electrical characteristic of one communications
standard into another, to take advantage of the best properties of the alternate standard selected.
For example, an Automatic RS232<=>RS485 converter, could be connected to a computer’s
RS232, full-duplex port, and transform it into an RS485 half-duplex, multi-drop network at
distances up to 4000ft. Converters in most instances, pass data through the interface without
changing the timing and/or protocol. While the conversion is "transparent" the software must be
able to communicate with the expanded network features. An "Automatic Converter"
(RS232<=>RS485) will turn on the RS485 transmitter when data is detected on the RS232 port,
and revert back into the receive mode after a character has been sent. This avoids timing
60
SIX MONTHS INDUSTRIAL TRAINING REPORT DUCAT,NOIDA

problems (and software changes) that are difficult to deal with in typical systems. When full
duplex is converted into half-duplex only one device at a time can transmit data. Automatic
Converters take care of the timing problems and allow fast communications without software
intervention.

61
SIX MONTHS INDUSTRIAL TRAINING REPORT DUCAT,NOIDA

8. LIQUID CRYSTAL DISPLAY (LCD)


Liquid Crystal Displays have materials, which combine the properties of both liquids and
crystals. LCD consists of two glass panels, with the Liquid Crystal material sand witched in
between them. The inner surfaces of the glass plates are coated with transparent electrodes,
which define the character, symbols or patterns to be displayed.The LCDs are lightweight with
only a few millimeters thickness. Since the LCDs consume less power, they are compatible with
low power electronic circuits and can be powered for long durations.The LCDs don’t generate
light and so light is needed to read the display. By using backlighting, reading is possible in the
dark. The LCDs have long life and wide operating temperature range. A brighter display can be
obtained by providing backlighting.

LCD has single line display, Two-line display, four line display

Single line display


01 16

80 87 C0 C7

Two-line display

80 8F

C0 CF

62
SIX MONTHS INDUSTRIAL TRAINING REPORT DUCAT,NOIDA

Registers

The Controller has two 8-bit registers. Instruction Registers (IR) and Data Registers (DR). The
IR stores the instruction codes and address instruction for Display Data RAM (DD RAM) and
Character Generator RAM (CG RAM). The DR temporarily stores data to be written to/read
from DD RAM or CG RAM. When an address code is written to IR, the data (of the specified
address) is automatically transferred from the DD RAM or CG RAM to the DR

Display Data RAM (DD RAM)

The characters to be displayed are written into the Display Data RAM (DDRAM) in the form of
8-bit character codes.

Character Generator ROM (CG ROM)

The character generator ROM generates 5x8 dot or 5x10 dot character patterns from 8-bit
character codes. It can generate 208, 5x8 dot character patterns and 32, 5x10 dot character
patterns.

Hardware Configuration

The initial equates are

RS EQU P0.0 (PORT-0)

EN EQU P0.1

DATA0 EQU P0.2

DATA1 EQU P0.3

63
SIX MONTHS INDUSTRIAL TRAINING REPORT DUCAT,NOIDA

DATA2 EQU P0.4

DATA3 EQU P0.5

PIN DETAILS

Pin No. Symbol Description

1 VSS Ground Terminal, 0V

2 VDD Supply Terminal, +5V

3 VLCD Power supply to control


Contrast

4 RS Register Select:
RS = 0-Instrution Register
RS = 1-Data Register

5 R/W Read/Write:
R/W = 0 – Write
R/W = 1 – Read

6 EN Enable

7-14 DB0-DB7 8-bit Data Bus

15 LED+ Supply Terminal,+5V


16 LED- Ground Terminal,0V

64
SIX MONTHS INDUSTRIAL TRAINING REPORT DUCAT,NOIDA

9. Stepper Motors
A stepper motor is a permanent magnet or variable reluctance dc motor that has the following
performance characteristics:

1. rotation in both directions,

2. precision angular incremental changes,

3. repetition of accurate motion or velocity profiles,

4. a holding torque at zero speed, and

5. capability for digital control.

A stepper motor can move in accurate angular increments knows as steps in response to the
application of digital pulses to an electric drive circuit from a digital controller. The number and
rate of the pulses control the position and speed of the motor shaft. Generally, stepper motors are
manufactured with steps per revolution of 12, 24, 72, 144, 180, and 200, resulting in shaft
increments of 30, 15, 5, 2.5, 2, and 1.8 degrees per step.

Stepper motors are either bipolar, requiring two power sources or a switchable polarity power
source, or unipolar, requiring only one power source. They are powered by dc current sources
and require digital circuitry to produce the coil energizing sequences for rotation of the motor.
Feedback is not always required for control, but the use of an encoder or other position sensor
can ensure accuracy when it is essential. The advantage of operating without feedback is that a
closed loop control system is not required. Generally, stepper motors produce less than 1
horsepower(746W) and are therefore frequently used in low-power position control applications.

65
SIX MONTHS INDUSTRIAL TRAINING REPORT DUCAT,NOIDA

10.PROJECT UNDER TAKEN:

Cell phone Operated Land Rover Robot

66
SIX MONTHS INDUSTRIAL TRAINING REPORT DUCAT,NOIDA

10.1INTRODUCTION:
Conventionally,Wireless-controlled robots use rf circuits, which
have the drawbacks of limited working range, limited frequency range and the limited control.
Use of a mobile phone for robotic control can overcome these limitations. It provides the
advantage of robust control, working range as large as the coverage area of the service provider,
no interference with other controllersand up to twelve controlles.

Although the appearance and the capabilities of robots vary


vastly, all robots share the feature of a mechanical, movable structure under some form of
control. The Control of robot involves three distinct phases: perception, processing and action.
Generally, the preceptors are sensors mounted on the robot , processing is done by the on-board
microcontroller or processor, and the task is perfomed using motors or with some other actuators.

67
SIX MONTHS INDUSTRIAL TRAINING REPORT DUCAT,NOIDA

10.2PROJECT PREFACE:

In this project the robot, is controlled by a mobile phone that makes call to the mobile phone
attached to the robot in the course of the call, if any button is pressed control corresponding to
the button pressed is heard at the other end of the call. This tone is called dual tone multi
frequency tome (DTMF) robot receives this DTMF tone with the help of phone stacked in the
robot
The received tone is processed by the atmega16
microcontroller with the help of DTMF decoder MT8870 the decoder decodes the DTMF tone in
to its equivalent binary digit and this binary number is send to the microcontroller, the
microcontroller is preprogrammed to take a decision for any give input and outputs its decision
to motor drivers in order to drive the motors for forward or backward motion or a turn.

The mobile that makes a call to the mobile phone stacked in the robot acts as a remote. So this
simple robotic project does not require the construction ofreceiver and transmitter units.
DTMF signaling is used for telephone signaling over the line in the voice frequency band to the
call switching center. The version of DTMF used for telephone dialing is known as touch tone.
DTMF assigns a specific frequency (consisting of two separate tones) to each key s that it can
easily be identified by the electronic circuit. The signal generated by the DTMF encoder is the
direct al-gebric submission, in real time of the amplitudes of two sine(cosine) waves of different
frequencies, i.e. ,pressing 5 will send a tone made by adding 1336hz and 770hz to the other end
of the mobile. The tones and assignments in a dtmf system shown below .

68
SIX MONTHS INDUSTRIAL TRAINING REPORT DUCAT,NOIDA

10.3.TECHNOLOGY USED:
Dual-Tone Multi-Frequency (DTMF)

Dual-tone multi-frequency (DTMF) signaling is used for


telecommunication signaling over analog telephone lines in the voice-frequency band between
telephone handsets and other communications devices and the switching center. The version of
DTMF used for telephone tone dialing is known by the trademarked term Touch-Tone (canceled
March 13, 1984), and is standardized by ITU-T Recommendation Q.23. It is also known in the
UK as MF4. Other multi-frequency systems are used for signaling internal to the telephone
network.

69
SIX MONTHS INDUSTRIAL TRAINING REPORT DUCAT,NOIDA

10.4.HARDWARE DESCRIPTION:
This project contains mainly four modules which encapsulates the working of
whole project and these are as follows:

10.4.0 Block Diagram


10.4.1 Power Supply Unit
10.4.2 Microcontoller Unit
10.4.3 MAX232 Unit
10.4.4 DTMF 8870
10.4.5 L57404 (Inverting IC)
10.4.6 L293D (motor driving IC)

70
SIX MONTHS INDUSTRIAL TRAINING REPORT DUCAT,NOIDA

10.4.0BLOCK DIAGRAM:

L293D

STEPPER MOTORS
10.4.1. POWER SUPPLY UNIT (+5V)
71
SIX MONTHS INDUSTRIAL TRAINING REPORT DUCAT,NOIDA

Power supplies are designed to convert high voltage AC mains electricity to a suitable
low voltage supply for electronics circuits and other devices. A power supply can by broken
down into a series of blocks, each of which performs a particular function.
For a 5V regulated supply :

Fig. 2
Each of the block has its own function as described below
1. Transformer – steps down high voltage AC mains to low voltage AC.
2. Rectifier – converts AC to DC, but the DC output is varying.
3. Smoothing – smooths the DC from varying greatly to a small ripple.
4. Regulator – eliminates ripple by setting DC output to a fixed voltage.

TRANSFORMER
Transformers convert AC electricity from one voltage to another with little loss of
power. Transformers work only with AC and this is one of the reasons why mains electricity
is AC. The two types of transformers
 Step-up transformers increase voltage,
 Step-down transformers reduce voltage.

Fig. 3 Transformer

72
SIX MONTHS INDUSTRIAL TRAINING REPORT DUCAT,NOIDA

Most power supplies use a step-down transformer to reduce the dangerously


high mains voltage (230V in UK) to a safer low voltage. The input coil is called the
primary and the output coil is called the secondary. There is no electrical connection
between the two coils, instead they are linked by an alternating magnetic field created in
the soft-iron core of the transformer. The two lines in the middle of the circuit symbol represent
the core.

Transformers waste very little power so the power out is (almost) equal to the power in.
Note that as voltage is stepped down current is stepped up. The ratio of the number of turns
on each coil, called the turns ratio, determines the ratio of the voltages. A step-down
transformer has a large number of turns on its primary (input) coil which is connected to the
high voltage mains supply, and a small number of turns on its secondary (output) coil to
give a low output voltage.

Turns ratio = Vp = Np
Vs Ns

And

Power Out = Power In


Vs × Is Vp × Ip

Where
Vp = primary (input) voltage
Np = number of turns on primary coil
Ip = primary (input) current
Ns = number of turns on secondary coil
Is = secondary (output) current
Vs = secondary (output) voltage

73
SIX MONTHS INDUSTRIAL TRAINING REPORT DUCAT,NOIDA

RECTIFIER
A bridge rectifier can be made using four individual diodes, but it is also available in
special packages containing the four diodes required. It is called a full-wave rectifier because
it uses all the AC wave (both positive and negative sections). 1.4V is used up in the bridge
rectifier because each diode uses 0.7V when conducting and there are always two diodes
conducting, as shown in the diagram below. Bridge rectifiers are rated by the maximum current
they can pass and the maximum reverse voltage they can withstand (this must be at least
three times the supply RMS voltage so the rectifier can withstand the peak voltages). Please
see the DIODES page for more details, including pictures of bridge rectifiers. In this alternate
pairs of diodes conduct, changing over the connections so the alternating directions of AC are
converted to the one direction of DC.

Fig. 4 OUTPUT – Full-wave Varying DC

Smoothing
Smoothing is performed by a large value electrolytic capacitor connected across the DC
supply to act as a reservoir, supplying current to the output when the varying DC voltage from
the rectifier is falling. The diagram shows the unsmoothed varying DC (dotted line) and the
smoothed DC (solid line). The capacitor charges quickly near the peak of the varying DC,
and then discharges as it supplies current to the output.

74
SIX MONTHS INDUSTRIAL TRAINING REPORT DUCAT,NOIDA

Fig. 5 Capacitor Voltage

Note that smoothing significantly increases the average DC voltage to almost the
peak value (1.4 × RMS value). For example 6V RMS AC is rectified to full wave DC of
about 4.6V RMS (1.4V is lost in the bridge rectifier), with smoothing this increases to
almost the peak value giving 1.4 × 4.6 = 6.4V smooth DC.
Smoothing is not perfect due to the capacitor voltage falling a little as it discharges,
giving a small ripple voltage. For many circuits a ripple which is 10% of the supply voltage
is satisfactory and the equation below gives the required value for the smoothing capacitor. A
larger capacitor will give less ripple. The capacitor value must be doubled when smoothing half-
wave DC.

Smoothing capacitor for 10% ripple, C = 5 × Io


Vs × f
Where,
C = smoothing capacitance in farads (F)
Io = output current from the supply in amps (A)
Vs = supply voltage in volts (V), this is the peak value of the unsmoothed DC
f = frequency of the AC supply in hertz (Hz), 50Hz in the UK
REGULATOR

Fig. 6 Regulator

75
SIX MONTHS INDUSTRIAL TRAINING REPORT DUCAT,NOIDA

Voltage regulator ICs are available with fixed (typically 5, 12 and 15V) or variable
output voltages. They are also rated by the maximum current they can pass. Negative voltage
regulators are available, mainly for use in dual supplies. Most regulators include some automatic
protection from excessive current ( 'overload protection') and overheating ( 'thermal
protection'). Many of the fixed voltage regulator ICs have 3 leads and look like power
transistors, such as the 7805 +5V 1A regulator shown on the right. They include a hole for
attaching a heatsink if necessary.

Working Of Power Supply


 Transformer

Fig. 7 Transformer Output

The low voltage AC output is suitable for lamps, heaters and special AC motors. It is not
suitable for electronic circuits unless they include a rectifier and a smoothing capacitor.

Transformer + Rectifier

Fig. 8 Rectifier Stage Output


The varying DC output is suitable for lamps, heaters and standard motors. It is not
suitable for electronic circuits unless they include a smoothing capacitor.
76
SIX MONTHS INDUSTRIAL TRAINING REPORT DUCAT,NOIDA

Transformer + Rectifier + Smoothing

Fig. 9 Filtered Output


The smooth DC output has a small ripple. It is suitable for most electronic circuits.
Transformer + Rectifier + Smoothing + Regulator

D 1 L M 7 8 0 5
1 N 4 0 0 7 + 5 V
1 2
V I NV O U T

GND
J 1 D 2 1 0 0 0 u f
3
2 g n d C 1

3
1 V
D 3

D 4

Fig. 10 Power Supply

The regulated DC output is very smooth with no ripple. It is suitable for all electronic
circuits.

77
SIX MONTHS INDUSTRIAL TRAINING REPORT DUCAT,NOIDA

10.4.2 MICROCONTROLLER UNIT


VARIOUS TYPE OF MICROCONTOLLERS:

First microcontroller is ‘8031’

 FEATURES
(i) It is Intel’s product. Neither a microprocessor nor a microcontroller.
(ii) It is a 8-bit controller.
(iii) Internally no ROM is provided i.e. code is outside the chip.

Second microcontroller is ‘8051’

 FEATURES
(i) It is a first complete 8-bit microcontroller.

78
SIX MONTHS INDUSTRIAL TRAINING REPORT DUCAT,NOIDA

(ii) It is a name of a family. In which the instruction set, pin configuration,


architecture are same, only memory storage capacity is different.
(iii) Internally PROM (programmable read only memory) is provided so it called one
time programmable (OTP).

Third microcontroller is ‘AT89C51’

 FEATURES
(ii) It is ATMEL’s product.
(iii) It is a similar to 8051 microcontroller i.e. having same instruction set, pin
configuration, architecture.
(iv)It is a also 8-bit microcontroller. It’s cost is only Rs10 more than 8051.
(v) It uses EPROM (erasable programmable read only memory) or FLASH memory.
(vi)It is Multiple time programmable (MTP) i.e. 1000 times. So it is better than
8051.
(vii) In ‘AT89C51’, ‘C’ stands for CMOS technology used in the manufacturing
of the I.C.

ATMEL89C52
Description
The AT89C52 is a low-power, high-performance CMOS 8-bit microcomputer with 8K
bytes of Flash programmable and erasable read only memory (PEROM). The device
is manufactured using Atmel’s high-density nonvolatile memory technology and is
compatible with the industry-standard 80C51 and 80C52 instruction set and pinout.
The on-chip Flash allows the program memory to be reprogrammed in-system or by a
conventional nonvolatile memory programmer. By combining a versatile 8-bit CPU
with Flash on a monolithic chip, the Atmel AT89C52 is a powerful microcomputer
which provides a highly-flexible and cost-effective solution to many embedded control
applications.

79
SIX MONTHS INDUSTRIAL TRAINING REPORT DUCAT,NOIDA

PIN DISCRIPTION

The ATMEL89C52 have a total of 40 pins that are dedicated for various functions such as I/O,
RD, WR, address and interrupts. Out of 40 pins, a total of 32 pins are set aside for the four ports
P0, P1, P2, and P3, where each port takes 8 pins. The rest of the pins are designated as Vcc,

80
SIX MONTHS INDUSTRIAL TRAINING REPORT DUCAT,NOIDA

GND, XTAL1, XTAL, RST, EA, and PSEN. All these pins except PSEN and ALE are used by
all members of the 8051 and 8031 families. In other words, they must be connected in order for
the system to work, regardless of whether the microcontroller is of the 8051 or the 8031 family.
The other two pins, PSEN and ALE are used mainly in 8031 based systems.

10.4.3Max232 UNIT:

The MAX232 is an electronic circuit that converts signals from a serial port to signals suitable
for usage in e.g. microprocessor circuits.
When communicating with various micro processors one needs to convert the RS232
levels down to lower levels, typically 3.3 or 5.0 Volts. Serial RS-232 communication works
with voltages -15V to +15V for high and low. On the other hand, TTL logic operates between
0V and +5V . Modern low power consumption logic operates in the range of 0V and +3.3V or
even lower.
Thus the RS-232 signal levels are far too high TTL electronics, and the negative RS-232
voltage for high can’t be handled at all by computer logic. To receive serial data from an RS-232
interface the voltage has to be reduced. Also the low and high voltage level has to be inverted.
The level converter uses a Max232 and five capacitors.

MAX 232 (communication interface)


This chip is used when interfacing micro controller with PC to check the Baud rate and
changes the voltage level because micro controller is TTL compatible whereas PC is CMOS
compatible. The MAX 232 IC contains the necessary drivers{two} and receivers {two}, to adapt
the RS- 232 signal voltage levels to TTL logic.It became popular,because it just needs one
voltage{+5V} and generates the necessary RS-232 voltage levels{approx -10V AND +10V}
internally.This greatly simplified the design of circuitry.And this made the IC so
popular.MAX232 is just a driver/receiver.It does not generate the necessary RS-232 sequence of

81
SIX MONTHS INDUSTRIAL TRAINING REPORT DUCAT,NOIDA

marks and spaces with the right timing,it does not decode RS-232 signal, it does not provide a
serial /parallel conversion.All it does is to convert signal voltage levels.

Fig. 15 PIN DIAGRAM

General Description
The MAX220–MAX249 family of line drivers/receivers is intended for all EIA/TIA-
232E and V.28/V.24 communications interfaces, particularly applications where ±12V is not
available. These parts are especially useful in battery-powered systems, since their low-power
shutdown mode reduces power dissipation to less than 5µW.

Applications
• Portable Computers
• Low-Power Modems
• Interface Translation
• Battery-Powered RS-232 Systems
• Multidrop RS-232 Networks

Features
1. Superior to bipolar
2. Low-power receive mode in shutdown
3. Meet all EIA/TIA-232E and v.28 specifications.
4. 3-state driver and receiver output.
The MAX220–MAX249 contain four sections: dual charge-pump DC-DC voltage
converters, RS-232 drivers, RS-232 receivers, and receiver and transmitter enable control inputs.

82
SIX MONTHS INDUSTRIAL TRAINING REPORT DUCAT,NOIDA

Dual Charge-Pump Voltage Converter


The MAX220–MAX249 have two internal charge-pumps that convert +5V to ±10V
(unloaded) for RS-232 driver operation. The first converter uses capacitor C1 to double the +5V
input to +10V on C3 at the V+ output. The second converter uses capacitor C2 to invert +10V to
-10V on C4 at the V- output. A small amount of power may be drawn from the +10V (V+) and
-10V (V-) outputs to power external circuitry except on the MAX225 and MAX245–MAX247,
where these pins are not available. V+ and V- are not regulated, so the output voltage drops with
increasing load current. Do not load V+ and V- to a point that violates the minimum ±5V
EIA/TIA-232E driver output voltage when sourcing current from V+ and V- to external circuitry.
When using the shutdown feature in the MAX222, MAX225, MAX230, MAX235, MAX236,

83
SIX MONTHS INDUSTRIAL TRAINING REPORT DUCAT,NOIDA

MAX240, MAX241, and MAX245–MAX249, avoid using V+ and V to power external


circuitry. When these parts are shut down, V- falls to 0V, and V+ falls to +5V. For applications
where a +10V external supply is applied to the V+ pin (instead of using the internal charge pump
to generate +10V), the C1 capacitor must not be installed and the SHDN pin must be tied to
VCC. This is because V+ is internally connected to VCC in shutdown mode.

RS-232 Drivers
The typical driver output voltage swing is ±8V when loaded with a nominal 5kΩ RS-232
receiver and VCC = +5V. Output swing is guaranteed to meet the EIA/TIA- 232E and V.28
specification, which calls for ±5V minimum driver output levels under worst-case conditions.
These include a minimum 3kΩ load, VCC = +4.5V, and maximum operating temperature.
Unloaded driver output voltage ranges from (V+ -1.3V) to (V- +0.5V). Input thresholds are both
TTL and CMOS compatible. The inputs of unused drivers can be left unconnected since 400kΩ
input pull-up resistors to VCC are built in (except for the MAX220). The pull-up resistors force
the outputs of unused drivers low because all drivers invert. The internal input pull-up resistors
typically source 12µA, except in shutdown mode where the pull-ups are disabled. Driver outputs
turn off and enter a high-impedance state—where leakage current is typically microamperes
(maximum 25µA)—when in shutdown mode, or when in three-state mode, device power is
removed. Outputs can be driven to ±15V. The power supply current typically drops to 8µA in
shutdown mode.
The MAX220 does not have pull-up resistors to force the outputs of the unused drivers
low. Connect unused inputs to GND or VCC. The MAX239 has a receiver three-state control
line, and the MAX223, MAX225, MAX235, MAX236, MAX240, and MAX241 have both a
receiver three-state control line and a low-power shutdown control. The receiver TTL/CMOS
outputs are in a high-impedance, three-state mode whenever the three-state enable line is high
(for the MAX225/MAX235/MAX236/MAX239– MAX241), and are also high-impedance

84
SIX MONTHS INDUSTRIAL TRAINING REPORT DUCAT,NOIDA

whenever the shutdown control line is high. When in low-power shutdown mode, the driver
outputs are turned off and their leakage current is less than 1µA with the driver output pulled to
ground. The driver output leakage remains less than 1µA, even if the transmitter output is back
driven between 0V and (VCC + 6V). Below -0.5V, the transmitter is diode clamped to ground
with 1kΩ series impedance. The transmitter is also zener clamped to approximately VCC + 6V,
with a series impedance of 1kΩ. The driver output slew rate is limited to less than 30V/µs as
required by the EIA/TIA-232E and V.28 specifications. Typical slew rates are 24V/µs unloaded
and 10V/µs loaded with 3Ω and 2500pF.

10.4.4DTMF (M-8870):
Dual-tone multi-frequency signaling (DTMF) is used for
telecommunication signaling over analog telephone lines in the voice-frequency
band between telephone handsets and other communications devices and the
switching center. The version of DTMF that is used in push-button telephones for
tone dialing is known as Touch-Tone, first used by AT&T in commerce as a
registered trademark
The Touch-Tone system, using the telephone keypad,
gradually replaced the use of rotary dial starting in 1963, and since then DTMF or
Touch-Tone became the industry standard for both cell phones and landline
service.

#, *, A, B, C, and D

DTMF keypad layout.


DTMF keypad frequencies (with sound clips)
85
SIX MONTHS INDUSTRIAL TRAINING REPORT DUCAT,NOIDA

1209 Hz 1336 Hz 1477 Hz 1633 Hz


697 Hz 1 2 3 A
770 Hz 4 5 6 B
852 Hz 7 8 9 C
941 Hz * 0 # D

Description of DTMF decoder IC:


The M-8870 is a full DTMF Receiver that integrates both bandsplit
filter and decoder functions into a single 18-pin DIP or SOIC package.
Manufactured using CMOS process technology, the M-8870 offers low power
consumption (35 mW max) and precise data handling. Its filter section uses
switched capacitor technology for both the high and low group filters and for dial
tone rejection. Its decoder uses digital counting techniques to detect and decode all
16 DTMF tone pairs into a 4-bit code.

PIN DIAGRAM:

TONE DECODING:

86
SIX MONTHS INDUSTRIAL TRAINING REPORT DUCAT,NOIDA

Applications:
• Telephone switch equipment
• Remote data entry
• Paging systems
• Personal computers
• Credit card systems

10.4.5 L57404 (HEX Inverting IC):


In digital logic, an inverter or NOT gate is a logic gate which implements logical negation.

Shown above:The NOT gate on lines 3 and 4 will


be put into an astable mode where no definite state can be resolved. Consequently, the LED will
blink on and off at a rate dependent on the response time of the inverter gate (NOT gate) and
prorogation delays. With adequate support electronics, the blink rate can be precisely controlled.
Performing similar experiments can also allow the simple construction of AM radio transmitters,
since the speed of most 7404 chips is well beyond the range of standard AM radios. Outputs of

87
SIX MONTHS INDUSTRIAL TRAINING REPORT DUCAT,NOIDA

one gate can be connected to inputs of another within the same chip or to another chip as long as
they share the same ground. The figure to the left illustrates a basic circuit showing how to wire
inputs and using LEDs to display outputs.

10.4.6 L293D:
Whenever a robotics hobbyist talk about making a robot, the first
thing comes to his mind is making the robot move on the ground. And there are always two
options in front of the designer whether to use a DC motor or a stepper motor. When it comes to
speed, weight, size, cost... DC motors are always preffered over stepper motors. There are many
things which you can do with your DC motor when interfaced with a microcontroller. For
example you can control the speed of motor, you can control the direction of rotation, you can
also do encoding of the rotation made by DC motor i.e. keeping track of how many turns are
made by your motors etc. So you can see DC motors are no less than a stepper motor.

In this,l we will learn to interfacing a DC motor with a


microcontroller. Usually H-bridge is preffered way of interfacing a DC motor. These days many
IC manufacturers have H-bridge motor drivers available in the market like L293D is most used
H-Bridge driver IC. H-bridge can also be made with the help of trasistors and MOSFETs etc.
rather of being cheap, they only increase the size of the design board, which is somtimes not
required so using a small 16 pin IC is preffered for this purpose.

►Working
88
SIX MONTHS INDUSTRIAL TRAINING REPORT DUCAT,NOIDA

The name "H-Bridge" is derived from the actual shape of the switching circuit
which control the motoion of the motor. It is also known as "Full Bridge". Basically there are
four switching elements in the H-Bridge as shown in the figure below.

As you can see in the figure above there are four switching
elements named as "High side left", "High side right", "Low side right", "Low side left". When
these switches are turned on in pairs motor changes its direction accordingly. Like, if we switch
on High side left and Low side right then motor rotate in forward direction, as current flows from
Power supply through the motor coil goes to ground via switch low side right. This is shown in
the figure below.

Similarly, when you switch on low side left and high side right,
89
SIX MONTHS INDUSTRIAL TRAINING REPORT DUCAT,NOIDA

the current flows in opposite direction and motor rotates in backward direction. This is the basic
working of H-Bridge. We can also make a small truth table according to the switching of H-
Bridge explained above.

Truth Table
High Left High Right Low Left Low Right Description
On Off Off On Motor runs clockwise
Off On On Off Motor runs anti-clockwise
On On Off Off Motor stops or decelerates
Off Off On On Motor stops or decelerates

As already said, H-bridge can be made with the help of trasistors


as well as MOSFETs, the only thing is the power handling capacity of the circuit. If motors are
needed to run with high current then lot of dissipation is there. So head sinks are needed to cool
the circuit.

Now you might be thinkin why i did not discuss the cases like High
side left on and Low side left on or high side right on and low side right on. Clearly seen in the
diagra, you don't want to burn your power supply by shorting them. So that is why those
combinations are not discussed in the truth table

L293D is a dual H-Bridge motor driver, So with one IC we can


interface two DC motors which can be controlled in both clockwise and counter clockwise
direction and if you have motor with fix direction of motion the you can make use of all the four
I/Os to connect up to four DC motors. L293D has output current of 600mA and peak output
current of 1.2A per channel. Moreover for protection of circuit from back EMF ouput diodes are
included within the IC. The output supply (VCC2) has a wide range from 4.5V to 36V, which
has made L293D a best choice for DC motor driver.
A simple schematic for interfacing a DC motor using L293D is shown below.

90
SIX MONTHS INDUSTRIAL TRAINING REPORT DUCAT,NOIDA

As you can see in the circuit, three pins are needed for
interfacing a DC motor (A, B, Enable). If you want the o/p to be enabled completely then you
can connect Enable to VCC and only 2 pins needed from controller to make the motor work.

10.5 CIRCUIT DIAGRAM:

91
SIX MONTHS INDUSTRIAL TRAINING REPORT DUCAT,NOIDA

10.6 PCB LAYOUT:

92
SIX MONTHS INDUSTRIAL TRAINING REPORT DUCAT,NOIDA

10.7 MICROCONTROLLER CODE:


93
SIX MONTHS INDUSTRIAL TRAINING REPORT DUCAT,NOIDA

Hardware declaration
lcdport equ p1
rs equ p2.6
en equ p2.5
buzzer bit p0.1
led bit p0.0
enm bit p2.0
ma1 bit p2.1
mb1 bit p2.2
ma2 bit p2.3
mb2 bit p2.4
s1 bit p0.2
s2 bit p0.3
s3 bit p0.4
s4 bit p0.5

ORG 0030H
POWERON: MOV SP,#70H ; Move the stack pointer at 70h location
MOV IE,#00H ; Disable all the interrupts
MOV IP,#00H ; Dissable the interrupt priority
register
MOV P0,#0FFH ; Move 0FFH in in port 0
MOV P1,#0FFH ; Move 0FFH in in port 1
MOV P2,#0FFH ; Move 0FFH in in port 2
MOV P3,#0FFH ; Move 0FFH in in port 3
RAM CLEARANCE
MOV R0,#7FH
RAM_CLR: MOV @R0,#00H ; Clear the RAM from 00 to 7FH
DJNZ R0,RAM_CLR

MAINPROG
mov lcdport,#38h
acall command
acall delay
mov lcdport,#01h
acall command
acall delay
mov lcdport,#0ch
acall command
acall delay
mov lcdport,#80h
acall command
acall delay
mov dptr,#200h
mov r4,#19
acall display

main:
acall indicator
acall keysense
sjmp main

94
SIX MONTHS INDUSTRIAL TRAINING REPORT DUCAT,NOIDA

indicator:
clr buzzer
acall delay
setb buzzer
acall delay
ret

keysense:

mov a,p0
anl a,#11110000b
cjne a,#11110000b,check1
acall forward
acall delay
mov lcdport,#80h
acall command
acall delay
mov dptr,#220h
mov r4,#10
acall display
acall indicator
sjmp keysense
check1:
mov a,p1
anl a,#00110000b
cjne a,#00110000b,check2
acall left
acall delay
mov lcdport,#80h
acall command
acall delay
mov dptr,#240h
mov r4,#10
acall display
acall indicator
sjmp main

check2:
mov a,p1
anl a,#11000000b
cjne a,#11000000b,exit
acall right
acall delay
mov lcdport,#80h
acall command
acall delay
mov dptr,#260h
mov r4,#10
acall display
acall indicator
sjmp keysense
exit:

95
SIX MONTHS INDUSTRIAL TRAINING REPORT DUCAT,NOIDA

acall stop
acall delay
mov dptr,#280h
mov r4,#10
mov lcdport,#80h
acall command
acall delay
acall display
ljmp main
ret

backward:
setb p2.3
setb p2.4
sjmp keysense
ret

forward:
setb enm
setb ma1
clr mb1
setb enm
setb ma2
clr mb2
ret

left:
setb enm
setb ma1
clr mb1
setb enm
clr ma2
setb mb2
ret

right:
setb enm
clr ma1
setb mb1
setb enm
setb ma2
clr mb2
ret

stop:
setb enm
setb ma1
setb mb1
setb enm
setb ma2
setb mb2

96
SIX MONTHS INDUSTRIAL TRAINING REPORT DUCAT,NOIDA

ret

command:
data:
setb rs
setb en
nop
nop
nop
nop
clr en
ret

delay:
mov r1,#10d
go2:
mov r2,#100d
go3:
mov r3,#100d
go:
djnz r3,go
djnz r2,go3
djnz r1,go2
ret

org 200h
db 'CELLPHONE OPERATED LAND ROVER ROBOT'
org 220h
db 'FORWARD'
org 260h
db 'RIGHT TURN'
org 240h
db 'LEFT TURN'
org 280h
db 'STOP'
end

10.8 FURTHER IMROVEMENTS & FUTURE SCOPE:


97
SIX MONTHS INDUSTRIAL TRAINING REPORT DUCAT,NOIDA

1. IR Sensors:
IR sensors can be used to automatically detect & avoid obstacles if
the robot goes beyond line of sight. This avoids damage to the vehicle if we are maneuvering it
from a distant place.
2. Password Protection:
Project can be modified in order to password protect the robot so
that it can be operated only if correct password is entered. Either cell phone should be password
protected or necessary modification should be made in the assembly language code. This
introduces conditioned access & increases security to a great extent.
3. Alarm Phone Dialer:
By replacing DTMF Decoder IC CM8870 by a 'DTMF Transceiver
IC’ CM8880, DTMF tones can be generated from the robot. So, a project called 'Alarm Phone
Dialer' can be built which will generate necessary alarms for something that is desired to be
monitored (usually by triggering a relay). For example, a high water alarm, low temperature
alarm, opening of back window, garage door, etc.
When the system is activated it will call a number of programmed
numbers to let the user know the alarm has been activated. This would be great to get alerts of
alarm conditions from home when user is at work.
4. Adding a Camera:
If the current project is interfaced with a camera (e.g. a Webcam)
robot can be driven beyond line-of-sight & range becomes practically unlimited as GSM
networks have a very large range.

10.9 INDUSTRIAL APPLICATIONS:


98
SIX MONTHS INDUSTRIAL TRAINING REPORT DUCAT,NOIDA

1) Scientific

Remote control vehicles have various scientific uses including


hazardous environments, working in the deep ocean , and space exploration. The majority of the
probes to the other planets in our solar system have been remote control vehicles, although some
of the more recent ones were partially autonomous. The sophistication of these devices has
fueled greater debate on the need for manned spaceflight and exploration.
2) Military and Law Enforcement

Military usage of remotely controlled military vehicles dates back to


the first half of 20th century. Soviet Red Army used remotely controlled Teletanks during 1930s
in the Winter War and early stage of World War II.
3) Search and Rescue
UAVs will likely play an increased role in search and rescue in the
United States. This was demonstrated by the successful use of UAVs during the 2008 hurricanes
that struck Louisiana and Texas.
3) Recreation and Hobby

See Radio-controlled model. Small scale remote control vehicles


have long been popular among hobbyists. These remote controlled vehicles span a wide range in
terms of price and sophistication. There are many types of radio controlled vehicles. These
include on-road cars, off-road trucks, boats, airplanes, and even helicopters. The "robots" now
popular in television shows such as Robot Wars, are a recent extension of this hobby (these
vehicles do not meet the classical definition of a robot; they are remotely controlled by a human).

10.10 TOOLS/SOFTWARES /COMPONENTS REQUIRED


99
SIX MONTHS INDUSTRIAL TRAINING REPORT DUCAT,NOIDA

• KEIL µ Vision2 Software for programming of Microcontroller.


• I.C Programmer and Software for the burning of the Microcontroller.
• PC and line driver circuit.
• Microphone and audio speaker.
• Components for designing of the embedded part.
Components used:-
" MT8870 DTMF DECODER - 1
" AT89S52 – 1
" L293d motor driver ic - 1
" Cd7004 not gate ic - 1
" 1n4007 diode - 1
" 100k resistances - 2
" 10 k resistances - 5
" 330 k resistances - 1
" 0.47mf capacitors - 1
" 0.1mf capacitors - 1
" 22pf capacitors - 4
" 3.57mhz crystal - 1
" 12mhz crystal - 1
" Push to on switch - 1
" 2 geared motors (6v, 50 rpm) - 2 (4 for four wheel drive)
" Battery 6v – 1
wheels - 4
cellphone - 2 (one urs and one can be ur frnds)
handsfree - 1 (for the phn on the rover)
• Soldering kit.
• Measuring Instruments (Multi-meter), etc.

10.11 BIBLIOGRAPHY/ REFERENCES:


100
SIX MONTHS INDUSTRIAL TRAINING REPORT DUCAT,NOIDA

1. 8051 Microcontroller and Embedded Systems, by Muhammad Ali Mazidi.


2. The 8051 Microcontroller, Kenneth J. Ayala.
3. Programming & Customizing The 8051 Microcontroller, by Predko M
4. www.google.com.
5. www.wikipedia.com.
6. www.electrosoftwiz.com.
7. www.electronics.com.
8. www.datasheets.com

9. www.8051projects.info

10. www.instructables.com

11. “DTMF Tester” , ‘Electronics For You’ Magazine , Edition (June 2003)

12. www.alldatasheet.com

13. www.datasheet4u.com

14. www.datasheetcatalog.com

101
SIX MONTHS INDUSTRIAL TRAINING REPORT DUCAT,NOIDA

102

Potrebbero piacerti anche