report on dtmf based land rover

102
PROJECT REPORT ON CELLPHONE OPERATED LAND ROVER (Code: R-05B) Submitted in partial fulfillment for award of degree of Bachelor of Engineering (Electronics and Communication Branch) Awarded by: Maharishi Dayanand University Rohtak During Academic Session 2006-2010 Submitted by: Chandra Kant Pandey, 6EC-31 Kamal Negi, 6EC-52 Rohit Kalra, 6EC-86 Arpit Kohli, 6EC-24 Under the guidance of Ms. Meenakshi Bhat Submitted to: Dr. S.V.A.V. Prasad (HOD) Ms. Pragati Kapoor (Project Coordinator) Mr. Ajay Dagar (Project Coordinator) Department of Electronics and Communication Engineering

Upload: yrikki

Post on 01-May-2017

235 views

Category:

Documents


1 download

TRANSCRIPT

Page 1: Report on Dtmf Based Land Rover

PROJECT REPORT

ON

CELLPHONE OPERATED LAND ROVER

(Code: R-05B)

Submitted in partial fulfillment for award of degree of Bachelor of Engineering (Electronics and Communication Branch)

Awarded by:

Maharishi Dayanand UniversityRohtak

During Academic Session 2006-2010

Submitted by:

Chandra Kant Pandey, 6EC-31Kamal Negi, 6EC-52Rohit Kalra, 6EC-86Arpit Kohli, 6EC-24

Under the guidance ofMs. Meenakshi Bhat

Submitted to:Dr. S.V.A.V. Prasad (HOD)Ms. Pragati Kapoor (Project Coordinator)Mr. Ajay Dagar (Project Coordinator)

Department of Electronics and Communication Engineering

LINGAYA’S INSTITUTE OF MANAGEMENT AND TECHNOLOGY, FARIDABAD

Page 2: Report on Dtmf Based Land Rover

PROJECT REPORT

ON

CELLPHONE OPERATED LAND ROVER

Submitted in partial fulfillment for award of degree of Bachelor of Engineering (Electronics and Communication Branch)

Awarded by:

Maharishi Dayanand UniversityRohtak

During Academic Session 2006-2010

Submitted by:

Chandra Kant Pandey, 6EC-31Kamal Negi, 6EC-52Rohit Kalra, 6EC-86Arpit Kohli, 6EC-24

Under the guidance ofMs. Meenakshi Bhat

Submitted to:Dr. S.V.A.V. Prasad (HOD)Ms. Pragati Kapoor (Project Coordinator)Mr. Ajay Dagar (Project Coordinator)

Department of Electronics and Communication Engineering

LINGAYA’S INSTITUTE OF MANAGEMENT AND TECHNOLOGY, FARIDABAD

Page 3: Report on Dtmf Based Land Rover

P R O J E C T R E P O R T O N C E L L P H O N E O P E R AT E D L A N D R O V E R P R O G R E S S R E P O R T

L I N G AYA ’ S U N I V E R S I T Y

Page 4: Report on Dtmf Based Land Rover

ABSTRACT

Conventionally, wireless-controlled robots use RF circuits, which have the drawbacks of limited working range, limited frequency range and limited control. Use of a mobile phone for robotic control can overcome these limitations. It provides the advantages of robust control, working range as large as the coverage area of the service provider, no interference with other controllers and up to twelve controls. In this project, the robot is so controlled by a mobile phone that makes a call to the mobile phone attached to the robot. In the course of a call, if any button is pressed, a tone corresponding to the button pressed is heard at the other end of the call. This tone is called ‘dual tone multiple frequency’ (DTMF) tone. The robot perceives this DTMF tone with the help of the phone stacked in the robot. The receiver tone is processed by 8051microcontroller with the help of a DTMF decoder CM8870. The decoder decodes the DTMF tone into its equivalent binary digit and this binary number is sent to the microcontroller. The microcontroller is preprogrammed to take a decision for any given 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 of receiver and transmitter units.

Page 5: Report on Dtmf Based Land Rover

ABOUT PROJECT

In this project, the robot is controlled by a mobile phone that makes a call to the mobile phone attached to the robot

Conventionally, wireless-controlled robots use RF circuits, which have the drawbacks of limited working range, limited frequency range and limited control.

Use of a mobile phone for robotic control can overcome these limitations.

It provides the advantages of robust control, working range as large as the coverage area of the service provider, no interference with other controllers and up to twelve controls.

Page 6: Report on Dtmf Based Land Rover
Page 7: Report on Dtmf Based Land Rover
Page 8: Report on Dtmf Based Land Rover

PROJECT DISCRPTION

BASIC OPERATION

In order to control the robot, you need to make a call to the cell phone attached to the robot (through headphone) from any phone, which sends DTMF tunes on pressing the numeric buttons. The cell phone in the robot is kept in 'auto answer' mode.( if the mobile does not have the auto answering facility ,receive the call by 'OK' key on the rover connected mobile and then made it in hands-free mode.) so after a ring, the cell phone accepts the call. Now you may press any button on your mobile to perform actions as listed in the table. The DTMF tones thus produced are received by the cell phone in the robot. These tones are fed to the circuit by headset of the cell phone. The MT8870 decodes the received tone and sends the equivalent binary number to the microcontroller. According to the program in the microcontroller, the robot starts moving. When you press key '2' (binary equivalent 00000010) on your mobile phone, the microcontroller outputs '10001001'binary equivalent. Port pins PD0, PD3 and PD7 are high. The high output at PD7 of the microcontroller drives the motor driver (L293D). port pins PD0 and PD3 drive motors M1 and M2 in forward direction( as per table ).Similarly, motors M1 and M2 move for left turn, right turn, backward motion and stop condition as per table.

Page 9: Report on Dtmf Based Land Rover

CONNECTION TO THE MOBILE

Page 10: Report on Dtmf Based Land Rover

COMPONENTS USED

1. Semiconductors

IC1-MT8870 DTMF decoderIC2-ATMEL89S52IC3-L293D motor driveIC4-74LS04 not gateD1, D2-1N4007 rectifier diode7805 regulator ic

2. Resistors (all ¼ watts, +-5% carbon):

R1, R2-100-Kilo-ohmR3-330-kilo-ohmR4-10-kilo-ohm

3. Capacitors:

C1-0.47uF ceramic diskC2, C3, C5, C6-22pF ceramic diskC4, C10-0.1uF ceramic diskC7, C9-10uF ceramic diskC8-330uF ceramic disk

4. Miscellaneous:

Xtal1-3.57MHz crystalXtal2-12MHz crystalS1, S2, S3-push to on switchM1, M2-6V, 50-rpm geared DC motorBatt-6V, 4.5Ah battery

Page 11: Report on Dtmf Based Land Rover

Batt-9V (6FF2) battery2 pin male and female connector

DTMF DECODER

The M-8870 is a full DTMF Receiver that integrates both band split 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. External component count is minimized by provision of an on-chip differential input amplifier, clock generator, and latched tri-state interface bus. Minimal external components required include a low-cost 3.579545 MHz color burst crystal, a timing resistor, and a timing capacitor.The M-8870-02 provides a “power-down” option which, when enabled, drops consumption to less than 0.5 mW. The M-8870-02 can also inhibit the decoding of fourth column digits

Page 12: Report on Dtmf Based Land Rover
Page 13: Report on Dtmf Based Land Rover
Page 14: Report on Dtmf Based Land Rover

CIRCUIT DIAGRAM 1N4007 D1 +6V, 4.5Ah

S1 C4 S3 Vpp Vcc C7 16 8 31 40 1 3 + OUT1 Tip C1 R1 IN- 18 10 28 9 IC3 2 174 L293D M1 IC2 24 15 S2 R2 GS 3 16 A IN+1 14 T 23 10 6 - OUT2

IC1 8 + 5.04V from MT 14 13 12 P1.3 4 9 22 7 11 + OUT3 regulator

Vref 4 8870 S 21 2 circuit C2 OSC1 13 1 2 P1.2 3 5 - 7 2 M2 12 3 4 P1.1 2 XTAL1 4 5 12 13 14 - OUT4 8 6 5 9 11 5 6 P1.0 1 18 OSC2 C3 7 #74LS04IC4 RST 9 XTAL2 C6 20 19 R4 C5 Ring (a) Main circuit

D2, 1N4007 in out +5.04V output 7805 9V Battery C8 C9 gnd C10 (b) Voltage regulator circuit

Page 15: Report on Dtmf Based Land Rover

THREE STEP PROGRESS

Page 16: Report on Dtmf Based Land Rover

WELL TESTED COMPLETE MECHANICAL BODY

Page 17: Report on Dtmf Based Land Rover
Page 18: Report on Dtmf Based Land Rover

COMPLETE CIRCUIT PART

Page 19: Report on Dtmf Based Land Rover

Circuit making

Page 20: Report on Dtmf Based Land Rover

Compiling in Keil uvision 3

Page 21: Report on Dtmf Based Land Rover

1. Open keil

2. Make a new project

Page 22: Report on Dtmf Based Land Rover
Page 23: Report on Dtmf Based Land Rover

3. Select the microcontroller

4. Write program

Page 24: Report on Dtmf Based Land Rover
Page 25: Report on Dtmf Based Land Rover

5. Compile

Page 26: Report on Dtmf Based Land Rover

6. Simulate

Page 27: Report on Dtmf Based Land Rover

Assemblinging all parts

Page 28: Report on Dtmf Based Land Rover

Application

It can be used for surveillance purpose As its range is dependent on the network of the sim card used in cellphone,

"Wherever there is network there is this rover” It can be sent to those places where human enterance is risky. Such type of rovers when equipped with latest technologies have done historic work

like mars rover.

Page 29: Report on Dtmf Based Land Rover
Page 30: Report on Dtmf Based Land Rover

TONE DECODING OF MT8870

Page 31: Report on Dtmf Based Land Rover
Page 32: Report on Dtmf Based Land Rover

AT89S52

8-bit Microcontroller with 8K Bytes In-System Programmable Flash

Features

• Compatible with MCS-51® Products• 8K Bytes of In-System Programmable (ISP) Flash Memory– Endurance: 1000 Write/Erase Cycles• 4.0V to 5.5V Operating Range• Fully Static Operation: 0 Hz to 33 MHz• Three-level Program Memory Lock• 256 x 8-bit Internal RAM• 32 Programmable I/O Lines• Three 16-bit Timer/Counters• Eight Interrupt Sources• Full Duplex UART Serial Channel• Low-power Idle and Power-down Modes• Interrupt Recovery from Power-down Mode• Watchdog Timer• Dual Data Pointer• Power-off Flag

Page 33: Report on Dtmf Based Land Rover

DescriptionThe AT89S52 is a low-power, high-performance CMOS 8-bit microcontroller with 8K bytes of in-system programmable Flash memory. The device is manufactured using Atmel’s high-density nonvolatile memory technology and is compatible with the industry- standard 80C51 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 in-system programmable Flash on a monolithic chip, the Atmel AT89S52 is a powerful microcontroller which provides a highly-flexible and cost-effective solution to many embedded control applications. The AT89S52 provides the following standard features: 8K bytes of Flash, 256 bytes of RAM, 32 I/O lines, Watchdog timer, two data pointers, three 16-bit timer/counters, a six-vector two-level interrupt architecture, a full duplex serial port, on-chip oscillator, and clock circuitry. In addition, the AT89S52 is designed with static logic for operation down to zero frequency and supports two software selectable power saving modes. The Idle Mode stops the CPU while allowing the RAM, timer/counters, serial port, and interrupt system to continue functioning. The Power-down mode saves the RAM contents but freezes the oscillator, disabling all other chip functions until the next interrupt or hardware reset.

Page 34: Report on Dtmf Based Land Rover

L293D Motor driver

ABILITIES600mA OUTPUT CURRENT CAPABILITYPER CHANNEL1.2A PEAK OUTPUT CURRENT (non repetitive)PER CHANNELENABLE FACILITYOVERTEMPERATUREPROTECTIONLOGICAL ”0” INPUT VOLTAGE UP TO 1.5 V(HIGH NOISE IMMUNITY)INTERNAL CLAMP DIODES

DESCRIPTION

The Device is a monolithic integrated high voltage, high current four channel driver designed to accept standard DTL or TTL logic levels and drive inductive loads (such as relays solenoides, DC and stepping motors) and switching power transistors. To simplify use as two bridges each pair of channels is equipped with an enable input. A separate supply input is provided for the logic, allowing operation at a lower voltage and internal clamp diodes are included. This device is suitable for use in switching applications at frequencies up to 5 kHz. The L293D is assembled in a 16 lead plastic packaage which has 4 center pins connected together and used for heatsinking The L293DD is assembled in a 20 lead surface mount which has 8 center pins connected together and used for heatsinking

Page 35: Report on Dtmf Based Land Rover

12V 100 RPM DC geared motor

Introduction

NR-DC-ECO is high quality low cost DC geared motor. It contains Brass gears and steel pinions to ensure longer life and better wear and tear properties. The gears are fixed on hardened steel spindles polished to a mirror finish. These spindles rotate between bronze plates which ensures silent running. The output shaft rotates in a sintered bushing. The whole assembly is covered with a plastic ring. All the bearings are permanently lubricated and therefore require no maintenance. The motor is screwed to the gear box from inside.

Specifications

• Total length: 46mm• Motor diameter: 36mm• Motor length: 25mm• DC supply: 4 to 12V• RPM: 100• Brush type: Precious metal• Gear head diameter: 37mm• Gear head length: 21mm• Output shaft: Centered• Shaft diameter: 4mm and 6mm• Shaft length: 22mm• Gear assembly: Spur• Torque: 0.25 to 7Kg/cm

Page 36: Report on Dtmf Based Land Rover

HARDWARE PARTPHYSICAL MODEL

1. We have collected some hardware needed for the project which include Two geared motors of 6v/50rpm (Why only geared motor? because simple

motors have very high rpm which can cause trouble in rover movement. Thus we decrease the rpm of motor by using two gears, small one connected to axle of motor and bigger one connected to small one and drives the wheels with reduced rpm of almost 50rpm motor is of 6V)

Two main rear wheels (diameter 74mm, thickness 13mm/plastic wheels ) One multidirectional wheel(made of steel with a ball in bottom giving free

motion to be fitted in front of rover) One battery of 6v/4.5Ah/1.35A One solid board for base Two tin clamps for holding motor on board Some screws and bolts Wires

Wheels, motors, front wheel, motor clamps and base board

Page 37: Report on Dtmf Based Land Rover

STEP 1 (MAKING PHYSICAL MODEL)

(a)motors (b)wheels

(c) wheels connected to motors (d)clamps

(e)Holes drolling in board to fit motor clamps

Page 38: Report on Dtmf Based Land Rover

(f)Final view after connecting wheels and tyres to the board

Page 39: Report on Dtmf Based Land Rover

89S52 microcontroller basics

Page 40: Report on Dtmf Based Land Rover

2.1 Introduction The term microcomputer is used to describe a system that includes at minimum a

microprocessor, program memory, data memory, and an input-output (I/O) device. Some

microcomputer systems include additional components such as timers, counters, and analog-to-

digital converters. Thus, a microcomputer system can be anything from a large computer having

hard disks, floppy disks, and printers to a single-chip embedded controller.

We are going to consider only the type of microcomputers that consist of a single silicon chip.

Such microcomputer systems are also called microcontrollers, and they are used in many

household goods such as microwave ovens, TV remote control units, cookers, hi-fi equipment,

CD players, personal computers, and refrigerators. Many different microcontrollers are available

on the market. In this book we shall be looking at programming and system design for the 8051

series of microcontrollers .

2.2 Microcontrollers versus Microprocessors

Microcontroller differs from a microprocessor in many ways. First and the most important is its

functionality. In order for a microprocessor to be used, other components such as memory, or

components for receiving and sending data must be added to it. In short that means that

microprocessor is the very heart of the computer. On the other hand, microcontroller is designed to

be all of that in one. No other external components are needed for its application because all

Page 41: Report on Dtmf Based Land Rover

necessary peripherals are already built into it. Thus, we save the time and space needed to construct

devices.

Fig 3.7.1 microprocessor and its component block diagram.

Fig 3.7.2 Microcontroller unit

2.3 Microcontroller System:

In today present a lot of microcontroller manufactures appeared almost every major electronic

company produce their own microcontroller to use into their own devices each microcontroller

Page 42: Report on Dtmf Based Land Rover

type may add or improve existing features but all microcontrollers share basic features that is

microprocessor (CPU), memory and an input-output (I/O) device.

Fig 3.8.1 the basic microcontroller system

The input components would consist of digital devices such as, switches, push buttons, pressure

mats, float switches, keypads, radio receivers etc. and analogue sensors such as light dependent

resistors, thermistors, gas sensors, pressure sensors, etc.

The control unit is of course the microcontroller. The microcontroller will monitor the inputs and

as a result the program would turn outputs on and off. The microcontroller stores the program in

its memory, and executes the instructions under the control of the clock circuit.

The output devices would be made up from LEDs, buzzers, motors, alpha numeric displays,

radio transmitters, 7 segment displays, heaters, fans etc.

The most obvious choice then for the microcontroller is how many digital inputs, analogue inputs

and outputs does the system require. This would then specify the minimum number of inputs and

outputs (I/O) that the microcontroller must have. If analogue inputs are used then the microcontroller

must have an Analogue to Digital (A/D) module inside.

The next consideration would be what size of program memory storage is required. This should not

be too much of a problem when starting out, as most programs would be relatively small.

The clock frequency determines the speed at which the instructions are executed. This is important if

any lengthy calculations are being undertaken. The higher the clock frequency the quicker the micro

will finish one task and start another.

Other considerations are the number of interrupts and timer circuits required how much data

EEPROM if any is needed.

Microcontrollers have traditionally been programmed using the assembly language of the target

device. Although the assembly language is fast, it has several disadvantages. An assembly program

makes learning and maintaining a program written using the assembly language difficult. Also,

Page 43: Report on Dtmf Based Land Rover

microcontrollers manufactured by different firms have different assembly languages, so the user must

learn a new language with every new microcontroller he uses.

Microcontrollers can also be programmed using a high-level language, such as BASIC, PASCAL, or

C. High-level languages are much easier to learn than assembly languages. They also facilitate the

development of large and complex programs.

A microcontroller is a very powerful tool that allows a designer to create sophisticated input-output

data manipulation under program control. Microcontrollers are classified by the number of bits they

process. 12

Microcontrollers with 8 bits are the most popular and are used in most microcontroller-based

applications. Microcontrollers with 16 and 32 bits are much more powerful, but are usually more

expensive and not required in most small- or medium-size general purpose applications that call for

microcontrollers.

2.4 Microcontroller basic architecture:

The simplest microcontroller architecture consists of a microprocessor, memory, and input-

output. The microprocessor consists of a central processing unit (CPU) and a control unit

(CU). The CPU is the brain of the microcontroller; this is where all the arithmetic and logic

operations are performed. The CU controls the internal operations of the microprocessor

and sends signals to other parts of the microcontroller to carry out the required instructions.

2.4.1 Central Processing Unit

As its name indicates, this is a unit which monitors and controls all processes inside the

microcontroller. It consists of several smaller units, of which the most important are:

Instruction Decoder: is a part of electronics which recognizes program instructions and runs

other circuits on the basis of that. The ―instruction set‖ which is different for each

microcontroller family expresses the abilities of this circuit.

Arithmetical Logical Unit (ALU): performs all mathematical and logical operations upon

data.

Page 44: Report on Dtmf Based Land Rover

Accumulator: is a SFR closely related to the operation of ALU. It is a kind of working desk

used for storing all data upon which some operation should be performed (addition,

shift/move etc.). It also stores results ready for use in further processing.

Status Register (PSW): One of SFRs is close to the accumulator. It shows at any moment

the ―status of a number stored in the accumulator (number is greater or less than zero etc.)..

Microcontroller central processing unit

2.4.2 Memory unit

Memory, an important part of a microcontroller system, can be classified into two types: program

memory and data memory. Program memory stores the program written by the programmer and

is usually nonvolatile (i.e., data is not lost after the power is turned off). Data memory stores the

temporary data used in a program and is usually volatile (i.e., data is lost after the power is turned

off).

Page 45: Report on Dtmf Based Land Rover

Typical memory unit device

There are basically six types of memories, summarized as follows:

2.4.2.1 RAM RAM, random access memory, is a general purpose memory that usually stores the user data in a

program. RAM memory is volatile in the sense that it cannot retain data in the absence of power (i.e.,

data is lost after the power is turned off). Most microcontrollers have some amount of internal RAM,

256 bytes being a common amount, although some microcontrollers have more, some less. The

AT89C52 microcontroller, for example, has 256 bytes of RAM. Memory can usually be extended by

adding external memory chips.

2.4.2.2 ROM ROM, read only memory, usually holds program or fixed user data. ROM is nonvolatile. If power is

removed from ROM and then reapplied, the original data will still be there. ROM memory is

programmed during the manufacturing process, and the user cannot change its contents. ROM

memory is only useful if you have developed a program and wish to create several thousand copies

of it.

2.4.2.3 PROM PROM, programmable read only memory, is a type of ROM that can be programmed in the field,

often by the end user, using a device called a PROM programmer. Once a PROM has been

programmed, its contents cannot be changed. PROMs are usually used in low production applications

where only a few such memories are required.

2.4.2.4 EPROM

Page 46: Report on Dtmf Based Land Rover

EPROM, erasable programmable read only memory, is similar to ROM, but EPROM can be

programmed using a suitable programming device. An EPROM memory has a small clear-glass

window on top of the chip where the data can be erased under strong ultraviolet light. Once the

memory is programmed, the window can be covered with dark tape to prevent accidental erasure of

the data. An EPROM memory must be erased before it can be reprogrammed. Many developmental

versions of microcontrollers are manufactured with EPROM memories where the user program can

be stored. These memories are erased and reprogrammed until the user is satisfied with the program.

Some versions of EPROMs, known as OTP (one time programmable), can be programmed using a

suitable programmer device but cannot be erased. OTP memories cost much less than EPROMs.

OTP is useful after a project has been developed completely and many copies of the program

memory must be made.

2.4.2.5 EEPROM EEPROM, electrically erasable programmable read only memory, is a nonvolatile memory that can

be erased and reprogrammed using a suitable programming device. EEPROMs are used to save

configuration information, maximum and minimum values, identification data, etc. Some

microcontrollers have built-in EEPROM memories. For instance, the PIC18F452 contains a 256-byte

EEPROM memory where each byte can be programmed and erased directly by applications software.

EEPROM memories are usually very slow. An EEPROM chip is much costlier than an EPROM chip.

2.4.2.6 Flash EEPROM Flash EEPROM, a version of EEPROM memory, has become popular in microcontroller applications

and is used to store the user program. Flash EEPROM is nonvolatile and usually very fast. The data

can be erased and then reprogrammed using a suitable programming device. Some microcontrollers

have only 1K flash EEPROM while others have 32K or more. The AT89C52 microcontroller has 1K

bytes of flash memory.

Page 47: Report on Dtmf Based Land Rover

2.4.3 Input / Output ports In order that the microcontroller is of any use, it has to be connected to additional electronics, i. e.

peripherals. For that reason, each microcontroller has one or more registers (called "port" in this

case) connected to the microcontroller pins. Why input/output? Because you can change the pin‘s

function as you wish. simply performed by software, which means that pin‘s function can be changed

during operation. One of more important feature of I/O pins is maximal current they can give/get. For

the most microcontrollers, current obtained from one pin is sufficient to activate a LED or other

similar low-current consumer (10-20 mA). If the microcontroller has many I/O pins, then maximal

current of one pin is lower. each I/O port is under control of another SFR, which means that each bit

of that register determines state of the corresponding microcontroller pin. For example, by writing

logic one (1) to one bit of that control register SFR, the appropriate port pin is automatically

configured as input. It means that voltage brought to that pin can be read as logic 0 or 1. Otherwise,

by writing zero to the SFR, the appropriate port pin is configured as output. Its voltage (0V or 5V)

corresponds to the state of the appropriate bit of the port register.

2.5 Some of Microcontroller Features:2.5.1 Supply Voltage

Page 48: Report on Dtmf Based Land Rover

Most microcontrollers operate with the standard logic voltage of + 5V. Some

microcontrollers can operate at as low as + 2.7V, and some will tolerate + 6V without any

problem. The manufacturer‘s data sheet will have information about the allowed limits of

the power supply voltage. At89c52 microcontrollers can operate with a power supply of +

2V to 5.5V. Usually, a voltage regulator circuit is used to obtain the required power supply

voltage when the device is operated from a mains adapter or batteries. For example, a 5V

regulator is required if the microcontroller is operated from a 5V supply using a 9V battery.

2.5.2 The Clock

All microcontrollers require a clock (or an oscillator) to operate, usually provided by external

timing devices connected to the microcontroller. In most cases, these external timing devices

are a crystal plus two small capacitors. In some cases they are resonators or an external resistor-

capacitor pair. Some microcontrollers have built-in timing circuits and do not require external

timing components. If an application is not time-sensitive, external or internal (if available)

resistor-capacitor timing components are the best option for their simplicity and low cost. An

instruction is executed by fetching it from the memory and then decoding it. This usually takes

several clock cycles and is known as the instruction cycle. Thus the microcontroller operates at

a clock rate that is one-quarter of the actual oscillator frequency. The 8051 series of

microcontrollers can operate with clock frequencies up to 40MHz.

2.5.3 Timers

Timers are important parts of any microcontroller. A timer is basically a counter which is driven

from either an external clock pulse or the microcontroller‘s internal oscillator. A timer can be 8

bits or 16 bits wide. Data can be loaded into a timer under program control, and the timer can be

stopped or started by program control. Most timers can be configured to generate an interrupt

when they reach a certain count (usually when they overflow). The user program can use an

interrupt to carry out accurate timing-related operations inside the microcontroller.

Microcontrollers in the 8051 series have at least three timers. For example, the AT89C52

microcontroller has three built-in timers. Some microcontrollers offer capture and compare

Page 49: Report on Dtmf Based Land Rover

facilities, where a timer value can be read when an external event occurs, or the timer value can

be compared to a preset value, and an interrupt is generated when this value is reached.

2.5.4 Reset Input

A reset input is used to reset a microcontroller externally. Resetting puts the microcontroller

into a known state such that the program execution starts from address 0 of the program

memory. An external reset action is usually achieved by connecting a push-button switch to the

reset input. When the switch is pressed, the microcontroller is reset.

2.5.5 Interrupts

Interrupts are an important concept in microcontrollers. An interrupt causes the microcontroller to

respond to external and internal (e.g., a timer) events very quickly. When an interrupt occurs, the

microcontroller leaves its normal flow of program execution and jumps to a special part of the

program known as the interrupt service routine (ISR). The program code inside the ISR is executed,

and upon return from the ISR the program resumes its normal flow of execution.

The ISR starts from a fixed address of the program memory sometimes known as the interrupt vector

address. Some microcontrollers with multi-interrupt features have just one interrupt vector address,

while others have unique interrupt vector addresses, one for each interrupt source. Interrupts can be

nested such that a new interrupt can suspend the execution of another interrupt. Another important

feature of multi-interrupt capability is that different interrupt sources can be assigned different levels

of priority. The at89c52 microcontroller has 8 interrupts source.

2.5.6 Analog-to-Digital Converter

An analog-to-digital converter (A/D) is used to convert an analog signal, such as voltage, to

digital form so a microcontroller can read and process it. Some microcontrollers have built-

in A/D converters. External A/D converter can also be connected to any type of

microcontroller. A/D converters are usually 8 to 10 bits, having 256 to 1024 quantization

levels. Most 8051 microcontrollers with A/D features have multiplexed A/D converters

which provide more than one analog input channel. The A/D conversion process must be

Page 50: Report on Dtmf Based Land Rover

started by the user program and may take several hundred microseconds to complete. A/D

converters usually generate interrupts when a conversion is complete so the user program

can read the converted data quickly. A/D converters are especially useful in control and

monitoring applications, since most sensors (e.g., temperature sensors, pressure sensors,

force sensors, etc.) produce analog output voltages.

2.5.7 Serial Input-Output

Serial communication (also called RS232 communication) enables a microcontroller to be

connected to another microcontroller or to a PC using a serial cable. Some microcontrollers

have built-in hardware called USART (universal synchronous-asynchronous receiver-

transmitter) to implement a serial communication interface. The user program can usually

select the baud rate and data format. If no serial input-output hardware is provided, it is easy

to develop software to implement serial data communication using any I/O pin of a

microcontroller.

2.6 The 8051 Microcontroller

2.6.1 Architecture:

All 8051 microcontrollers are 40 pin devices. The pin configuration of AT89C52 or

AT89S52 (DIP package) is shown in figure.

Page 51: Report on Dtmf Based Land Rover

2.6.2 Block diagram:

Page 52: Report on Dtmf Based Land Rover

2.6.3 The Reset:The reset action put the microcontroller in the unknown state. Resetting a 8051

microcontroller starts execution of the program from address 0000H of the program

memory.

2.6.4 The clock source: The 8051 microcontroller can be operated from an external crystal or ceramic resonator

connected to the microcontroller's XTAL1 and XTAL2 pins.

2.6.5 Input/Output Ports (I/O Ports):All 8051 microcontrollers have 4 I/O ports each comprising 8 bits which can be

configured as inputs or outputs. Accordingly, in total of 32 input/output pins enabling the

microcontroller to be connected to peripheral devices are available for use.

Pin configuration, i.e. whether it is to be configured as an input (1) or an output (0),

depends on its logic state, in order to configure a microcontroller pin as an input, it is

Page 53: Report on Dtmf Based Land Rover

necessary to apply a logic one (1) to appropriate port. In this case, voltage level on

appropriate pin will be 5V (as is the case with any TTL input.

Port 0

The P0 port is characterized by two functions. If external memory is used then the lower address byte (addresses A0-A7) is applied on it. Otherwise, all bits of this port are configured as inputs/outputs.

The other function is expressed when it is configured as an output. Unlike other ports consisting of pins with built-in pull-up resistor connected by its end to 5 V power supply, pins of this port have this resistor left out. This apparently small difference has its consequences:

If any pin of this port is configured as an input then it acts as if it “floats”. Such an input has unlimited input resistance and in determined potential.

When the pin is configured as an output, it acts as an “open drain”. By applying logic 0 to a port bit, the appropriate pin will be connected to ground (0V). By applying logic 1, the external

Page 54: Report on Dtmf Based Land Rover

output will keep on “floating”. In order to apply logic 1 (5V) on this output pin, it is necessary to built in an external pull-up resistor.

Port 1

P1 is a true I/O port, because it doesn't have any alternative functions as is the case with P0, but can be configured as general I/O only. It has a pull-up resistor built-in and is completely compatible with TTL circuits.

Port 2

P2 acts similarly to P0 when external memory is used. Pins of this port occupy addresses intended for external memory chip. This time it is about the higher address byte with addresses A8-A15. When no memory is added, this port can be used as a general input/output port showing features similar to P1.

Port 3

All port pins can be used as general I/O, but they also have an alternative function. In order to use these alternative functions, a logic one (1) must be applied to appropriate bit of the P3 register. In terms of hardware, this port is similar to P0, with the difference that its pins have a pull-up resistor built-in.

Pin's Current limitations

When configured as outputs (logic zero (0)), single port pins can receive a current of 10mA. If all 8 bits of a port are active, a total current must be limited to 15mA (port P0: 26mA). If all ports (32 bits) are active, total maximum current must be limited to 71mA. When these pins are configured as inputs (logic 1), built-in pull-up resistors provide very weak current, but strong enough to activate up to 4 TTL inputs of LS series.

2.6.6 Special Function Registers (SFRs):

Special Function Registers (SFRs) are a sort of control table used for running and monitoring the operation of the microcontroller. Each of these registers as well as each bit they include, has its name, address in the scope of RAM and precisely defined purpose such as timer control, interrupt control, serial communication control etc. Even though there are 128 memory locations intended to be occupied by them, the basic core, shared by all types of 8051 microcontrollers,

Page 55: Report on Dtmf Based Land Rover

has only 21 such registers. Rest of locations are intentionally left unoccupied in order to enable the manufacturers to further develop microcontrollers keeping them compatible with the previous versions. It also enables programs written a long time ago for microcontrollers which are out of production now to be used today.

A Register (Accumulator)

A register is a general-purpose register used for storing intermediate results obtained during operation. Prior to executing an instruction upon any number or operand it is necessary to store it in the accumulator first. All results obtained from arithmetical operations performed by the ALU are stored in the accumulator. Data to be moved from one register to another must go through the accumulator. In other words, the A register is the most commonly used register and it is impossible to imagine a microcontroller without it. More than half instructions used by the 8051 microcontroller use somehow the accumulator.

Page 56: Report on Dtmf Based Land Rover

B Register

Multiplication and division can be performed only upon numbers stored in the A and B registers. All other instructions in the program can use this register as a spare accumulator (A).

R Registers (R0-R7)

This is a common name for 8 general-purpose registers (R0, R1, R2 ...R7). Even though they are not true SFRs, they deserve to be discussed here because of their purpose. They occupy 4 banks within RAM. Similar to the accumulator, they are used for temporary storing variables and intermediate results during operation. Which one of these banks is to be active depends on two bits of the PSW Register. Active bank is a bank the registers of which are currently used.

The following example best illustrates the purpose of these registers. Suppose it is necessary to perform some arithmetical operations upon numbers previously stored in the R registers: (R1+R2) - (R3+R4). Obviously, a register for temporary storing results of addition is needed. This is how it looks in the program:

Page 57: Report on Dtmf Based Land Rover

MOV A,R3; Means: move number from R3 into accumulatorADD A,R4; Means: add number from R4 to accumulator (result remains in accumulator)MOV R5,A; Means: temporarily move the result from accumulator into R5MOV A,R1; Means: move number from R1 to accumulatorADD A,R2; Means: add number from R2 to accumulatorSUBB A,R5; Means: subtract number from R5 (there are R3+R4)

Program Status Word (PSW) Register

PSW register is one of the most important SFRs. It contains several status bits that reflect the current state of the CPU. Besides, this register contains Carry bit, Auxiliary Carry, two register bank select bits, Overflow flag, parity bit and user-definable status flag.

P - Parity bit: If a number stored in the accumulator is even then this bit will be automatically set (1), otherwise it will be cleared (0). It is mainly used during data transmit and receive via serial communication.Bit 1: This bit is intended to be used in the future versions of microcontrollers.OV Overflow: occurs when the result of an arithmetical operation is larger than 255 and cannot be stored in one register. Overflow condition causes the OV bit to be set (1). Otherwise, it will be cleared (0).RS0, RS1 - Register bank select bits:These two bits are used to select one of four register banks of RAM. By setting and clearing these bits, registers R0-R7 are stored in one of four banks of RAM.F0 - Flag 0: This is a general-purpose bit available for use.AC - Auxiliary Carry Flag:

 is used for BCD operations only.

Page 58: Report on Dtmf Based Land Rover

CY - Carry Flag: is the (ninth) auxiliary bit used for all arithmetical operations and shift instructions.

Data Pointer Register (DPTR)

DPTR register is not a true one because it doesn't physically exist. It consists of two separate registers: DPH (Data Pointer High) and (Data Pointer Low). For this reason it may be treated as a 16-bit register or as two independent 8-bit registers. Their 16 bits are primarily used for external memory addressing. Besides, the DPTR Register is usually used for storing data and intermediate results.

Stack Pointer (SP) Register

A value stored in the Stack Pointer points to the first free stack address and permits stack availability. Stack pushes increment the value in the Stack Pointer by 1. Likewise, stack pops decrement its value by 1. Upon any reset and power-on, the value 7 is stored in the Stack Pointer, which means that the space of RAM reserved for the stack starts at this location. If another value is written to this register, the entire Stack is moved to the new memory location.

Page 59: Report on Dtmf Based Land Rover

P0, P1, P2, P3 - Input/Output Registers

If neither external memory nor serial communication system are used then 4 ports with in total of 32 input/output pins are available for connection to peripheral environment. Each bit within these ports affects the state and performance of appropriate pin of the microcontroller. Thus, bit logic state is reflected on appropriate pin as a voltage (0 or 5 V) and vice versa, voltage on a pin reflects the state of appropriate port bit.

As mentioned, port bit state affects performance of port pins, i.e. whether they will be configured as inputs or outputs. If a bit is cleared (0), the appropriate pin will be configured as an output, while if it is set (1), the appropriate pin will be configured as an input. Upon reset and power-on, all port bits are set (1), which means that all appropriate pins will be configured as inputs.

2.6.7 Counters and Timers

As you already know, the microcontroller oscillator uses quartz crystal for its operation. As the frequency of this oscillator is precisely defined and very stable, pulses it generates are always of the same width, which makes them ideal for time measurement. Such crystals are also used in quartz watches. In order to measure time between two events it is sufficient to count up pulses coming from this oscillator. That is exactly what the timer does. If the timer is properly programmed, the value stored in its register will be incremented (or decremented) with each coming pulse, i.e. once per each machine cycle. A single machine-cycle instruction lasts for 12 quartz oscillator periods, which means that by embedding quartz with oscillator frequency of 12MHz, a number stored in the timer register will be changed million times per second, i.e. each microsecond.

The 8051 microcontroller has 2 timers/counters called T0 and T1. As their names suggest, their main purpose is to measure time and count external events. Besides, they can be used for generating clock pulses to be used in serial communication, so called Baud Rate.

Page 60: Report on Dtmf Based Land Rover

Timer T0

As seen in figure below, the timer T0 consists of two registers – TH0 and TL0 representing a low

and a high byte of one 16-digit binary number.

Accordingly, if the content of the timer T0 is equal to 0 (T0=0) then both registers it consists of will contain 0. If the timer contains for example number 1000 (decimal), then the TH0 register (high byte) will contain the number 3, while the TL0 register (low byte) will contain decimal number 232.

Formula used to calculate values in these two registers is very simple:TH0 × 256 + TL0 = TMatching the previous example it would be as follows:3 × 256 + 232 = 1000

Since the timer T0 is virtually 16-bit register, the largest value it can store is 65 535. In case of exceeding this value, the timer will be automatically cleared and counting starts from 0. This condition is called an overflow. Two registers TMOD and TCON are closely connected to this timer and control its operation.

Page 61: Report on Dtmf Based Land Rover

TMOD Register (Timer Mode)

The TMOD register selects the operational mode of the timers T0 and T1. As seen in figure below, the low 4 bits (bit0 - bit3) refer to the timer 0, while the high 4 bits (bit4 - bit7) refer to the timer 1. There are 4 operational modes and each of them is described herein.

Bits of this register have the following function:

GATE1 :

enables and disables Timer 1 by means of a signal brought to the INT1 pin (P3.3):

1 - Timer 1 operates only if the INT1 bit is set.

0 - Timer 1 operates regardless of the logic state of the INT1 bit.

C/T1 :

selects pulses to be counted up by the timer/counter 1:

1 - Timer counts pulses brought to the T1 pin (P3.5).

0 - Timer counts pulses from internal oscillator.

T1M1,T1M0:

 These two bits select the operational mode of the Timer 1.

T 1 M 1 T 1 M 0 M O D E D E S C R I P T I O N

0 0 0 13-bit timer0 1 1 16-bit timer1 0 2 8-bit auto-reload1 1 3 Split mode

GATE0 enables and disables Timer 1 using a signal brought to the INT0 pin (P3.2):

Page 62: Report on Dtmf Based Land Rover

1 - Timer 0 operates only if the INT0 bit is set.0 - Timer 0 operates regardless of the logic state of the INT0 bit.

C/T0 selects pulses to be counted up by the timer/counter 0:1 - Timer counts pulses brought to the T0 pin (P3.4).0 - Timer counts pulses from internal oscillator.

T0M1,T0M0 These two bits select the operational mode of the Timer 0.

T 0 M 1 T 0 M 0 M O D E D E S C R I P T I O N

0 0 0 13-bit timer0 1 1 16-bit timer1 0 2 8-bit auto-reload1 1 3 Split mode

Timer Control (TCON) Register

TCON register is also one of the registers whose bits are directly in control of timer operation.

Only 4 bits of this register are used for this purpose, while rest of them is used for interrupt control to be

discussed later.

TF1 bit is automatically set on the Timer 1 overflow.

TR1 bit enables the Timer 1.o 1 - Timer 1 is enabled.

o 0 - Timer 1 is disabled.

TF0 bit is automatically set on the Timer 0 overflow.

TR0 bit enables the timer 0.o 1 - Timer 0 is enabled.

o 0 - Timer 0 is disabled.

How to use the Timer 0 ?

In order to use timer 0, it is first necessary to select it and configure the mode of its operation. Bits of the

TMOD register are in control of it:

Page 63: Report on Dtmf Based Land Rover

Referring to figure above, the timer 0 operates in mode 1 and counts pulses generated by internal clock

the frequency of which is equal to 1/12 the quartz frequency.

Turn on the timer:

The TR0 bit is set and the timer starts operation. If the quartz crystal with frequency of 12MHz is

embedded then its contents will be incremented every microsecond. After 65.536 microseconds, the both

registers the timer consists of will be loaded. The microcontroller automatically clears them and the timer

keeps on repeating procedure from the beginning until the TR0 bit value is logic zero (0).

Page 64: Report on Dtmf Based Land Rover

2.6.8 8051 Microcontroller Interrupts

There are five interrupt sources for the 8051, which means that they can recognize 5 different events that

can interrupt regular program execution. Each interrupt can be enabled or disabled by setting bits of the

IE register. Likewise, the whole interrupt system can be disabled by clearing the EA bit of the same

register. Refer to figure below.

Now, it is necessary to explain a few details referring to external interrupts- INT0 and INT1. If the IT0 and

IT1 bits of the TCON register are set, an interrupt will be generated on high to low transition, i.e. on the

falling pulse edge (only in that moment). If these bits are cleared, an interrupt will be continuously

executed as far as the pins are held low.

IE Register (Interrupt

Page 65: Report on Dtmf Based Land Rover

Enable) 

EA - global interrupt enable/disable:o 0 - disables all interrupt requests.

o 1 - enables all individual interrupt requests.

ES - enables or disables serial interrupt:o 0 - UART system cannot generate an interrupt.

o 1 - UART system enables an interrupt.

ET1 - bit enables or disables Timer 1 interrupt:o 0 - Timer 1 cannot generate an interrupt.

o 1 - Timer 1 enables an interrupt.

EX1 - bit enables or disables external 1 interrupt:o 0 - change of the pin INT0 logic state cannot generate an interrupt.

o 1 - enables an external interrupt on the pin INT0 state change.

ET0 - bit enables or disables timer 0 interrupt:o 0 - Timer 0 cannot generate an interrupt.

o 1 - enables timer 0 interrupt.

EX0 - bit enables or disables external 0 interrupt:o 0 - change of the INT1 pin logic state cannot generate an interrupt.

o 1 - enables an external interrupt on the pin INT1 state change.

Interrupt Priorities

It is not possible to forseen when an interrupt request will arrive. If several interrupts are enabled, it may

happen that while one of them is in progress, another one is requested. In order that the microcontroller

knows whether to continue operation or meet a new interrupt request, there is a priority list instructing it

what to do.

The priority list offers 3 levels of interrupt priority:

1. Reset! The apsolute master. When a reset request arrives, everything is stopped and the

microcontroller restarts.

2. Interrupt priority 1 can be disabled by Reset only.

3. Interrupt priority 0 can be disabled by both Reset and interrupt priority 1.

Page 66: Report on Dtmf Based Land Rover

The IP Register (Interrupt Priority Register) specifies which one of existing interrupt sources have higher

and which one has lower priority. Interrupt priority is usually specified at the beginning of the program.

According to that, there are several possibilities:

If an interrupt of higher priority arrives while an interrupt is in progress, it will be

immediately stopped and the higher priority interrupt will be executed first.

If two interrupt requests, at different priority levels, arrive at the same time then the

higher priority interrupt is serviced first.

If the both interrupt requests, at the same priority level, occur one after another, the one

which came later has to wait until routine being in progress ends.

If two interrupt requests of equal priority arrive at the same time then the interrupt to be

serviced is selected according to the following priority list:

1. External interrupt INT0

2. Timer 0 interrupt

3. External Interrupt INT1

4. Timer 1 interrupt

5. Serial Communication Interrupt

IP Register (Interrupt Priority)

The IP register bits specify the priority level of each interrupt (high or low priority).

PS - Serial Port Interrupt priority bito Priority 0

o Priority 1

PT1 - Timer 1 interrupt priorityo Priority 0

o Priority 1

PX1 - External Interrupt INT1 priorityo Priority 0

o Priority 1

PT0 - Timer 0 Interrupt Priority

Page 67: Report on Dtmf Based Land Rover

o Priority 0

o Priority 1

PX0 - External Interrupt INT0 Priorityo Priority 0

o Priority 1

Handling Interrupt

When an interrupt request arrives the following occurs:

1. Instruction in progress is ended.

2. The address of the next instruction to execute is pushed on the stack.

3. Depending on which interrupt is requested, one of 5 vectors (addresses) is written to the

program counter in accordance to the table below:

4.

I N T E R R U P T S O U R C E V E C T O R ( A D D R E S S )

IE0 3 hTF0 B hTF1 1B hRI, TI 23 hAll addresses are in hexadecimal format

5. These addresses store appropriate subroutines processing interrupts. Instead of them,

there are usually jump instructions specifying locations on which these subroutines reside.

6. When an interrupt routine is executed, the address of the next instruction to execute is

poped from the stack to the program counter and interrupted program resumes operation

from where it left off.

From the moment an interrupt is enabled, the microcontroller is on alert all the time. When an interrupt

request arrives, the program execution is stopped, electronics recognizes the source and the program

“jumps” to the appropriate address (see the table above). This address usually stores a jump instruction

specifying the start of appropriate subroutine. Upon its execution, the program resumes operation from

where it left off.

2.6.9 Introduction to assembly programming:

The process of writing program for the microcontroller mainly consists of giving instructions (commands)

in the specific order in which they should be executed in order to carry out a specific task. As electronics

Page 68: Report on Dtmf Based Land Rover

cannot “understand” what for example an instruction “if the push button is pressed- turn the light on”

means, then a certain number of simpler and precisely defined orders that decoder can recognise must

be used. All commands are known as INSTRUCTION SET. All microcontrollers compatibile with the 8051

have in total of 255 instructions, i.e. 255 different words available for program writing.

At first sight, it is imposing number of odd signs that must be known by heart. However, It is not so

complicated as it looks like. Many instructions are considered to be “different”, even though they perform

the same operation, so there are only 111 truly different commands. For example: ADD A,R0, ADD

A,R1, ... ADD A,R7 are instructions that perform the same operation (additon of the accumulator and

register). Since there are 8 such registers, each instruction is counted separately. Taking into account that

all instructions perform only 53 operations (addition, subtraction, copy etc.) and most of them are rarely

used in practice, there are actually 20-30 abbreviations to be learned, which is acceptable.

3.1 Types of instructions

Depending on operation they perform, all instructions are divided in several groups:

Arithmetic Instructions

Branch Instructions

Data Transfer Instructions

Logic Instructions

Bit-oriented Instructions

The first part of each instruction, called MNEMONIC refers to the operation an instruction performs (copy,

addition, logic operation etc.). Mnemonics are abbreviations of the name of operation being executed. For

example:

INC R1 - Means: Increment register R1 (increment register R1);

LJMP LAB5 - Means: Long Jump LAB5 (long jump to the address marked as LAB5);

JNZ LOOP - Means: Jump if Not Zero LOOP (if the number in the accumulator is not 0,

jump to the address marked as LOOP);

The other part of instruction, called OPERAND is separated from mnemonic by at least one whitespace

and defines data being processed by instructions. Some of the instructions have no operand, while some

of them have one, two or three. If there is more than one operand in an instruction, they are separated by

a comma. For example:

RET - return from a subroutine;

Page 69: Report on Dtmf Based Land Rover

JZ TEMP - if the number in the accumulator is not 0, jump to the address marked as

TEMP; ADD A,R3 - add R3 and accumulator;

CJNE A,#20,LOOP - compare accumulator with 20. If they are not equal, jump to the

address marked as LOOP;

Arithmetic instructions

Arithmetic instructions perform several basic operations such as addition, subtraction, division,

multiplication etc. After execution, the result is stored in the first operand. For example:

ADD A,R1 - The result of addition (A+R1) will be stored in the accumulator.A R I T H M E T I C I N S T R U C T I O N S

Mnemonic Description Byte CycleADD A,Rn Adds the register to the accumulator 1 1ADD A,direct Adds the direct byte to the accumulator 2 2ADD A,@Ri Adds the indirect RAM to the accumulator 1 2ADD A,#data Adds the immediate data to the accumulator 2 2ADDC A,Rn Adds the register to the accumulator with a carry flag 1 1ADDC A,direct Adds the direct byte to the accumulator with a carry flag 2 2ADDC A,@Ri Adds the indirect RAM to the accumulator with a carry flag 1 2ADDC A,#data Adds the immediate data to the accumulator with a carry flag 2 2SUBB A,Rn Subtracts the register from the accumulator with a borrow 1 1SUBB A,direct Subtracts the direct byte from the accumulator with a borrow 2 2SUBB A,@Ri Subtracts the indirect RAM from the accumulator with a borrow 1 2SUBB A,#data Subtracts the immediate data from the accumulator with a borrow 2 2INC A Increments the accumulator by 1 1 1INC Rn Increments the register by 1 1 2INC Rx Increments the direct byte by 1 2 3INC @Ri Increments the indirect RAM by 1 1 3DEC A Decrements the accumulator by 1 1 1DEC Rn Decrements the register by 1 1 1DEC Rx Decrements the direct byte by 1 1 2DEC @Ri Decrements the indirect RAM by 1 2 3INC DPTR Increments the Data Pointer by 1 1 3MUL AB Multiplies A and B 1 5DIV AB Divides A by B 1 5DA A Decimal adjustment of the accumulator according to BCD code 1 1

Page 70: Report on Dtmf Based Land Rover

Branch Instructions

There are two kinds of branch instructions:

Unconditional jump instructions: upon their execution a jump to a new location from where the program

continues execution is executed.

Conditional jump instructions: a jump to a new program location is executed only if a specified condition is met. Otherwise, the program normally proceeds with the next instruction.

B R A N C H I N S T R U C T I O N S

Mnemonic Description Byte CycleACALL addr11 Absolute subroutine call 2 6LCALL addr16 Long subroutine call 3 6RET Returns from subroutine 1 4RETI Returns from interrupt subroutine 1 4AJMP addr11 Absolute jump 2 3LJMP addr16 Long jump 3 4SJMP rel Short jump (from –128 to +127 locations relative to the following instruction) 2 3JC rel Jump if carry flag is set. Short jump. 2 3JNC rel Jump if carry flag is not set. Short jump. 2 3JB bit,rel Jump if direct bit is set. Short jump. 3 4JBC bit,rel Jump if direct bit is set and clears bit. Short jump. 3 4JMP @A+DPTR Jump indirect relative to the DPTR 1 2JZ rel Jump if the accumulator is zero. Short jump. 2 3JNZ rel Jump if the accumulator is not zero. Short jump. 2 3CJNE A,direct,rel Compares direct byte to the accumulator and jumps if not equal. Short jump. 3 4CJNE A,#data,rel Compares immediate data to the accumulator and jumps if not equal. Short jump. 3 4CJNE Rn,#data,rel Compares immediate data to the register and jumps if not equal. Short jump. 3 4CJNE @Ri,#data,rel Compares immediate data to indirect register and jumps if not equal. Short jump. 3 4DJNZ Rn,rel Decrements register and jumps if not 0. Short jump. 2 3DJNZ Rx,rel Decrements direct byte and jump if not 0. Short jump. 3 4NOP No operation 1 1

Data Transfer Instructions

Data transfer instructions move the content of one register to another. The register the content of which is moved remains unchanged. If they have the suffix “X” (MOVX), the data is exchanged with external memory.

Page 71: Report on Dtmf Based Land Rover

D A T A T R A N S F E R I N S T R U C T I O N S

Mnemonic Description Byte CycleMOV A,Rn Moves the register to the accumulator 1 1MOV A,direct Moves the direct byte to the accumulator 2 2MOV A,@Ri Moves the indirect RAM to the accumulator 1 2MOV A,#data Moves the immediate data to the accumulator 2 2MOV Rn,A Moves the accumulator to the register 1 2MOV Rn,direct Moves the direct byte to the register 2 4MOV Rn,#data Moves the immediate data to the register 2 2MOV direct,A Moves the accumulator to the direct byte 2 3MOV direct,Rn Moves the register to the direct byte 2 3MOV direct,direct Moves the direct byte to the direct byte 3 4MOV direct,@Ri Moves the indirect RAM to the direct byte 2 4MOV direct,#data Moves the immediate data to the direct byte 3 3MOV @Ri,A Moves the accumulator to the indirect RAM 1 3MOV @Ri,direct Moves the direct byte to the indirect RAM 2 5MOV @Ri,#data Moves the immediate data to the indirect RAM 2 3MOV DPTR,#data Moves a 16-bit data to the data pointer 3 3MOVC A,@A+DPTR Moves the code byte relative to the DPTR to the accumulator (address=A+DPTR) 1 3MOVC A,@A+PC Moves the code byte relative to the PC to the accumulator (address=A+PC) 1 3MOVX A,@Ri Moves the external RAM (8-bit address) to the accumulator 1 3-10MOVX A,@DPTR Moves the external RAM (16-bit address) to the accumulator 1 3-10MOVX @Ri,A Moves the accumulator to the external RAM (8-bit address) 1 4-11MOVX @DPTR,A Moves the accumulator to the external RAM (16-bit address) 1 4-11PUSH direct Pushes the direct byte onto the stack 2 4POP direct Pops the direct byte from the stack/td> 2 3XCH A,Rn Exchanges the register with the accumulator 1 2XCH A,direct Exchanges the direct byte with the accumulator 2 3XCH A,@Ri Exchanges the indirect RAM with the accumulator 1 3XCHD A,@Ri Exchanges the low-order nibble indirect RAM with the accumulator 1 3

Logic Instructions

Logic instructions perform logic operations upon corresponding bits of two registers. After execution, the result is stored in the first operand.

L O G I C I N S T R U C T I O N S

Mnemonic Description Byte CycleANL A,Rn AND register to accumulator 1 1

Page 72: Report on Dtmf Based Land Rover

ANL A,direct AND direct byte to accumulator 2 2ANL A,@Ri AND indirect RAM to accumulator 1 2ANL A,#data AND immediate data to accumulator 2 2ANL direct,A AND accumulator to direct byte 2 3ANL direct,#data AND immediae data to direct register 3 4ORL A,Rn OR register to accumulator 1 1ORL A,direct OR direct byte to accumulator 2 2ORL A,@Ri OR indirect RAM to accumulator 1 2ORL direct,A OR accumulator to direct byte 2 3ORL direct,#data OR immediate data to direct byte 3 4XRL A,Rn Exclusive OR register to accumulator 1 1XRL A,direct Exclusive OR direct byte to accumulator 2 2XRL A,@Ri Exclusive OR indirect RAM to accumulator 1 2XRL A,#data Exclusive OR immediate data to accumulator 2 2XRL direct,A Exclusive OR accumulator to direct byte 2 3XORL direct,#data Exclusive OR immediate data to direct byte 3 4CLR A Clears the accumulator 1 1CPL A Complements the accumulator (1=0, 0=1) 1 1SWAP A Swaps nibbles within the accumulator 1 1RL A Rotates bits in the accumulator left 1 1RLC A Rotates bits in the accumulator left through carry 1 1RR A Rotates bits in the accumulator right 1 1RRC A Rotates bits in the accumulator right through carry 1 1

Bit-oriented Instructions

Similar to logic instructions, bit-oriented instructions perform logic operations. The difference is that these are performed upon single bits.

B I T - O R I E N T E D I N S T R U C T I O N S

Mnemonic Description Byte CycleCLR C Clears the carry flag 1 1CLR bit Clears the direct bit 2 3SETB C Sets the carry flag 1 1SETB bit Sets the direct bit 2 3CPL C Complements the carry flag 1 1CPL bit Complements the direct bit 2 3ANL C,bit AND direct bit to the carry flag 2 2ANL C,/bit AND complements of direct bit to the carry flag 2 2ORL C,bit OR direct bit to the carry flag 2 2

Page 73: Report on Dtmf Based Land Rover

ORL C,/bit OR complements of direct bit to the carry flag 2 2MOV C,bit Moves the direct bit to the carry flag 2 2MOV bit,C Moves the carry flag to the direct bit 2 3

3.2 Description of all 8051 instructions

Here is a list of the operands and their meanings:

A - accumulator;

Rn - is one of working registers (R0-R7) in the currently active RAM memory bank;

Direct - is any 8-bit address register of RAM. It can be any general-purpose register or a

SFR (I/O port, control register etc.);

@Ri - is indirect internal or external RAM location addressed by register R0 or R1;

#data - is an 8-bit constant included in instruction (0-255);

#data16 - is a 16-bit constant included as bytes 2 and 3 in instruction (0-65535);

addr16 - is a 16-bit address. May be anywhere within 64KB of program memory;

addr11 - is an 11-bit address. May be within the same 2KB page of program memory as

the first byte of the following instruction;

rel - is the address of a close memory location (from -128 to +127 relative to the first

byte of the following instruction). On the basis of it, assembler computes the value to add

or subtract from the number currently stored in the program counter;

bit - is any bit-addressable I/O pin, control or status bit; and

C - is carry flag of the status register (register PSW).

VOLTAG REGULATORS

Voltage regulators produce fixed DC output voltage from variable DC (a small amount of AC on it). Normally we get fixed output by connecting the voltage regulator at the output of the filtered DC (see in above diagram). It can also used in circuits to get a low DC voltage from a high DC voltage (for example we use 7805 to get 5V from 12V). There are two types of voltage regulators1. fixed voltage regulators (78xx, 79xx)2. Variable voltage regulators (LM317)

In fixed voltage regulators there is another classification1. +ve voltage regulators2. -ve voltage regulators

Page 74: Report on Dtmf Based Land Rover

POSITIVE VOLTAGE REGULATORS

This include 78xx voltage regulators. The most commonly used ones are 7805 and 7812. 7805 gives fixed 5V DC voltage if input voltage is in (7.5V,20V). You may sometimes have questions like, what happens if input voltage is <7.5 V or some 3V, the answer is that regulation won't be proper. Suppose if input is 6V then output may be 5V or 4.8V, but there are some parameters for the voltage regulators like maximum output current capability, line regulation etc.. , that parameters won't be proper. When I applied 3.55V input, i got around 3.5V. Remember that electronics components should be used in the proper voltage and current ratings as specified in datasheet. You can work without following it, but you won't be able to get some parameters of the component. Get datasheet from google by searching '7805 datasheet' or from www.alldatasheet.comNext task is to identify the leads of the 7805. So first u have to keep the lead downward and the writing to your side,see the figure below. You can see the heat sink above the voltage regulator.(1-input,2-gnd,3-output)

This is the same way of lead identification for all 3 terminal IC's (for eg.Power transistor).

The above diagram shows how to use 7805 voltage regulator. In this you can see that coupling capacitors are used for good regulation. But there is no need for it in normal case ( I never used these capacitors). But if you are using 7805 in analog circuit you

Page 75: Report on Dtmf Based Land Rover

should use capacitor, otherwise the noise in the output voltage will be high. The mainly available 78xx IC's are 7805, 7809, 7812, 7815, 7824.

NEGATIVE VOLTAGE REGULATORS

Mostly available -ve voltage regulators are of 79xx family. You will use -ve voltage if you use IC741. For IC741 +12v and -12v will be enough, even though in most circuits we use +15v and -15v. You can get more information about 7905 from the following link. http://www.national.com/ds/LM/LM7905.pdfhttp://cache.national.com/ds/LM/LM7905.pdf7805 gives fixed -5V DC voltage if input voltage is in (-7V,-20V)The mainly available 79xx IC's are 7905, 7912.1.5A output current, short circuit protection, ripple rejection are the other features of 79xx and 78xx IC's

VARIABLE VOLTAGE REGULATORS

Most commonly variable voltage regulator is LM317 although other variable voltage regulators are available. The advantage of variable voltage regulator is that you can get a variable voltage supply by just varying the resistance only.http://focus.ti.com/docs/prod/folders/print/lm317.htmlhttp://www.national.com/pf/LM/LM317.htmlhttp://www.electronics-lab.com/articles/LM317/

Page 76: Report on Dtmf Based Land Rover

3V (VIN − VOUT) 40V, Vout=1.25 V

Page 77: Report on Dtmf Based Land Rover

From the above the equation you can see that output voltage is proportional to R1 and R2. But in the above equation we can neglect I adj. So Vout=1.25(1+R2/R1). If you put R1=R2=1Kohm Vout=2.5V. LM317 can be used to drive motor because it can handle output current up to 1.5A. In some low power devices like image sensor or USB we require 3.3V, in that circuit we use LM317.In a line follower we introduce some speed variations for motor for different bendings, you can do it by either using PWM or using the above circuit.

NOTE:Remember about the input voltage limitations.Remember about the heat sink of the voltage regulators before touching the voltage regulator IC because it will be in the heated state normally. Your hand will get burned (not big burn,some small) if we touch the heat sink of the voltage regulator. So first touch the heat sink gently and confirm it is not heated, and then only remove the IC from the breadboard. If you are driving high power circuits and motors from the output of the voltage regulator screw an external heat sink to the voltage regulator. Size, of the heat sink depends on the output power driving RESISTORResistors offers a resistance to theflow of current. Mainly resistors are classified according totheir resistance values and their power ratings. Resistancesrange from 10 ohm to 56Mohm(or more) and power ratingsfrom 1/8W to 20W. We mostly use resistance in this range eventhough more power rating high value resistors are available. Sowhen you select a resistor its value and power rating should bethe deciding parameter. Normally available resistors are 1/8W,you can see this type of resistors in the resistance box whichcontain resistances from 10 ohm to around 56Mohm, costsaround Rs.30. But this resistor leads are flexible such that itwill get bend easily. These 1/8W resistors are used in low powerdevices. The one which available in shops are of 1/4W which wemainly use. P=I^2 * R, heat dissipation on resistor depends onthe current flowing through it. Therefore for high currentoperations we use resistance of higher current ratings.The sizeof the resistor determines its power rating. Suppose if u put aresistor series with a motor which have a rating of 250mA(DCmotor) -600mA(Stepper motor), then you can see thatP=I^2R=.25^2*R=.0625R. Assume R=10 ohm then P=.625W>1/2W. In this case you have to use a resistor of about 1W ormore.There are two types of resistors - fixed and variable.

Page 78: Report on Dtmf Based Land Rover

Now let's see how you can measure the resistance of a resistor. This isdone by color coding over the resistor or you can multimeter to measureresistance. As a beginner you should use color coding. See the followingdiagrams carefully, you can see that 4-band code, 5--band code and 6--band code( see next diagram). But we mainly get resistors of 4-band code.You can get a 1/4W resistor for Ps.20 irrespective of the value of itsresistance. Due to the aging and other temperature effects, value of aresistor will change. That change is indicated using tolerance.The followingfigure show how to bend a resistor so that you can insert it in a

Page 79: Report on Dtmf Based Land Rover

breadboard. Don't bend too much close to the body of the resistor becauseit will leads to the breaking of the leads. So bend carefully. Sometimes youhave to cut the leads of the resistor by some amount so that it can easilyinserted properly. See in the following figure ( resistor in the breadboard).In this case cut the leads of the resistor so that body of resistor just touchesthe breadboard(see in the PCB).

Page 80: Report on Dtmf Based Land Rover

Remember that all the values of fixed resistances are not available.Suppose if you want a 2Kohm resistor in your circuit, you can use avariable resistor(potentiometer) or two 1Kohm resistor in series. Only thefollowing resistances are available.

Page 81: Report on Dtmf Based Land Rover
Page 82: Report on Dtmf Based Land Rover
Page 83: Report on Dtmf Based Land Rover

POTENTIOMETER( ' POT ' )Potentiometer is a variable resistor which is usedto vary the resistance by rotating the shaft. Potentiometers are availablefrom 100 ohm to 470Kohm(or more). Cost depends on the size ofpotentiometer, vary from Rs.4 onwards.

Potentiometer is used as a voltage divider. If we connect Lead A to Vcc andLead B to ground then you can get voltages from 0 to Vcc by taking voltage at LeadW and LeadB. Mainly potentiometers are used to generate reference voltage for LM324. Suppose if you couple potentiometer to the shaft of a motor, then we can measure the angle moved by shaft by connect the output of Leads W and Lead B to an ADC to get a digital reading of angle. i.e a shaft encoder, but there is a

Page 84: Report on Dtmf Based Land Rover

limitation, we can't get rotation >270 degree and also number of rotations since potentiometer shaft can only move from A to B.

Above figure shows different types of potentiometers available in market.Second and third potentiometers are mainly used when you want to change the value of resistance rarely and first one used when you had to vary resistance frequently. Second and third one are easy to be inserted in breadboard and they remain fixed. Resistance is varied by rotating the shaft in the body of the potentiometer.