Documenti di Didattica
Documenti di Professioni
Documenti di Cultura
TRAINING REPORT
UNDERTAKEN AT
DUCAT, NOIDA
IN
EMBEDDED SYSTEM TECHNOLOGIES
ON
1
SIX MONTHS INDUSTRIAL TRAINING REPORT DUCAT,NOIDA
ACK
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
1.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.
• 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
6
SIX MONTHS INDUSTRIAL TRAINING REPORT DUCAT,NOIDA
• It is classified in to 3 types:
7
SIX MONTHS INDUSTRIAL TRAINING REPORT DUCAT,NOIDA
More s/w and h/w complexity that medium as it contains scalable processors, have
• 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)
8
SIX MONTHS INDUSTRIAL TRAINING REPORT DUCAT,NOIDA
– Required for keeping long times and for operation with Real Time Operating
System (RTOS), which controls the coordinated Operations of multiple systems.
• Communication Circuitry
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
• 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.
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.
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.
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
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
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:
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.
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.
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.
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.
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.
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.
16
SIX MONTHS INDUSTRIAL TRAINING REPORT DUCAT,NOIDA
• Hard disks
• Floppy disks
- capacity 1.44Mb
17
SIX MONTHS INDUSTRIAL TRAINING REPORT DUCAT,NOIDA
• CD-ROM
• Zip disks
- hold up to 250Mb
18
SIX MONTHS INDUSTRIAL TRAINING REPORT DUCAT,NOIDA
3. ‘C’ LANGUAGE
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.
• 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
• 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.
21
SIX MONTHS INDUSTRIAL TRAINING REPORT DUCAT,NOIDA
• 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.
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
• Data Modifiers enable you to have greater control over the data:
1. signed 2. unsigned 3. short 4. long
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
• The if statement
• 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.
data-type Array-Name[Array-Size];
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.
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
(=).
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
• 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.
1. Bubble sort
2. Insertion sort
3. Selection sort
4. Quick 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
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.
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.
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
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.
» 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
• DPTR(16-bit).
• On chip Oscillator.
32
SIX MONTHS INDUSTRIAL TRAINING REPORT DUCAT,NOIDA
33
SIX MONTHS INDUSTRIAL TRAINING REPORT DUCAT,NOIDA
PIN Configuration
34
SIX MONTHS INDUSTRIAL TRAINING REPORT DUCAT,NOIDA
• GND- Ground.
– A high on this pin for two machine cycles while the oscillator is running resets the
device.
• Port 0
– 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.
• Port 1
– 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
– 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
– 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
• 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
XTAL1:
– Input to the inverting oscillator amplifier and input to the Internal clock operating
circuit.
XTAL2:
– Output from the inverting oscillator amplifier.
• 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).
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.
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".
• 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
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
o USB.
o CAN.
o FIREWIRE.
• Requires software layers both on the host computer and on the USB device
42
SIX MONTHS INDUSTRIAL TRAINING REPORT DUCAT,NOIDA
• Evolution
– Signal Integrity
Fewer coinciding signal transitions. Less crosstalk. Less noise. Less inter-signal
skew.
– Cost
Drivers, connectors, cables, receivers
43
SIX MONTHS INDUSTRIAL TRAINING REPORT DUCAT,NOIDA
– Support 1.5Mb/s
• Connectors
– Positive Retention
• Cables
44
SIX MONTHS INDUSTRIAL TRAINING REPORT DUCAT,NOIDA
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.
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.
46
SIX MONTHS INDUSTRIAL TRAINING REPORT DUCAT,NOIDA
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.
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.
• 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).
• Asynchronous.
• Synchronous.
• There are special IC chip made by many manufacturers for serial data communications.
50
SIX MONTHS INDUSTRIAL TRAINING REPORT DUCAT,NOIDA
• 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:
52
SIX MONTHS INDUSTRIAL TRAINING REPORT DUCAT,NOIDA
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
55
SIX MONTHS INDUSTRIAL TRAINING REPORT DUCAT,NOIDA
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
56
SIX MONTHS INDUSTRIAL TRAINING REPORT DUCAT,NOIDA
57
SIX MONTHS INDUSTRIAL TRAINING REPORT DUCAT,NOIDA
7.RS232:
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.
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
LCD has single line display, Two-line display, four line display
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
The characters to be displayed are written into the Display Data RAM (DDRAM) in the form of
8-bit character codes.
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
EN EQU P0.1
63
SIX MONTHS INDUSTRIAL TRAINING REPORT DUCAT,NOIDA
PIN DETAILS
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
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:
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
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.
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)
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:
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
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
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.
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
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.
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.
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
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
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
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.
FEATURES
(i) It is a first complete 8-bit microcontroller.
78
SIX MONTHS INDUSTRIAL TRAINING REPORT DUCAT,NOIDA
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.
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.
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
83
SIX MONTHS INDUSTRIAL TRAINING REPORT DUCAT,NOIDA
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
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
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.
►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
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
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.
91
SIX MONTHS INDUSTRIAL TRAINING REPORT DUCAT,NOIDA
92
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
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.
1) Scientific
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