conveyor belt robot

157
INDUSTRIAL CONVEYOR BELT ROBOT

Upload: mygodsp

Post on 24-Dec-2015

30 views

Category:

Documents


3 download

DESCRIPTION

A conveyor belt automation robot used in industries

TRANSCRIPT

Page 1: Conveyor Belt Robot

INDUSTRIAL CONVEYOR BELT ROBOT

Page 2: Conveyor Belt Robot

INDEX

CONTENTS PAGE NO

1. INTRODUCTION OF THE PROJECT

1.1 OBJECTIVE

1.2 DESCRIPTION

1.3 BLOCK DIAGRAM DISCRIPTION

2. INTRODUCTION TO EMBEDDED DYSTEMS

2.1 INTRODUCTION

2.2 BLOCK DIAGRAM

2.3 DESIGN CYCLE

2.4 DESCRIPTION

3. HARDWARE MODULE DISCRIPTION

3.1 MICROCONTROLLER

3.1.1 Introduction of Micro Controllers

Page 3: Conveyor Belt Robot

3.1.2 Architecture

3.1.3 Pin Description

3.2 POWER SUPPLY

3.2.1 Transformer

3.2.2 Rectifier

3.2.3 Regulator

3.2.4 Filters

3.4 Conveyor Belt

3.5 Robotic ARM

3.6 Controller

4. SOFTWARE TOOLS & INTEGRATION

4.1 KEIL

4.2 EXPRESS PCB

4.3 EMBEDDED C

5. CONCLUSION

6. BIBILOGRAPHY

Page 4: Conveyor Belt Robot

1. INTRODUCTION OF THE PROJECT

ABSTRACT:

The objective of our proposed project is to design and implement an industrial conveyor

belt robot. The idea is to implement a two parallel conveyor belts with two robotic arm at the end

of each to pick and place objects.

Overview:

Industries such and packaging and manufacturing unit with multiple and large scale

manufacturing may often require systems to guide the designed product to the next unit like the

assembling or the building or the packing etc. There are also cases where these designed

products have to be counted. In either of these cases or both we would be in need of conveyors.

Our project will be designed and implemented according to the requirement of the unit or can be

configured according to the existing set up of the factory.

Implementation:

In our project we will have two parallel conveyor belt unit running around a constant

speed. Now on both of the sides it will be enable with two robotic arm units. These are capable

of rotating both horizontally and vertically 360 degrees. Now the first unit will be placing the

object and the second unit will be receiving the object. In order to make the execution of the

system smooth we have a bit of electronics involved in it. We may use either a 555 timer ic or a

Page 5: Conveyor Belt Robot

small range microcontroller to control or to synchronize the movements of both the units. The

system can also be enhanced to count the number of objects with modification in the circuitry.

This project will be reducing the stress of packing units and can be used in wide range of

industries like the molding, packing, assembling, drying and much more.

Components used:

1. Conveyor belt

2. Motor

3. Motor drivers

4. Robotic arms

5. Power supply units

SYSTEM DESIGN:

CONVEYOR BELT 1

CONVEYOR BELT 2

ROBOTICARM 1

ROBOTICARM 2

CONTROL

UNIT

Page 6: Conveyor Belt Robot

PROJECT BLOCK DIAGRAM:

POWER SUPPLY

RF RECEIVER

MOTOR

DRIVERS

ROBOTIC

ARM 1

MICRO

CONTROLLER

ROBOTIC

ARM 2

Page 7: Conveyor Belt Robot

CONVEYOR BELT OVERVIEW

Belt ConveyorThe belt conveyor is an endless belt moving over two end pulleys at fixed positions and

used for transporting material horizontally or at an incline up or down. The main components of a belt conveyor are.

1. The belt that forms the moving and supporting surface on which the conveyed material rides. It is the tractive element. The belt should be selected considering the material to be transported.

2. The idlers, which form the supports for the carrying and return stands of the belt.

3. The pulleys that support and move the belt and controls its tension.

4. The drive that imparts power to one or more pulleys to move the belt and its loads.

The structure that supports and maintains the alignments of the idlers and pulleys and support the driving machinery

Conveyor belts are widely used in mineral industry. Underground mine transport, opencast mine transport and processing plants deploy conveyor belts of different kinds to adopt the specific job requirements. The main advantages of conveyor belt system are:

1. A wider range of material can be handled which pause problems in other transportation means. Belt conveyor can be used for abrasive, wet, dry, sticky or dirty material. The lump size of the transported material is limited by the width of the belt. Belts up to 2500 mm wide are used in mining industry.

2. Higher capacity can be handled than any other form of conveyor at a considerably lower cost per tonne kilometre. Conveyor belts with capacity of 11000t/h and even higher can be deployed to match with higher capacity mining machinery.

3. Longer distances can be covered more economically than any other transportation system. A single belt conveyor or a series of belt conveyors can do this. Belt conveyors can be adopted for cross-country laying.

4. By the use of many forms of ancillary equipment such as mobile trippers or spreaders bulk material can be distributed and deposited whenever required.

5. Many other functions can be performed with the basic conveying like weighing, sorting, picking, sampling, blending, spraying, cooling, drying etc.

6. Structurally it is one of the lightest forms of conveying machine. It is comparatively cheaper and supporting structures can be used for many otherwise impossible structures such as crossing rivers, streets and valleys.

Page 8: Conveyor Belt Robot

7. The belt conveyor can be adopted for special purposes (fire resistant, wear resistant, corrosion resistant, high angle negotiation etc.) and can be integrated with other equipment.

8. It can be horizontal, incline or decline or combination of all.

9. Minimum labour is required for the operation and maintenance of belt conveyor system.

10. In underground mine transport, belt conveyor can be used in thin seams as it eliminates the rock works that might otherwise be required to gain haulage height. Moreover, belt conveyor can provide continuous haulage service from pit bottom to the surface.

The limitations of conveyor belt are:

1. The loading and transfer points need to be properly designed.

2. Numbers of protective devices have to be incorporated to save the belt from getting damaged by operational problems.

3. The belt needs higher initial tension (40-200% of useful pull).

4. The use of belt is restricted by the lump size. If the maximum diagonal of a irregular lump is X then the belt width (B) is approximately given by:

where, B: Belt width, mm

X: Longest diagonal of irregular lump, mm

a: Factor to account for grading. a is taken as 2.5 for graded material and 3 for un-graded

material. However, for particular material these values must be properly estimated.

5. Conveying of sticky material is associated with problems of cleaning and discharge causing poor productivity.

6. Higher elongation of the belt (4% elongation may take place at the working load).

Some of the applications of belt conveyors are shown in Figures below:

Level or inclined Conveyor receiving material at tail end and discharging at head end.

Page 9: Conveyor Belt Robot

Level Conveyor receiving material at any point through travelling Hopper and discharging at

head end.

Level and inclined Conveyor receiving material at and near tail end, having vertical curve to incline, and discharging at head end.

Page 10: Conveyor Belt Robot

Level and inclined Conveyor with chute. Material received from bins too close to elevated head end to permit use of vertical curve.

Inclined and level Conveyor receiving material at tail end and discharging from level section through a movable Tripper.

Page 11: Conveyor Belt Robot

Level Conveyor on raised structure with double-wing Tripper forming storage piles on both sides of Conveyor.

Inclined Conveyor receiving material at tail end and discharging at several points through a series of fixed Trippers.

Page 12: Conveyor Belt Robot

Level Conveyor with Stacker or Boom Conveyor mounted on revolving turntable so as to discharge to both sides of Conveyor.

INFORMATION REQUIRED TO DESIGN A BELT CONVEYOR 1. Length of conveyor from centre to centre of end pulleys.

2. Inclination-level or inclined. Either degree of inclination, or distance to be lifted or lowered.

3. Average capacity per hour.

4. Maximum capacity per hour.

5. Material to be conveyed, and weight per cubic foot. 6. Average size of material.

7. Size of largest pieces and percentage in feed.

8. (a) Nature of material -dry or wet (moisture content).

(b) Abrasive or corrosive?

9. How material is to be fed to the belt and particulars of feed point or points.

10. How material is to be discharged from the belt i.e. overhead pulley or by trippers, and particulars of discharge points.

11. General indication of supporting structure.

12. Power available for driving. If by A.C. electric motor, state voltage, phase and frequency. If D.C. motor state voltage.

Items 1 and 2 determine the suitability of belt conveyors, since inclination is a limiting factor. Items 1-7 determine the speed and width of the conveyor belt, the power needed for the drive, the type of drive, the number of belt plies, size of pulleys, shafts and spacing of idlers. Items 8-10 determine the quality and thickness of the rubber cover on the belt.

BELT CONVEYOR MAINTENANCE

Belt conveyor system can serve economically provided it is maintained well. Maintenance of this system involves number of routine works. Inspection of the various components and initiating timely repair or servicing of these components in case any default is noticed is of premier importance. To maintain a belt conveyor system following items must be carefully looked into:

Page 13: Conveyor Belt Robot

Belt cleaners:Belt cleaners are required for both the carrying side and the non carrying side of the belt. Material falling on the non-carrying side of the belt needs to be arrested before it get traped in the tail pulley to cause damage to the lagging and sway of the belt. The carrying side needs cleaning when carried material is sticky in nature.

To deflect the material coming on the non-carrying side deflector belt plows are used. Such plows can be selected from number of available sources or can be locally made considering that the rubber used in it should be softer than the surface of the belt conveyor. It must be easy to install and maintain.

Belt trainersBelt trainer is a device that helps true running of belt conveyor. It prevents off-center loading and belt mistracking. The belt trainers are also called self aligning idlers designed with a pivot and tilt action. They can immediately centre and control the misalignment problems of a running belt.

Skirt clamps, Skirt clamps are used for eliminating loading point spillage at the conveyor loading and transfer points. The skirt rubber used for this should be selected considering its hardness with respect to the top cover of the belt. As it will be requiring adjustments after wear so the fixing arrangement should be simple, easily accessible and less time consuming.

Pulley laggingPulley laggings are necessary for better traction and to eliminate belt slippage.

CONVEYOR BELT MAINTENANCE TOOLSTo save time and money, and to simplify routine belt maintenance procedures, proper service and maintenance tools should be procured. Some examples are:

MULTIPLE RIVET DRIVING TOOLSThis tool is used for mechanical belt fastening.This easy-to-use, portable tool makes multiple rivet driving simple and fast. Some tools have drive rods that can drive five rivets simultaneously.

BELT CUTTERBelt cutters are designed to enhance operator safety. Some belt cutters are chain-driven, double-edged safety blade and are shielded from operator contact. Such blade can be driven from either end of the cutter and cuts in both directions.

Belt Protection ControlsThere are number of devices provided for protecting conveyor belt system. These are:

Page 14: Conveyor Belt Robot

1. Belt alignement control: Belt should be aligned with the drive pulleys and the carrying and return idlers. Belt alignment sensors are typically positioned along the edges of the conveyor fabric. They are usually at the discharge and at the loading zones, however can be distributed over the length of the conveyor. Switches consists of Roller Switches, Limit Switches, Proximity Switches, Photoelectric Switches, etc. When the edge of the belt trips the alignement switch for a timed period, the conveyor is halted. In steel cord belts edge tracking is done by using alignment sensors. This helps to get signature of tension distribution within the carcass which in turn does the condition monitoring.

2. Belt Overload: The electric drive motor has overload protection. The motor overload can be a simple bi-metallic or melting eutectic alloy or a complex computer based motor-thermal model. Sometimes belt weigh scales are also used for overload protection.

3. Belt Slip: Belt slip is the loss in traction of the drive pulley(s) to the belt cover. Belt slip can destroy a belt or drive pulley. Belt slip protection provides a belt drive speed sensor that compares the present belt speed with the belt intended speed. For constant speed belts belt slip monitoring is done by a slip switch with a setpoint that trips the conveyor drive when the belt speed is below 80% of full speed. The belt slip switch is bypassed during starting and stopping. For variable speed conveyor belt slip monitoring consists of a speed sensor that measures the belt speed and compares with the speed reference sent to the drive system. When the belt speed is below 80% of the intended speed the conveyor drive is tripped. A method to adjust and test belt slip is normally provided in the belt control system.

4. Take-up Overtravel : Overtravel limit switches can be placed at the far extremes of the counterweight or take up device travel. In a gravity counterweight take-up, the top overtravel switch trip may suggest a jammed conveyor belt condition. A bottom overtravel switch may indicate belt stretch, or a broken belt fabric flight. Excessive take-up motion during starting and stopping indicate that the type of drive control is either inadequate or that is not working properly.

5. Transfer Chute Plug: If the conveyor transfers material through a transfer chute, the transfer chute plug monitors blocked flow as blocked flow may damage the conveyor belt. Under blocked condition the transfer chute plug switch trips the conveyor drive.

6. Bin Level Control: If the conveyor belt is used to fill bins or stock piles over dumping may damage the belt. Bin level sensors protect the belt from probable beltdamage. Simple hanging tilt switch or analogue devices like ultrasonic, radar or laser devices may be used.

7. Pull-chord Stop Switches: These are emergency switches that can be actuated by pulling a chord provided along the belt conveyor.

8. Rip Detectors: Rip detectors provide belt protection in case of a rip or tear of the belt. Simple rip detector is spill switch located below the conveyor near the loading point. There are complex rip switches available, which require periodic maintenance.

9. Fire Detection: Thermal trip switches are provided with smoke sensors, CO sensors or fibre optic temperature sensors.

10. Dust Sprays: Water or chemical based dust suppressing system can eliminate or reduce dust problems in certain special conveyor belt installations

Page 15: Conveyor Belt Robot

Belt ControlsThe belt control involves the following:

Stop/start: At single or multiple stations.

Start warning: Audible or visual signal for pre-start warning

Interlock: The sequence control between the master and slave conveyors.

Telemetry: Distribution of belt control and information over significant distance.

Lockout: Physical lockout of the all motive power sources.

2 INTRODUCTION TO EMBEDDED SYSTEMS

2.1 EMBEDDED SYSTEM DEFINITION

Intelligent, programmable, and computing electronic device designed to perform specific

tasks based on a fixed time frame.

An Embedded System is a combination of hardware and software, perhaps with some

mechanical and other components, designed to perform a specific

In general, "embedded system" is not an exactly defined term, as many systems have some

element of programmability. For example, Handheld computers share some elements with

embedded systems — such as the operating systems and microprocessors which power them —

but are not truly embedded systems, because they allow different applications to be loaded and

peripherals to be connected.

HISTORY

Page 16: Conveyor Belt Robot

In the earliest years of computers in the 1930-40s, computers were sometimes dedicated

to a single task, but were far too large and expensive for most kinds of tasks performed by

embedded computers of today. Over time however, the concept of programmable controllers

evolved from traditional electromechanical sequencers, via solid d state devices, to the use of

computer technology.

One of the first recognizably modern embedded systems was the Apollo Guidance

Computer, developed by Charles Stark Draper at the MIT Instrumentation Laboratory. At the

project's inception, the Apollo guidance computer was considered the riskiest item in the Apollo

project as it employed the then newly developed monolithic integrated circuits to reduce the size

and weight. An early mass-produced embedded system was the Autonetics D-17 guidance

computer for the Minuteman missile, released in 1961. It was built from transistor logic and had

a hard disk for main memory. When the Minuteman II went into production in 1966, the D-17

was replaced with a new computer that was the first high-volume use of integrated circuits. This

program alone reduced prices on quad nand gate ICs from $1000/each to $3/each, permitting

their use in commercial products.

Since these early applications in the 1960s, embedded systems have come down in price

and there has been a dramatic rise in processing power and functionality. The first

microprocessor for example, the Intel 4004 was designed for calculators and other small systems

but still required many external memory and support chips. In 1978 National Engineering

Manufacturers Association released a "standard" for programmable microcontrollers, including

almost any computer-based controllers, such as single board computers, numerical, and event-

based controllers.

As the cost of microprocessors and microcontrollers fell it became feasible to replace

expensive knob-based analog components such as potentiometers and variable capacitors with

up/down buttons or knobs read out by a microprocessor even in some consumer products. By the

mid-1980s, most of the common previously external system components had been integrated into

Page 17: Conveyor Belt Robot

the same chip as the processor and this modern form of the microcontroller allowed an even

more widespread use, which by the end of the decade were the norm rather than the exception for

almost all electronics devices.

CHARACTERISTIC FEATURES

Embedded systems are designed to do some specific task, rather than be a general-

purpose computer for multiple tasks. Some also have real-time performance constraints

that must be met, for reason such as safety and usability; others may have low or no

performance requirements, allowing the system hardware to be simplified to reduce costs.

Embedded systems are not always separate devices. Most often they are physically built-

in to the devices they control.

The software written for embedded systems is often called firmware, and is stored in read-

only memory or Flash memory chips rather than a disk drive. It often runs with limited

computer hardware resources: small or no keyboard, screen, and little memory.

User interfaces

Embedded systems range from no user interface at all — dedicated only to one task — to full

user interfaces similar to desktop operating systems in devices such as PDAs.

Simple systems

Page 18: Conveyor Belt Robot

Simple embedded devices use buttons, Led’s, and small character- or digit-only displays, often

with a simple menu system.

In more complex systems

A full graphical screen, with touch sensing or screen-edge buttons provides flexibility while

minimizing space used: the meaning of the buttons can change with the screen, and selection

involves the natural behavior of pointing at what's desired.The rise of the World Wide Web has

given embedded designers another quite different option: providing a web page interface over a

network connection. This avoids the cost of a sophisticated display, yet provides complex input

and display capabilities when needed, on another computer. This is successful for remote,

permanently installed equipment such as Pan-Tilt-Zoom cameras and network routers.

CPU platforms

Embedded processors can be broken into two broad categories: ordinary microprocessors (μP)

and microcontrollers (μC), which have many more peripherals on chip, reducing cost and size.

Contrasting to the personal computer and server markets, a fairly large number of basic CPU

architectures are used; there are Von Neumann as well as various degrees of Harvard

architectures, RISC as well as non-RISC and VLIW; word lengths vary from 4-bit to 64-bits and

beyond (mainly in DSP processors) although the most typical remain 8/16-bit. Most architecture

comes in a large number of different variants and shapes, many of which are also manufactured

by several different companies.

PERIPHERALS

Embedded Systems talk with the outside world via peripherals, such as:

Serial Communication Interfaces (SCI): RS-232, RS-422, RS-485 etc

Synchronous Serial Communication Interface: I2C, JTAG, SPI, SSC and ESSI

Universal Serial Bus (USB)

Networks: Ethernet, Controller Area Network, Lon Works, etc

Page 19: Conveyor Belt Robot

Timers: PLL(s), Capture/Compare and Time Processing Units

Discrete IO: aka General Purpose Input/output (GPIO)

Analog to Digital/Digital to Analog (ADC/DAC)

2.2 BLOCK DIAGRAM OF EMBEDDED SYSTEM

Figure shows one possible organization for an embedded system

Page 20: Conveyor Belt Robot

In addition to the CPU and memory hierarchy, there are a variety of interfaces that enable the

system to measure, manipulate, and otherwise interact with the external environment. Some

differences with desktop computing may be:

The human interface may be as simple as a flashing light or as complicated as real-time

robotic vision.

The diagnostic port may be used for diagnosing the system that is being controlled -- not

just for diagnosing the computer.

Special-purpose field programmable (FPGA), application specific (ASIC), or even non-

digital hardware may be used to increase performance or safety.

Software often has a fixed function, and is specific to the application.

EXAMPLES OF EMBEDDED SYSTEMS

I. Signal Processing System Example

High-performance in small volume

1 GFLOPS, 1 Gb/sec I/O, 32-128 MB RAM

Many high-speed DSP processors

High speed bus/switch interconnects

Software tuned for high performance

Tens to hundreds of units sold

Very high development costs

15-30 year lifetime

- Real-life systems:

Page 21: Conveyor Belt Robot

o Synthetic aperture Radar (SAR)

o Sonar

o Real-time video

o Medical Imaging

II. Mission Critical System Example

High-reliability, high-end design

10-100 MIPS, 16-32 MB RAM

Mid- to high-range 32-bit CISC uniprocessor

Analog I/O channels with real-time control loops; 10 Mb/sec

Mission-critical system

Dual-redundant hardware

Painstaking software development & certification

High development costs

Hundreds of units sold

20-30 year lifetime

Page 22: Conveyor Belt Robot

- Real-life systems:

o Jet engine control

o Manned spacecraft control

o Nuclear power plant control

III. Distributed Control System Example

Moderately inexpensive, mid-range design

1-10 MIPS, 1-16 MB RAM -- times several CPUs per system

Mid-range 16- and 32-bit CISC distributed processors

A few real-time I/O control loops for each CPU

Low-speed networking among CPUs and among systems

Mission-critical system

Non-redundant hardware; ordinary software development

Electromechanical safeties provide failure protection

Moderate development costs ($1M - $10M)

Hundreds to thousands of systems sold

25-50 year lifetime

Page 23: Conveyor Belt Robot

- Real-life systems:

o High-rise elevators

o Large-building air handling

o Public transit systems

IV. "Small" System Example

Inexpensive, low-end design

100 Kilo-IPS, 1-10 Kilo-bits memory

Single-chip 8-bit microcontroller is only digital IC

One real-time loop for CPU

Not considered mission-critical, but indirectly affects

Personal safety

Bare minimum hardware, small hand-coded assembly software

No redundancy, is expected not to break within lifetime

Low development costs ($100K - $1M)

Millions of units sold

10-15 year lifetime

- Real-life systems

Page 24: Conveyor Belt Robot

o Automotive auxiliary components

o Consumer electronics

o Kitchen appliances

o Home automation

o "Smart" I/O for distributed control systems

2.3 EMBEDDED PRODUCT DEVELOPMENT LIFE CYCLE

Page 25: Conveyor Belt Robot

SOFTWARE TOOLS

Integrated Development Environment

Stand Alone Device Assemblers

Stand Alone Remote Debuggers

Stand Alone Simulators

In Circuit Emulators

HARDWARE TOOLS

CAD & Simulation tools

Orcad

PSPICE

Multisim / Modelsim

Page 26: Conveyor Belt Robot

APPLICATIONS OF EMBEDDED SYSTEM

We are living in the Embedded World. You are surrounded with many embedded

products and your daily life largely depends on the proper functioning of these gadgets.

Television, Radio, CD player of your living room, Washing Machine or Microwave Oven in

your kitchen, Card readers, Access Controllers, Palm devices of your work space enable you to

do many of your tasks very effectively. Apart from all these, many controllers embedded in your

car take care of car operations between the bumpers and most of the times you tend to ignore all

these controllers.

In recent days, you are showered with variety of information about these embedded

controllers in many places. All kinds of magazines and journals regularly dish out details about

latest technologies, new devices; fast applications which make you believe that your basic

survival is controlled by these embedded products. Now you can agree to the fact that these

embedded products have successfully invaded into our world. You must be wondering about

these embedded controllers or systems.

2.4 DESCRIPTION

What is this Embedded System?

The computer you use to compose your mails, or create a document or analyze the

database is known as the standard desktop computer. These desktop computers are manufactured

to serve many purposes and applications.

You need to install the relevant software to get the required processing facility. So, these

desktop computers can do many things. In contrast, embedded controllers carryout a specific

work for which they are designed. Most of the time, engineers design these embedded controllers

with a specific goal in mind. So these controllers cannot be used in any other place.

Page 27: Conveyor Belt Robot

Theoretically, an embedded controller is a combination of a piece of microprocessor based

hardware and the suitable software to undertake a specific task.

These days designers have many choices in microprocessors/microcontrollers. Especially,

in 8 bit and 32 bit, the available variety really may overwhelm even an experienced designer.

Selecting a right microprocessor may turn out as a most difficult first step and it is getting

complicated as new devices continue to pop-up very often.

In the 8 bit segment, the most popular and used architecture is Intel's 8031. Market

acceptance of this particular family has driven many semiconductor manufacturers to develop

something new based on this particular architecture. Even after 25 years of existence,

semiconductor manufacturers still come out with some kind of device using this 8031 core.

Military and aerospace software applications

From in-orbit embedded systems to jumbo jets to vital battlefield networks, designers of

mission-critical aerospace and defense systems requiring real-time performance, scalability, and

high-availability facilities consistently turn to the LynxOS® RTOS and the LynxOS-178 RTOS

for software certification to DO-178B.

Rich in system resources and networking services, LynxOS provides an off-the-shelf

software platform with hard real-time response backed by powerful distributed computing

(CORBA), high reliability, software certification, and long-term support options.

Page 28: Conveyor Belt Robot

The LynxOS-178 RTOS for software certification, based on the RTCA DO-178B

standard, assists developers in gaining certification for their mission- and safety-critical systems.

Real-time systems programmers get a boost with Lynux Works' DO-178B RTOS training courses.

LynxOS-178 is the first DO-178B and EUROCAE/ED-12B certifiable, POSIX®-

compatible RTOS solution.

Communications applications

"Five-nines" availability, CompactPCI hot swap support, and hard real-time response—

LynxOS delivers on these key requirements and more for today's carrier-class systems. Scalable

kernel configurations, distributed computing capabilities, integrated communications stacks, and

fault-management facilities make LynxOS the ideal choice for companies looking for a single

operating system for all embedded telecommunications applications—from complex central

controllers to simple line/trunk cards.

Lynux Works Jumpstart for Communications package enables OEMs to rapidly develop

mission-critical communications equipment, with pre-integrated, state-of-the-art, data

networking and porting software components—including source code for easy customization.

The Lynx Certifiable Stack (LCS) is a secure TCP/IP protocol stack designed especially

for applications where standards certification is required.

Electronics applications and consumer devices

As the number of powerful embedded processors in consumer devices continues to rise,

the BlueCat® Linux® operating system provides a highly reliable and royalty-free option for

systems designers.

And as the wireless appliance revolution rolls on, web-enabled navigation systems,

radios, personal communication devices, phones and PDAs all benefit from the cost-effective

Page 29: Conveyor Belt Robot

dependability, proven stability and full product life-cycle support opportunities associated with

BlueCat embedded Linux. BlueCat has teamed up with industry leaders to make it easier to build

Linux mobile phones with Java integration.

For makers of low-cost consumer electronic devices who wish to integrate the LynxOS

real-time operating system into their products, we offer special MSRP-based pricing to reduce

royalty fees to a negligible portion of the device's MSRP.

Industrial automation and process control software

Designers of industrial and process control systems know from experience that LynuxWorks

operating systems provide the security and reliability that their industrial applications require.

From ISO 9001 certification to fault-tolerance, POSIX conformance, secure partitioning and

high availability, we've got it all. Take advantage of our 20 years of experience.

MICROCONTROLLER VERSUS MICROPROCESSOR

What is the difference between a Microprocessor and Microcontroller? By microprocessor is

meant the general purpose Microprocessors such as Intel's X86 family (8086, 80286, 80386,

80486, and the Pentium) or Motorola's 680X0 family (68000, 68010, 68020, 68030, 68040, etc).

These microprocessors contain no RAM, no ROM, and no I/O ports on the chip itself. For this

reason, they are commonly referred to as general-purpose Microprocessors.

A system designer using a general-purpose microprocessor such as the Pentium or the 68040

must add RAM, ROM, I/O ports, and timers externally to make them functional. Although the

addition of external RAM, ROM, and I/O ports makes these systems bulkier and much more

Page 30: Conveyor Belt Robot

expensive, they have the advantage of versatility such that the designer can decide on the amount

of RAM, ROM and I/O ports needed to fit the task at hand. This is not the case with

Microcontrollers.

A Microcontroller has a CPU (a microprocessor) in addition to a fixed amount of RAM,

ROM, I/O ports, and a timer all on a single chip. In other words, the processor, the RAM, ROM,

I/O ports and the timer are all embedded together on one chip; therefore, the designer cannot add

any external memory, I/O ports, or timer to it. The fixed amount of on-chip ROM, RAM, and

number of I/O ports in Microcontrollers makes them ideal for many applications in which cost

and space are critical.

In many applications, for example a TV remote control, there is no need for the computing

power of a 486 or even an 8086 microprocessor. These applications most often require some I/O

operations to read signals and turn on and off certain bits.

MICROCONTROLLERS FOR EMBEDDED SYSTEMS

In the Literature discussing microprocessors, we often see the term Embedded System.

Microprocessors and Microcontrollers are widely used in embedded system products. An

embedded system product uses a microprocessor (or Microcontroller) to do one task only. A

printer is an example of embedded system since the processor inside it performs one task only;

namely getting the data and printing it. Contrast this with a Pentium based PC. A PC can be used

for any number of applications such as word processor, print-server, bank teller terminal, Video

game, network server, or Internet terminal. Software for a variety of applications can be loaded

Page 31: Conveyor Belt Robot

and run. Of course the reason a pc can perform myriad tasks is that it has RAM memory and an

operating system that loads the application software into RAM memory and lets the CPU run it.

In an Embedded system, there is only one application software that is typically burned into

ROM. An x86 PC contains or is connected to various embedded products such as keyboard,

printer, modem, disk controller, sound card, CD-ROM drives, mouse, and so on. Each one of

these peripherals has a Microcontroller inside it that performs only one task. For example, inside

every mouse there is a Microcontroller to perform the task of finding the mouse position and

sending it to the PC. Table 1-1 lists some embedded products.

Page 32: Conveyor Belt Robot

3. HARDWARE MODULE DISCRIPTION

3.1 MICROCONTROLLER (8051)

In this project work the micro-controller is playing a major role. Micro-controllers were

originally used as components in complicated process-control systems. However, because of

their small size and low price, Micro-controllers are now also being used in regulators for

individual control loops. In several areas Micro-controllers are now outperforming their analog

counterparts and are cheaper as well.

The purpose of this project work is to present control theory that is relevant to the analysis and

design of Micro-controller system with an emphasis on basic concept and ideas. It is assumed that a

Microcontroller with reasonable software is available for computations and simulations so that many

tedious details can be left to the Microcontroller. The control system design is also carried out up to the

stage of implementation in the form of controller programs in assembly language OR in C-Language.

3.1.1 INTRODUCTION

A Micro controller consists of a powerful CPU tightly coupled with memory, various I/O

interfaces such as serial port, parallel port timer or counter, interrupt controller, data acquisition

interfaces-Analog to Digital converter, Digital to Analog converter, integrated on to a single

silicon chip.

If a system is developed with a microprocessor, the designer has to go for external

memory such as RAM, ROM, EPROM and peripherals. But controller is provided all these

facilities on a single chip. Development of a Micro controller reduces PCB size and cost of

design.

Page 33: Conveyor Belt Robot

One of the major differences between a Microprocessor and a Micro controller is that a

controller often deals with bits not bytes as in the real world application.

The Major Features:

40 pin DIP package

4 i/o ports

4k Bytes of in-system Reprogrammable flash memory

Fully static operation: 1MHZ to 24MHZ

Three level programmable clock

128 bytes of RAM

Two 16 –bit timer/counters

Six interrupt sources

Programmable serial channel

Low power idle power-down modes

Why AT 8051?

The system requirements and control specifications clearly rule out the use of 16, 32 or

64 bit micro controllers or microprocessors. Systems using these may be earlier to implement

due to large number of internal features. They are also faster and more reliable but, 8-bit micro

controller satisfactorily serves the above application. Using an inexpensive 8-bit Microcontroller

will doom the 32-bit product failure in any competitive market place.

Coming to the question of why to use AT8051 of all the 8-bit microcontroller available in

the market the main answer would be because it has 4 Kb on chip flash memory which is just

sufficient for our application. The on-chip Flash ROM allows the program memory to be

reprogrammed in system or by conventional non-volatile memory Programmer. Moreover

ATMEL is the leader in flash technology in today’s market place and hence using AT 8051 is the

optimal solution.

Page 34: Conveyor Belt Robot

3.1.2AT8051 MICROCONTROLLER ARCHITECTURE

The 8051 architecture consists of these specific features:

Eight –bit CPU with registers A (the accumulator) and B

Sixteen-bit program counter (PC) and data pointer (DPTR)

Eight- bit stack pointer (PSW)

Eight-bit stack pointer (Sp)

Internal ROM or EPROM (8751) of 0(8031) to 4K (8051)

Internal RAM of 128 bytes:

1. Four register banks, each containing eight registers

2. Sixteen bytes, which may be addressed at the bit level

3. Eighty bytes of general- purpose data memory

Thirty –two input/output pins arranged as four 8-bit ports:p0-p3

Two 16-bit timer/counters: T0 and T1

Full duplex serial data receiver/transmitter: SBUF

Control registers: TCON, TMOD, SCON, PCON, IP, and IE

Two external and three internal interrupts sources.

Oscillator and clock circuits.

Page 35: Conveyor Belt Robot

Functional block diagram of micro controller

The 8051 oscillator and clock:

The heart of the 8051 circuitry that generates the clock pulses by which all the internal all

internal operations are synchronized. Pins XTAL1 And XTAL2 is provided for connecting a

resonant network to form an oscillator. Typically a quartz crystal and capacitors are employed.

The crystal frequency is the basic internal clock frequency of the microcontroller. The

manufacturers make 8051 designs that run at specific minimum and maximum frequencies

typically 1 to 16 MHz

Page 36: Conveyor Belt Robot

Fig 3.7.2: - Oscillator and timing circuit

Types of memory:

The 8051 have three general types of memory. They are on-chip memory, external Code

memory and external Ram. On-Chip memory refers to physically existing memory on the micro

controller itself. External code memory is the code memory that resides off chip. This is often in

the form of an external EPROM. External RAM is the Ram that resides off chip. This often is in

the form of standard static RAM or flash RAM.

a) Code memory

Code memory is the memory that holds the actual 8051 programs that is to be run. This

memory is limited to 64K. Code memory may be found on-chip or off-chip. It is possible to have

4K of code memory on-chip and 60K off chip memory simultaneously. If only off-chip memory

is available then there can be 64K of off chip ROM. This is controlled by pin provided as EA

Page 37: Conveyor Belt Robot

b) Internal RAM

The 89C51 have a bank of 128 of internal RAM. The internal RAM is found on-chip. So

it is the fastest Ram available. And also it is most flexible in terms of reading and writing.

Internal Ram is volatile, so when 8051 is reset, this memory is cleared. 128 bytes of internal

memory are subdivided. The first 32 bytes are divided into 4 register banks. Each bank contains

8 registers. Internal RAM also contains 128 bits, which are addressed from 20h to 2Fh. These

bits are bit addressed i.e. each individual bit of a byte can be addressed by the user. They are

numbered 00h to 7Fh. The user may make use of these variables with commands such as SETB

and CLR.

FLASH MEMORY:

Flash memory (sometimes called "flash RAM") is a type of constantly-powered non

volatile that can be erased and reprogrammed in units of memory called blocks. It is a variation

of electrically erasable programmable read-only memory (EEPROM) which, unlike flash

memory, is erased and rewritten at the byte level, which is slower than flash memory updating.

Flash memory is often used to hold control code such as the basic input/output system (BIOS) in

a personal computer. When BIOS needs to be changed (rewritten), the flash memory can be

written to in block (rather than byte) sizes, making it easy to update. On the other hand, flash

memory is not useful as random access memory (RAM) because RAM needs to be addressable

at the byte (not the block) level.

Flash memory gets its name because the microchip is organized so that a section of

memory cells are erased in a single action or "flash." The erasure is caused by Fowler-Nordheim

tunneling in which electrons pierce through a thin dielectric material to remove an electronic

charge from a floating gate associated with each memory cell. Intel offers a form of flash

memory that holds two bits (rather than one) in each memory cell, thus doubling the capacity of

memory without a corresponding increase in price.

Page 38: Conveyor Belt Robot

Flash memory is used in digital cellular phones, digital cameras, LAN switches, PC

Cards for notebook computers, digital set-up boxes, embedded controllers, and other devices.

Memory Type Features

FLASH Low-cost, high-density, high-speed

architecture; low power; high reliability

ROM

Read-Only Memory

Mature, high-density, reliable, low cost;

time-consuming mask required, suitable for

high production with stable code

SRAM

Static Random-Access Memory

Highest speed, high-power, low-density

memory; limited density drives up cost

EPROM

Electrically Programmable Read-Only

Memory

High-density memory; must be exposed to

ultraviolet light for erasure

EEPROMorE2PROM

Electrically Erasable Programmable

Read-Only Memory

Electrically byte-erasable; lower reliability,

higher cost, lowest density

DRAM

Dynamic Random Access Memory

High-density, low-cost, high-speed, high-

power

Technical Overview of Flash Memory

Flash memory is a nonvolatile memory using NOR technology, which allows the user to

electrically program and erase information. Intel® Flash memory uses memory cells similar to

an EPROM, but with a much thinner, precisely grown oxide between the floating gate and the

source (see Figure 2). Flash programming occurs when electrons are placed on the floating gate.

The charge is stored on the floating gate, with the oxide layer allowing the cell to be electrically

erased through the source. Intel Flash memory is an extremely reliable nonvolatile memory

architecture.

Page 39: Conveyor Belt Robot

3.1.3 PIN DESCRIPTION:

Fig : - Pin diagram of AT8051

VCC: Supply voltage.

GND: Ground.

Page 40: Conveyor Belt Robot

Port 0:

Port 0 is an 8-bit open-drain bi-directional I/O port. As an output port, each pin can sink

eight TTL inputs. When one’s 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. In this mode P0 has internal pull-ups. Port 0 also

receives the code bytes during Flash programming, and outputs the code bytes during program

verification. External pull-ups are required during program verification.

Port 1:

Port 1 is an 8-bit bi-directional I/O port with internal pull-ups. The Port 1 output buffers

can sink/source four TTL inputs. When 1s are written to Port 1 pins they are pulled high by the

internal pull-ups and can be used as inputs. As inputs, Port 1 pins that are externally being pulled

low will source current (IIL) because of the internal pull-ups. Port 1 also receives the low-order

address bytes during Flash programming and verification.

Port 2:

Port 2 is an 8-bit bi-directional I/O port with internal pull-ups. The Port 2 output buffers

can sink/source four TTL inputs. When 1s are written to Port 2 pins they are pulled high by the

internal pull-ups and can be used as inputs. As inputs, Port 2 pins that are externally being pulled

low will source current (IIL) because of the internal pull-ups. Port 2 emits the high-order address

byte during fetches from external program memory and during accesses to external data

memories that use 16-bit addresses (MOVX @DPTR). In this application, it uses strong internal

pull-ups when emitting 1s. During accesses to external data memories 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.

Page 41: Conveyor Belt Robot

Port 3:

Port 3 is an 8-bit bi-directional I/O port with internal pull-ups. The Port 3 output buffers

can sink/source four TTL inputs. When 1s are written to Port 3 pins they are pulled high by the

internal pull-ups and can be used as inputs. As inputs, Port 3 pins that are externally being pulled

low will source current (IIL) because of the pull-ups.

Port 3 also serves the functions of various special features of the AT89C51 as listed below:

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

Table: Port pins and their alternate functions

RST:

Reset input. A high on this pin for two machine cycles while the oscillator is running

resets the device.

ALE/PROG:

Address Latch Enable 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

Page 42: Conveyor Belt Robot

programming. In normal operation ALE is emitted at a constant rate of 1/6the 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 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

AT89C51 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 EA 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 latched on reset.

EA should be strapped to VCC for internal program executions. This pin also receives the 12-

volt programming enable voltage (VPP) during Flash programming, for parts that require 12-volt

VPP.

XTAL1:

Input to the inverting oscillator amplifier and input to the internal clock operating circuit.

XTAL2:

Page 43: Conveyor Belt Robot

It is the Output from the inverting oscillator amplifier.

Oscillator Characteristics:

XTAL1 and XTAL2 are the input and output, respectively, of an inverting amplifier

which can be configured for use as an on-chip oscillator, as shown in Figs 6.2.3. Either a quartz

crystal or ceramic resonator may be used. To drive the device from an external clock source,

XTAL2 should be left unconnected while XTAL1 is driven as shown in Figure 6.2.4.There are

no requirements on the duty cycle of the external clock signal, since the input to the internal

clocking circuitry is through a divide-by-two flip-flop, but minimum and maximum voltage high

and low time specifications must be observed.

Fig : Oscillator Connections Fig 6.2.4 External Clock Drive Configuration

Notes:

1. Under steady state (non-transient) conditions, IOL must be externally

Limited as follows:

Maximum IOL per port pin: 10 mA

Maximum IOL per 8-bit port: Port 0: 26 mA

Ports 1, 2, 3: 15 mA

Maximum total IOL for all output pins: 71 mA

Page 44: Conveyor Belt Robot

If IOL exceeds the test condition, VOL may exceed the related specification. Pins are

not guaranteed to sink current greater than the listed test conditions.

2. Minimum VCC for Power-down is 2V.

REGISTERS:

In the CPU, registers are used to store information temporarily. That information could

be a byte of data to be processed, or an address pointing to the data to be fetched. The vast

majority of 8051 registers are 8–bit registers. In the 8051 there is only one data type: 8bits. The

8bits of a register are shown in the diagram from the MSB (most significant bit) D7 to the LSB

(least significant bit) D0. With an 8-bit data type, any data larger than 8bits must be broken into

8-bit chunks before it is processed. Since there are a large number of registers in the 8051, we

will concentrate on some of the widely used general-purpose registers and cover special registers

in future chapters.

D7 D6 D5 D4 D3 D2 D1 D0

The most widely used registers of the 8051 are A (accumulator), B, R0, R1, R2, R3, R4,

R5, R6, R7, DPTR (data pointer), and PC (program counter). All of the above registers are 8-

bits, except DPTR and the program counter. The accumulator, register A, is used for all

arithmetic and logic instructions.

SFRs (Special Function Registers)

Among the registers R0-R7 is part of the 128 bytes of RAM memory. What about

registers A, B, PSW, and DPTR? Do they also have addresses? The answer is yes. In the 8051,

registers A, B, PSW and DPTR are part of the group of registers commonly referred to as SFR

(special function registers). There are many special function registers and they are widely used.

Page 45: Conveyor Belt Robot

The SFR can be accessed by the names (which is much easier) or by their addresses. For

example, register A has address E0h, and register B has been ignited the address F0H, as shown

in table.

The following two points should noted about the SFR addresses.

1. The Special function registers have addresses between 80H and FFH. These

addresses are above 80H, since the addresses 00 to 7FH are addresses of RAM

memory inside the 8051.

2. Not all the address space of 80H to FFH is used by the SFR. The unused locations

80H to FFH are reserved and must not be used by the 8051 programmer.

Regarding direct addressing mode, notice the following two points: (a) the address value

is limited to one byte, 00-FFH, which means this addressing mode is limited to accessing RAM

locations and registers located inside the 8051. (b) If you examine the l st file for an assembly

language program, you will see that the SFR registers names are replaced with their addresses as

listed in table.

Symbol Name Address

ACC Accumulator 0E0H

B B register 0F0H

PSW Program status word 0D0H

SP Stack pointer 81H

DPTR Data pointer 2 bytes

DPL Low byte 82H

DPH High byte 83H

P0 Port0 80H

P1 Port1 90H

Page 46: Conveyor Belt Robot

P2 Port2 0A0H

P3 Port3 0B0H

IP Interrupt priority

control

0B8H

IE Interrupt enable

control

0A8H

TMOD Timer/counter mode

control

89H

TCON Timer/counter control 88H

T2CON Timer/counter 2

control

0C8H

T2MOD Timer/counter mode2

control

0C9H

TH0 Timer/counter 0high

byte

8CH

TL0 Timer/counter 0 low

byte

8AH

TH1 Timer/counter 1 high

byte

8DH

TL1 Timer/counter 1 low

byte

8BH

TH2 Timer/counter 2 high

byte

0CDH

TL2 Timer/counter 2 low

byte

0CCH

RCAP2H T/C 2 capture register

high byte

0CBH

RCAP2L T/C 2 capture register

low byte

0CAH

SCON Serial control 98H

SBUF Serial data buffer 99H

Page 47: Conveyor Belt Robot

PCON Power control 87H

Table: 8051 Special function register Address

A Register (Accumulator)

This is a general-purpose register which serves for storing intermediate results during operating.

A number (an operand) should be added to the accumulator prior to execute an instruction upon

it. Once an arithmetical operation is performed by the ALU, the result is placed into the

accumulator. If a data should be transferred from one register to another, it must go through

accumulator. For such universal purpose, this is the most commonly used register that none

microcontroller can be imagined without (more than a half 8051 microcontroller's instructions

used use the accumulator in some way).

B Register

B register is used during multiply and divide operations which 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).

Page 48: Conveyor Belt Robot

During programming, each of registers is called by name so that their

exact address is not so important for the user. During compiling into machine code (series of

hexadecimal numbers recognized as instructions by the microcontroller), PC will automatically,

instead of registers’ name, write necessary addresses into the microcontroller.

R Registers (R0-R7)

This is a common name for the total 8 general purpose registers (R0, R1, and R2 ...R7).

Even they are not true SFRs, they deserve to be discussed here because of their purpose. The

bank is active when the R registers it includes are in use. Similar to the accumulator, they are

used for temporary storing variables and intermediate results. Which of the banks will be active

depends on two bits included in the PSW Register. These registers are stored in four banks in the

scope of RAM.

The following example best illustrates the useful purpose of these registers. Suppose that

mathematical operations on numbers previously stored in the R registers should be performed:

(R1+R2) - (R3+R4). Obviously, a register for temporary storing results of addition is needed.

Everything is quite simple and the program is as follows:

Page 49: Conveyor Belt Robot

MOV A, R3; Means: move number from R3 into accumulator

ADD A, R4; Means: add number from R4 to accumulator (result remains in accumulator)

MOV R5, A; Means: temporarily moves the result from accumulator into R5

MOV A, R1; Means: move number from R1 into accumulator

ADD A, R2; Means: add number from R2 to accumulator

SUBB A, R5; Means: subtract number from R5 (there are R3+R4)

8051 Register Banks and Stack

RAM memory space allocation in the 8051

There are 128 bytes of RAM in the 8051. The 128 bytes of RAM inside the 8051 are assigned

addresses 00 to7FH. These 128 bytes are divided into three different groups as follows:

1. A total of 32 bytes from locations 00 to 1FH hex are set aside for register banks and the stack.

2. A total of 16 bytes from locations 20 to 2FH hex are set aside for bit-addressable read/write

memory.

3. A total of 80 bytes from locations 30H to 7FH are used for read and write storage, or what is

normally called Scratch pad. These 80 locations of RAM are widely used for the purpose of

storing data and parameters nu 8051 programmers.

Register banks in the 8051

A total of 32bytes of RAM are set aside for the register banks and stack. These 32

bytes are divided into 4 banks of registers in which each bank has registers, R0-R7. RAM

locations 0 to 7 are set aside for bank 0 of R0-R7 where R0 is RAM location 0, R1 is RAM

location 1, and R2 is location 2, and so on, until memory location7, which belongs to R7 of

bank0. The second bank of registers R0-R7 starts at RAM location 08 and goes to location 0FH.

Page 50: Conveyor Belt Robot

The third bank of R0-R7 starts at memory location 10H and goes to location 17H. Finally, RAM

locations 18H to 1FH are set aside for the fourth bank of R0-R7. Fig shows how the 32 bytes are

allocated into 4 banks.

As we can see from fig 1, the bank 1 uses the same RAM space as the stack. This is a

major problem in programming the 8051. we must either not use register bank1, or allocate

another area of RAM for the stack.

Default register bank

If RAM locations 00-1F are set aside for the four register banks, which register bank of

R0-R7 do we have access to when the 8051 is powered up? The answer is register bank 0; that

is , RAM locations 0, 1,2,3,4,5,6, and 7 are accessed with the names R0, R1, R2, R3, R4, R5, R6,

and R7 when programming the 8051. It is much easier to refer to these RAM locations with

names such as R0, R1 and so on, than by their memory locations as shown in fig 2.

The register banks are switched by using the D3 & D4 bits of register PSW.

Page 51: Conveyor Belt Robot

FIG: RAM Allocation in the 8051

Page 52: Conveyor Belt Robot

Fig: 8051 Register Banks and their RAM Addresses

PSW Register (Program Status Word)

This is one of the most important SFRs. The Program Status Word (PSW) contains

several status bits that reflect the current state of the CPU. This register contains: Carry bit,

Auxiliary Carry, two register bank select bits, Overflow flag, parity bit, and user-definable status

flag. The ALU automatically changes some of register’s bits, which is usually used in regulation

of the program performing.

P - Parity bit. If a number in accumulator is even then this bit will be automatically set (1),

otherwise it will be cleared (0). It is mainly used during data transmission and receiving via

serial communication.

- Bit 1. This bit is intended for the future versions of the microcontrollers, so it is not supposed to

be here.

OV Overflow occurs when the result of arithmetical operation is greater than 255 (decimal), so

that it cannot be stored in one register. In that case, this bit will be set (1). If there is no overflow,

this bit will be cleared (0).

RS0, RS1 - Register bank selects bits. These two bits are used to select one of the four register

banks in RAM. By writing zeroes and ones to these bits, a group of registers R0-R7 is stored in

one of four banks in RAM.

RS1 RS2 Space in RAM

0 0 Bank0 00h-07h

0 1 Bank1 08h-0Fh

Page 53: Conveyor Belt Robot

1 0 Bank2 10h-17h

1 1 Bank3 18h-1Fh

F0 - Flag 0. This is a general-purpose bit available to the user.

AC - Auxiliary Carry Flag is used for BCD operations only.

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

instructions.

DPTR Register (Data Pointer)

These registers are not true ones because they do not physically exist. They consist of

two separate registers: DPH (Data Pointer High) and (Data Pointer Low). Their 16 bits are used

for external memory addressing. They may be handled as a 16-bit register or as two independent

8-bit registers. Besides, the DPTR Register is usually used for storing data and intermediate

results which have nothing to do with memory locations.

Page 54: Conveyor Belt Robot

SP Register (Stack Pointer)

The stack is a section of RAM used by the CPU to store information temporarily. This

information could be data or an address. The CPU needs this storage area since there are only a

limited number of registers.

How stacks are accessed in the 8051

If the stack is a section of RAM, there must be registers inside the CPU to point to it.

The register used to access the stack is called the SP (Stack point) Register. The stack pointer in

the 8051 is only 8 bits wide; which means that it can take values of 00 to FFH. When the 8051 is

powered up, the SP register contains value 07. This means that RAM location 08 is the first

location used for the stack by the 8051. The storing of a CPU register in the stack is called a

PUSH, and pulling the contents off the stack back into a CPU register is called a POP. In other

words, a register is pushed onto the stack to save it and popped off the stack to retrieve it. The

job of the SP is very critical when push and pop actions are performed.

Page 55: Conveyor Belt Robot

Pushing onto the stack

In the 8051 the stack pointer (SP) points to the last used location of the stack. As we

push data onto the stack, the stack pointer is incremented by one. Notice that this different from

many microprocessors, notably x86 processors in which the SP is decremented when data is

pushed onto the stack. As each PUSH is executed, the contents of the register are saved on the

stack and SP is incremented by 1. Notice that for every byte of data saved on the stack and then

SP is incremented only once. Notice also that to push the registers onto the stack we must use

their RAM addresses. For example, the instruction “PUSH” pushes register R1 onto the stack.

Popping from the stack

Popping the contents of the stack back into a given register is the opposite process of

pushing. With every pop, the top byte of the stack is copied to the register specified by the

instruction and the stack pointer is decremented once.

The upper limit of the stack

As, mentioned earlier, locations 08 to 1FH in the 8051 RAM can be used for the stack.

This is because locations 20-2FH of RAM are reserved for bit-addressable memory and must not

be used by the stack. If in a program we need more than 24 bytes (08 to 1FH=24bytes) of stack,

we can change the SP to point to RAM locations 30-7FH. This is done with the instruction

“MOV SP, #XX”.

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

Page 56: Conveyor Belt Robot

In case that external memory and serial communication system are not in use then, 4 ports within

total of 32 input-output lines are available to the user for connection to peripheral environment.

Each bit inside these ports corresponds to the appropriate pin on the microcontroller. This means

that logic state written to these ports appears as a voltage on the pin (0 or 5 V). Naturally, while

reading, the opposite occurs – voltage on some input pins is reflected in the appropriate port bit.

The state of a port bit, besides being reflected in the pin, determines at the same time whether it

will be configured as input or output. If a bit is cleared (0), the pin will be configured as output.

In the same manner, if a bit is set to 1 the pin will be configured as input. After reset, as well as

when turning the microcontroller ON, all bits on these ports are set to one (1). This means that

the appropriate pins will be configured as inputs.

Program counter:

The important register in the 8051 is the PC (Program counter). The program counter

points to the address of the next instruction to be executed. As the CPU fetches the OPCODE

from the program ROM, the program counter is incremented to point to the next instruction. The

program counter in the 8051 is 16bits wide. This means that the 8051 can access program

addresses 0000 to FFFFH, a total of 64k bytes of code. However, not all members of the 8051

have the entire 64K bytes of on-chip ROM installed, as we will see soon.

Types of instructions

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

Arithmetic Instructions

Branch Instructions

Page 57: Conveyor Belt Robot

Data Transfer Instructions

Logical Instructions

Logical Instructions with bits

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

performs (copying, addition, logical operation etc.). Mnemonics commonly are shortened form

of name of operation being executed. For example:

INCR1 ; Increment R1 (increment register R1)

LJMP LAB5 ;Long Jump LAB5 (long jump to address specified as LAB5)

JNZ LOOP ;Jump if Not Zero LOOP (if the number in the accumulator is not 0, jump to address

specified as LOOP)

Another part of instruction, called OPERAND is separated from mnemonic at least by one empty

space and defines data being processed by instructions. Some instructions have no operand; some

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

comma. For example:

RET - (return from sub-routine)

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

ADD A,R3 - (add R3 and accumulator)

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

specified as LOOP)

Arithmetic instructions

These instructions perform several basic operations (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.

Page 58: Conveyor Belt Robot

Arithmetical Instructions

Mnemonic Description Byte

Number

Oscillator

Period

ADD A,Rn Add R Register to accumulator 1 1

ADD A,Rx Add directly addressed Rx Register to accumulator 2 2

ADD A,@Ri Add indirectly addressed Register to accumulator 1 1

ADD A,#X Add number X to accumulator 2 2

ADDC A,Rn Add R Register with Carry bit to accumulator 1 1

Branch Instructions

There are two kinds of these instructions:

Unconditional jump instructions: After their execution a jump to a new location from

where the program continues execution is executed.

Conditional jump instructions: If some condition is met - a jump is executed. Otherwise,

the program normally proceeds with the next instruction.

Branch Instruction

Mnemonic Description Byte

Number

Oscillator

Period

ACALL

adr11

Call subroutine located at address within 2 K byte

Program Memory space

2 3

LCALL

adr16

Call subroutine located at any address within 64 K byte

Program Memory space

3 4

RET Return from subroutine 1 4

RETI Return from interrupt routine 1 4

AJMP adr11 Jump to address located within 2 K byte Program

Memory space

2 3

LJMP adr16 Jump to any address located within 64 K byte Program

Memory space

3 4

Data Transfer Instructions

Page 59: Conveyor Belt Robot

These instructions move the content of one register to another one. The register which content is

moved remains unchanged. If they have the suffix “X” (MOVX), the data is exchanged with

external memory.

Data Transfer Instruction

Mnemonic Description Byte NumberCycle

Number

MOV A,Rn Move R register to accumulator 1 1

MOV A,Rx Move directly addressed Rx register to accumulator 2 2

MOV A,@Ri Move indirectly addressed register to accumulator 1 1

MOV A,#X Move number X to accumulator 2 2

Logical Instructions

These instructions perform logical operations between corresponding bits of two registers. After

execution, the result is stored in the first operand.

Logical Instructions

Mnemonic Description Byte Number Cycle Number

ANL A,Rn Logical AND between accumulator and R register 1 1

ANL A,RxLogical AND between accumulator and directly addressed

register Rx2 2

ANL A,@RiLogical AND between accumulator and indirectly

addressed register1 1

Page 60: Conveyor Belt Robot

ANL A,#X Logical AND between accumulator and number X 2 2

Logical Operations on Bits

Similar to logical instructions, these instructions perform logical operations. The difference is

that these operations are performed on single bits.

Logical operations on bits

Mnemonic Description Byte Number Cycle Number

CLR C Clear Carry bit 1 1

CLR bit Clear directly addressed bit 2 2

SETB C Set Carry bit 1 1

SETB bit Set directly addressed bit 2 2

CPL C Complement Carry bit 1 1

CPL bit Complement directly addressed bit 2 2

TIMERS

On-chip timing/counting facility has proved the capabilities of the microcontroller for

implementing the real time application. These includes pulse counting, frequency measurement,

pulse width measurement, baud rate generation, etc,. Having sufficient number of timer/counters

may be a need in a certain design application. The 8051 has two timers/counters. They can be

Page 61: Conveyor Belt Robot

used either as timers to generate a time delay or as counters to count events happening outside

the microcontroller. Let discuss how these timers are used to generate time delays and we will

also discuss how they are been used as event counters.

PROGRAMMING 8051 TIMERS

The 8051 has timers: Timer 0 and Timer1.they can be used either as timers or as event

counters. Let us first discuss about the timers’ registers and how to program the timers to

generate time delays.

BASIC RIGISTERS OF THE TIMER

Both Timer 0 and Timer 1 are 16 bits wide. Since the 8051 has an 8-bit architecture, each

16-bit timer is accessed as two separate registers of low byte and high byte.

TIMER 0 REGISTERS

The 16-bit register of Timer 0 is accessed as low byte and high byte. the low byte

register is called TL0(Timer 0 low byte)and the high byte register is referred to as TH0(Timer 0

high byte).These register can be accessed like any other register, such as A,B,R0,R1,R2,etc.for

example, the instruction ”MOV TL0, #4F”moves the value 4FH into TL0,the low byte of Timer

0.These registers can also be read like any other register.

Page 62: Conveyor Belt Robot

TIMER 1 REGISTERS

Timer 1 is also 16-bit register is split into two bytes, referred to as TL1 (Timer 1 low

byte) and TH1 (Timer 1 high byte).these registers are accessible n the same way as the register of

Timer 0.

TMOD (timer mode) REGISTER

Both timers TIMER 0 and TIMER 1 use the same register, called TMOD, to set the

various timer operation modes. TMOD is an 8-bit register in which the lower 4 bits are set aside

for Timer 0 and the upper 4 bits for Timer 1.in each case; the lower 2 bits are used to set the

timer mode and the upper 2 bits to specify the operation.

MODES:

Page 63: Conveyor Belt Robot

M1, M0:

M0 and M1 are used to select the timer mode. There are three modes: 0, 1, 2.Mode 0 is

a 13-bit timer, mode 1 is a 16-bit timer, and mode 2 is an 8-bit timer. We will concentrate on

modes 1 and 2 since they are the ones used most widely. We will soon describe the

characteristics of these modes, after describing the reset of the TMOD register.

GATE: Gate control when set. The timer/counter is enabled only

While the INTx pin is high and the TRx control pin is Set. When cleared, the timer is enabled.

C/T: Timer or counter selected cleared for timer operation (Input from internal system clock).set

for counter Operation (input TX input pin).

M 1 Mode bit 1

M0 Mode bit 0

M1 M0 MODE Operating Mode

0 0 0 13-bit timer mode

8-bit timer/counter THx with TLx as

5 - Bit pre-scaler.

0 1 1 16-bit timer mode

16-bit timer/counters THx

with TLx are

Cascaded; there is no prescaler

1 0 2 8-bit auto reload

8-bit auto reload timer/counter;THx Holds a value

that is to be reloaded into TLx each time it overflows.

1 1 3 Split timer mode.

Page 64: Conveyor Belt Robot

C/T (clock/timer)

This bit in the TMOD register is used to decide whether the timer is used as a delay generator

or an event counter. If C/T=0, it is used as a timer for time delay generation. The clock source for

the time delay is the crystal frequency of the 8051.this section is concerned with this choice. The

timer’s use as an event counter is discussed in the next section.

Serial Communication:

Computers can transfer data in two ways: parallel and serial. In parallel data transfers,

often 8 or more lines (wire conductors) are used to transfer data to a device that is only a few feet

away. Examples of parallel data transfer are printers and hard disks; each uses cables with many

wire strips. Although in such cases a lot of data can be transferred in a short amount of time by

using many wires in parallel, the distance cannot be great. To transfer to a device located many

meters away, the serial method is used. In serial communication, the data is sent one bit at a

time, in contrast to parallel communication, in which the data is sent a byte or more at a time.

Serial communication of the 8051 is the topic of this chapter. The 8051 has serial

communication capability built into it, there by making possible fast data transfer using only a

few wires.

If data is to be transferred on the telephone line, it must be converted from 0s and 1s to

audio tones, which are sinusoidal-shaped signals. A peripheral device called a modem, which

stands for “modulator/demodulator”, performs this conversion.

Serial data communication uses two methods, asynchronous and synchronous. The

synchronous method transfers a block of data at a time, while the asynchronous method transfers

a single byte at a time.

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

transmission. This is in contrast to simplex transmissions such as with printers, in which the

computer only sends data. Duplex transmissions can be half or full duplex, depending on

whether or not the data transfer can be simultaneous. If data is transmitted one way at a time, it

is referred to as half duplex. If the data can go both ways at the same time, it is full duplex. Of

Page 65: Conveyor Belt Robot

course, full duplex requires two wire conductors for the data lines, one for transmission and one

for reception, in order to transfer and receive data simultaneously.

Asynchronous serial communication and data framing

The data coming in at the receiving end of the data line in a serial data transfer is all 0s

and 1s; it is difficult to make sense of the data unless the sender and receiver agree on a set of

rules, a protocol, on how the data is packed, how many bits constitute a character, and when the

data begins and ends.

Start and stop bits

Asynchronous serial data communication is widely used for character-oriented

transmissions, while block-oriented data transfers use the synchronous method. In the

asynchronous method, each character is placed between start and stop bits. This is called

framing. In the data framing for asynchronous communications, the data, such as ASCII

characters, are packed between a start bit and a stop bit. The start bit is always one bit, but the

stop bit can be one or two bits. The start bit is always a 0 (low) and the stop bit (s) is 1 (high).

Data transfer rate

The rate of data transfer in serial data communication is stated in bps (bits per second).

Another widely used terminology for bps is baud rate. However, the baud and bps rates are not

necessarily equal. This is due to the fact that baud rate is the modem terminology and is defined

as the number of signal changes per second. In modems a single change of signal, sometimes

transfers several bits of data. As far as the conductor wire is concerned, the baud rate and bps

are the same, and for this reason we use the bps and baud interchangeably.

The data transfer rate of given computer system depends on communication ports

incorporated into that system. For example, the early IBMPC/XT could transfer data at the rate

of 100 to 9600 bps. In recent years, however, Pentium based PCS transfer data at rates as high as

56K bps. It must be noted that in asynchronous serial data communication, the baud rate is

generally limited to 100,000bps.

Page 66: Conveyor Belt Robot

RS232 Standards

To allow compatibility among data communication equipment made by various

manufacturers, an interfacing standard called RS232 was set by the Electronics Industries

Association (EIA) in 1960. In 1963 it was modified and called RS232A. RS232B AND RS232C

were issued in 1965 and 1969, respectively. Today, RS232 is the most widely used serial I/O

interfacing standard. This standard is used in PCs and numerous types of equipment. However,

since the standard was set long before the advert of the TTL logic family, its input and output

voltage levels are not TTL compatible. In RS232, a 1 is represented by -3 to -25V, while a 0 bit

is +3 to +25V, making -3 to +3 undefined. For this reason, to connect any RS232 to a

microcontroller system we must use voltage converters such as MAX232 to convert the TTL

logic levels to the RS232 voltage levels, and vice versa. MAX232 IC chips are commonly

referred to as line drivers.

RS232 pins

RS232 cable, commonly referred to as the DB-25 connector. In labeling, DB-25P refers

to the plug connector (male) and DB-25S is for the socket connector (female). Since not all the

pins are used in PC cables, IBM introduced the DB-9 Version of the serial I/O standard, which

uses 9 pins only, as shown in table.

Page 67: Conveyor Belt Robot

DB-9 PIN CONNECTOR:

DB-9 pin connector

Pin Functions:

Pin Description

1 Data carrier detect (DCD)

2 Received data (RXD)

3 Transmitted data (TXD)

4 Data terminal ready(DTR)

5 Signal ground (GND)

6 Data set ready (DSR)

7 Request to send (RTS)

8 Clear to send (CTS)

9 Ring indicator (RI)

Page 68: Conveyor Belt Robot

Note: DCD, DSR, RTS and CTS are active low pins.

The method used by RS-232 for communication allows for a simple connection of three lines:

Tx, Rx, and Ground. The three essential signals for 2-way RS-232

Communications are these:

TXD: carries data from DTE to the DCE.

RXD: carries data from DCE to the DTE

SG: signal ground

8051 connection to RS232

The RS232 standard is not TTL compatible; therefore, it requires a line driver such as

the MAX232 chip to convert RS232 voltage levels to TTL levels, and vice versa. The

interfacing of 8051 with RS232 connectors via the MAX232 chip is the main topic.

The 8051 has two pins that are used specifically for transferring and receiving

data serially. These two pins are called TXD and RXD and a part of the port 3 group (P3.0 and

P3.1). Pin 11 of the 8051 is assigned to TXD and pin 10 is designated as RXD. These pins are

TTL compatible; therefore, they require a line driver to make them RS232 compatible. One such

line driver is the MAX232 chip.

MAX232 converts from RS232 voltage levels to TTL voltage levels, and vice

versa. One advantage of the MAX232 chip is that it uses a +5V power source which, is the same

as the source voltage for the 8051. In the other words, with a single +5V power supply we can

power both the 8051 and MAX232, with no need for the power supplies that are common in

many older systems. The MAX232 has two sets of line drivers for transferring and receiving

data. The line drivers used for TXD are called T1 and T2, while the line drivers for RXD are

designated as R1 and R2. In many applications only one of each is used.

Page 69: Conveyor Belt Robot

CONNECTING μC to PC using MAX 232

INTERRUPTS

A single microcontroller can serve several devices. There are two ways to do that:

INTERRUPTS or POLLING.

POLLING:

In polling the microcontroller continuously monitors the status of a given device; when

the status condition is met, it performs the service .After that, it moves on to monitor the next

device until each one is serviced. Although polling can monitor the status of several devices and

serve each of them as certain condition are met.

INTERRUPTS:

In the interrupts method, whenever any device needs its service, the device notifies the

microcontroller by sending it an interrupts signal. Upon receiving an interrupt signal, the

microcontroller interrupts whatever it is doing and serves the device. The program associated

with the interrupts is called the interrupt service routine (ISR).or interrupt handler.

Page 70: Conveyor Belt Robot

INTERRUPTS Vs POLLING:

The advantage of interrupts is that the microcontroller can serve many devices (not all the

same time, of course); each device can get the attention of the microcontroller based on the priority

assigned to it. The polling method cannot assign priority since it checks all devices in round-robin

fashion. More importantly, in the interrupt method the microcontroller can also ignore (mask) a

device request for service. This is again not possible with the polling method. The most important

reason that the interrupt method is preferable is that the polling method wastes much of the

microcontroller’s time by polling devices that do not need service. So, in order to avoid tying down

the microcontroller, interrupts are used.

INTERRUPT SERVICE ROUTINE

For every interrupt, there must be an interrupt service routine (ISR), or interrupt

handler. When an interrupt is invoked, the microcontroller runs the interrupts service routine. For

every interrupt, there is a fixed location in memory that holds the address of its ISR. The group

of memory location set aside to hold the addresses of ISR and is called the Interrupt Vector

Table. Shown below:

Interrupt Vector Table for the 8051:

S.No. INTERRUPT ROM LOCATION

(HEX)

PIN FLAG

CLEARING

1. Reset 0000 9 Auto

2. External hardware

Interrupt 0

0003 P3.2 (12) Auto

3. Timers 0 interrupt 000B Auto

Page 71: Conveyor Belt Robot

(TF0)

4. External hardware

Interrupt 1(INT1)

0013 P3.3 (13) Auto

5. Timers 1 interrupt

(TF1)

001B Auto

6. Serial COM (RI

and TI)

0023 Programmer

clears it

Six Interrupts in the 8051:

In reality, only five interrupts are available to the user in the 8051, but many manufacturers’ data

sheets state that there are six interrupts since they include reset .the six interrupts in the 8051 are

allocated as above.

1. Reset. When the reset pin is activated, the 8051 jumps to address location 0000.this is the

power-up reset.

2. Two interrupts are set aside for the timers: one for Timer 0 and one for Timer 1.Memory

location 000BH and 001BH in the interrupt vector table belong to Timer 0 and Timer 1,

respectively.

3. Two interrupts are set aside for hardware external harder interrupts. Pin number 12(P3.2)

and 13(P3.3) in port 3 are for the external hardware interrupts INT0 and

INT1,respectively.These external interrupts are also referred to as EX1 and EX2.Memory

location 0003H and 0013H in the interrupt vector table are assigned to INT0 and INT1,

respectively.

4. Serial communication has a single interrupt that belongs to both receive and transmit. The

interrupt vector table location 0023H belongs to this interrupt.

Notice that a limited number of bytes are set aside for each interrupt. For example, a

total of 8 bytes from location 0003 to 000A is set aside for INT0, external hardware interrupt

Page 72: Conveyor Belt Robot

0.similarly,a total of 8 bytes from location 00BH to 0012H is reserved for TF0, Timer 0

interrupt. If the service routine for a given interrupt is short enough to fit in the memory space

allocated to it, it is placed in the vector table; otherwise, and an LJMP instruction is placed in the

vector table to point to the address of the ISR. In that rest of the bytes allocated to that interrupt

are unused.

From the above table also notice that only three bytes of ROM space are assigned to the

reset pin. they are ROM address location 0,1 and2.address location 3 belongs to external

hardware interrupt 0.for this reason, in our program we put the LJMP as the first instruction and

redirect the processor away from the interrupt vector table, as shown below

Steps in executing an interrupt

Upon activation of an interrupt, the microcontroller goes through the following steps.

1. It finishes the instruction it is executing and saves the address of the next instruction (PC)

on the stack.

2. It also saves the current status of all the interrupts internally (i.e., not on the stack).

3. It jumps to a fixed location in memory called the interrupt vector table that holds the

address of the interrupts service routine.

4. The microcontroller gets the address of the ISR from the interrupt vector table and jumps

to it. It starts to execute the interrupt service subroutine until it reaches the last instruction

of the subroutine, which is RETI (return from interrupt).

5. Upon executing the RETI instruction, the microcontroller returns to the place where it

was interrupted. First, it gets the program counter (PC) address from the stack by popping

the top two bytes of the stack into the PC. Then it starts to execute from that address.

Notice from step 5 the critical role of the stack. For this reason, we must be careful in

manipulating the stack contents in the ISR. Specifically, in the ISR, just as in any CALL

subroutine, the number of pushes and pops must be equal.

Page 73: Conveyor Belt Robot

Enabling and disabling an interrupt:

Upon reset, all interrupt are disabled (masked), meaning that none will be responded to

by the microcontroller if they are activated. The interrupt must be enabled by software in order

for the microcontroller to respond to them. There is a register called IE (interrupt enable) that is

responsible for enabling (unmasking) and disabling (masking) the interrupts.

Notice that IE is a bit-addressable register.

Steps in enabling an interrupt:

To enable an interrupt, we take the following steps:

1. Bit D7 of the IE register (EA) must be set to high to allow the reset to take effect.

If EA=1, interrupts are enabled and will be responded to if their corresponding bit in IE are high.

If EA=0, no interrupt will be responded to, even if the associated bit in the IE register is high.

Interrupt Enable Register

D7 D6 D5 D4 D3 D2 D1 D0

EA -- ET2 ES ET1 EX1 ET0 EX0

Page 74: Conveyor Belt Robot

EA IE.7 disables all interrupts. If EA=0, no interrupts is acknowledged.

If EA=1, each interrupt source is individually enabled disabled

By setting or clearing its enable bit.

-- IE.6 Not implemented, reserved for future use.*

ET2 IE.5 Enables or disables Timer 2 overflow or capture interrupt (8052

Only)

ES IE.4 Enables or disables the serial port interrupts.

ET1 IE.3 Enables or disables Timers 1 overflow interrupt

EX1 IE.2 Enables or disables external interrupt 1.

ET0 IE.1 Enables or disables Timer 0 overflow interrupt.

EX0 IE.0 Enables or disables external interrupt.

Page 75: Conveyor Belt Robot

3.2 POWER SUPPLY

In this system we are using 5V power supply for microcontroller of Transmitter section

as well as receiver section. We use rectifiers for converting the A.C. into D.C and a step down

transformer to step down the voltage. The full description of the Power supply section is given in

this documentation in the following sections i.e. hardware components.

The power supply is designed to convert high voltage AC mains electricity to a suitable

low voltage supply for electronic circuits and other devices. A power supply can by broken down

into a series of blocks, each of which performs a particular function. A d.c power supply which

maintains the output voltage constant irrespective of a.c mains fluctuations or load variations is

known as “Regulated D.C Power Supply”

For example a 5V regulated power supply system as shown below:

Fig : Functional Block Diagram of Power supply

Page 76: Conveyor Belt Robot

3.2.1 TRANSFORMER

A transformer is an electrical device which is used to convert electrical power from one

electrical circuit to another without change in frequency.

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. Step-up transformers increase in output voltage, step-down transformers decrease in

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

high mains voltage to a safer low voltage. The input coil is called the primary and the output

coil is called the secondary. There is no electrical connection between the two coils; instead

they are linked by an alternating magnetic field created in the soft-iron core of the transformer.

The two lines in the middle of the circuit symbol represent the core. Transformers waste very

little power so the power out is (almost) equal to the power in. Note that as voltage is stepped

down current is stepped up. The ratio of the number of turns on each coil, called the turn’s

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.

Fig 23: An Electrical Transformer

Page 77: Conveyor Belt Robot

Turns ratio = Vp/ VS = Np/NS

Power Out= Power In

VSXIS=VPXIP

Vp= primary (input) voltage

Np= number of turns on primary coil

Ip  = primary (input) current    

3.2.2 RECTIFIER

A circuit, which is used to convert a.c to dc, is known as RECTIFIER. The process of

conversion a.c to d.c is called “rectification”

TYPES OF RECTIFIERS:

Half wave Rectifier

Full wave rectifier

1. Center tap full wave rectifier.

2. Bridge type full bridge rectifier.

Page 78: Conveyor Belt Robot

1. Center tap full wave rectifier

In electronics, a center tap is a connection made to a point halfway along a winding of a

transformer or inductor, or along the element of a resistor or a potentiometer. Taps are

sometimes used on inductors for the coupling of signals, and may not necessarily be at the half-

way point, but rather, closer to one end. A common application of this is in the Hartley oscillator.

Inductors with taps also permit the transformation of the amplitude of alternating current (AC)

voltages for the purpose of power conversion, in which case, they are referred to as

autotransformers, since there is only one winding. An example of an autotransformer is an

automobile ignition coil. Potentiometer tapping provides one or more connections along the

device's element, along with the usual connections at each of the two ends of the element, and

the slider connection. Potentiometer taps allow for circuit functions that would otherwise not be

available with the usual construction of just the two end connections and one slider connection.

Page 79: Conveyor Belt Robot

2. Bridge type full bridge rectifier.

Comparison of rectifier circuits:

Parameter

Type of Rectifier

Half wave Full wave

Bridge

Number of

diodes

1

2

3

PIV of diodes

Vm

2Vm

Vm

D.C output

voltage

Vm/

2Vm/

2Vm/

Vdc, at

no-load

0.318Vm

0.636Vm 0.636Vm

Ripple factor

1.21

0.482

0.482

Ripple

frequency

f

2f

2f

Rectification

efficiency

0.406

0.812

0.812

Transformer

Utilization

Factor(TUF)

0.287 0.693 0.812

RMS voltage Vrms Vm/2 Vm/√2 Vm/√2

Full-wave Rectifier:

Page 80: Conveyor Belt Robot

From the above comparisons we came to know that full wave bridge rectifier as more

advantages than the other two rectifiers. So, in our project we are using full wave bridge rectifier

circuit.

Bridge Rectifier:

A bridge rectifier makes use of four diodes in a bridge arrangement to achieve full-wave

rectification. This is a widely used configuration, both with individual diodes wired as shown

and with single component bridges where the diode bridge is wired internally.

A bridge rectifier makes use of four diodes in a bridge arrangement as shown in fig(a) to

achieve full-wave rectification. This is a widely used configuration, both with individual diodes

wired as shown and with single component bridges where the diode bridge is wired internally.

Fig: Bridge rectifier

Operation:

During positive half cycle of secondary, the diodes D2 and D3 are in forward biased

while D1 and D4 are in reverse biased as shown in the fig(b). The current flow direction is

shown in the fig (b) with dotted arrows.

Page 81: Conveyor Belt Robot

During negative half cycle of secondary voltage, the diodes D1 and D4 are in forward

biased while D2 and D3 are in reverse biased as shown in the fig(c). The current flow direction

is shown in the fig (c) with dotted arrows.

3.2.4 FILTER

A Filter is a device, which removes the a.c component of rectifier output but allows the

d.c component to reach the load.

Capacitor Filter:

Page 82: Conveyor Belt Robot

We have seen that the ripple content in the rectified output of half wave rectifier is 121% or

that of full-wave or bridge rectifier or bridge rectifier is 48% such high percentages of ripples is

not acceptable for most of the applications. Ripples can be removed by one of the following

methods of filtering:

(a) A capacitor, in parallel to the load, provides an easier by –pass for the ripples voltage though

it due to low impedance. At ripple frequency and leave the d.c.to appears the load.

(b) An inductor, in series with the load, prevents the passage of the ripple current (due to high

impedance at ripple frequency) while allowing the d.c (due to low resistance to d.c)

(c) various combinations of capacitor and inductor, such as L-section filter section filter,

multiple section filter etc. which make use of both the properties mentioned in (a) and (b) above.

Two cases of capacitor filter, one applied on half wave rectifier and another with full wave

rectifier.

Fig: capacitor filter

Filtering 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 capacitor charges quickly near the peak of the varying DC, and then

discharges as it supplies current to the output. Filtering significantly increases the average DC

voltage to almost the peak value (1.4 × RMS value).

To calculate the value of capacitor(C),

Page 83: Conveyor Belt Robot

C = ¼*√3*f*r*Rl

Where,

f = supply frequency,

r = ripple factor,

Rl = load resistance

Note: In our circuit we are using 1000microfarads.

3.2.4 REGULATOR

Voltage regulator ICs is available with fixed (typically 5, 12 and 15V) or variable

output voltages. The maximum current they can pass also rates them. 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. The LM7805 is simple to use. You simply connect the

positive lead of your unregulated DC power supply (anything from 9VDC to 24VDC) to the

Input pin, connect the negative lead to the Common pin and then when you turn on the power,

you get a 5 volt supply from the output pin.

Fig : A Three Terminal Voltage Regulator

Page 84: Conveyor Belt Robot

78XX:

The Bay Linear LM78XX is integrated linear positive regulator with three terminals. The

LM78XX offer several fixed output voltages making them useful in wide range of applications.

When used as a zener diode/resistor combination replacement, the LM78XX usually results in an

effective output impedance improvement of two orders of magnitude, lower quiescent current.

The LM78XX is available in the TO-252, TO-220 & TO-263packages

Features:

• Output Current of 1.5A

• Output Voltage Tolerance of 5%

• Internal thermal overload protection

• Internal Short-Circuit Limited

• No External Component

• Output Voltage 5.0V, 6V, 8V, 9V, 10V, 12V, 15V, 18V, 24V

• Offer in plastic TO-252, TO-220 & TO-263

• Direct Replacement for LM78XX

Page 85: Conveyor Belt Robot

POTENTIOMETER

Fig: Potentiometer

A potentiometer informally a pot, is a three-terminal resistor with a sliding contact that forms

an adjustable voltage divider. If only two terminals are used, one end and the wiper, it acts as a

variable resistor or rheostat.

Page 86: Conveyor Belt Robot

A potentiometer measuring instrument is essentially a voltage divider used for measuring electric

potential (voltage); the component is an implementation of the same principle, hence its name.

Potentiometers are commonly used to control electrical devices such as volume controls on audio

equipment. Potentiometers operated by a mechanism can be used as position transducers, for

example, in a joystick. Potentiometers are rarely used to directly control significant power (more

than a watt), since the power dissipated in the potentiometer would be comparable to the power

in the controlled load.

TRANSISTOR:

Assorted discrete transistors. Packages in order from top to bottom: TO-3, TO-126, TO-92, SOT-

23

A transistor is a semiconductor device used to amplify and switch electronic signals and

electrical power. It is composed of semiconductor material with at least three terminals for

connection to an external circuit. A voltage or current applied to one pair of the transistor's

Page 87: Conveyor Belt Robot

terminals changes the current flowing through another pair of terminals. Because the controlled

(output) power can be higher than the controlling (input) power, a transistor can amplify a signal.

Today, some transistors are packaged individually, but many more are found embedded in

integrated circuits.

The transistor is the fundamental building block of modern electronic devices, and is ubiquitous

in modern electronic systems. Following its development in the early 1950s the transistor

revolutionized the field of electronics, and paved the way for smaller and cheaper radios,

calculators, and computers, among other things.

RESISTOR:

Axial-lead resistors on tape. The tape is removed during assembly before the leads are formed

and the part is inserted into the board. In automated assembly the leads are cut and formed.

A typical axial-lead resistor

Page 88: Conveyor Belt Robot

A resistor is a passive two-terminal electrical component that implements electrical resistance

as a circuit element.

The current through a resistor is in direct proportion to the voltage across the resistor's

terminals. This relationship is represented by Ohm's law:

where I is the current through the conductor in units of amperes, V is the potential difference

measured across the conductor in units of volts, and R is the resistance of the conductor in units

of ohms.The ratio of the voltage applied across a resistor's terminals to the intensity of current in

the circuit is called its resistance, and this can be assumed to be a constant (independent of the

voltage) for ordinary resistors working within their ratings.

Resistors are common elements of electrical networks and electronic circuits and are ubiquitous

in electronic equipment. Practical resistors can be made of various compounds and films, as well

as resistance wire (wire made of a high-resistivity alloy, such as nickel-chrome). Resistors are

also implemented within integrated circuits, particularly analog devices, and can also be

integrated into hybrid and printed circuits.

The electrical functionality of a resistor is specified by its resistance: common commercial

resistors are manufactured over a range of more than nine orders of magnitude. When specifying

that resistance in an electronic design, the required precision of the resistance may require

attention to the manufacturing tolerance of the chosen resistor, according to its specific

application. The temperature coefficient of the resistance may also be of concern in some

precision applications. Practical resistors are also specified as having a maximum power rating

which must exceed the anticipated power dissipation of that resistor in a particular circuit: this is

mainly of concern in power electronics applications. Resistors with higher power ratings are

physically larger and may require heat sinks. In a high-voltage circuit, attention must sometimes be

paid to the rated maximum working voltage of the resistor.

Page 89: Conveyor Belt Robot

CAPACITOR:

This article is about the electronic component. For the physical phenomenon, see capacitance.

For an overview of various kinds of capacitors, see types of capacitor.

A typical electrolytic capacitor

A capacitor (originally known as condenser) is a

passive two-terminal electrical component used to store energy in an electric field. The forms of

practical capacitors vary widely, but all contain at least two electrical conductors separated by a

dielectric (insulator); for example, one common construction consists of metal foils separated by

a thin layer of insulating film. Capacitors are widely used as parts of electrical circuits in many

common electrical devices.

When there is a potential difference (voltage) across the conductors, a static electric field

develops across the dielectric, causing positive charge to collect on one plate and negative charge

on the other plate. Energy is stored in the electrostatic field. An ideal capacitor is characterized

by a single constant value, capacitance, measured in farads. This is the ratio of the electric

charge on each conductor to the potential difference between them.

Miniature low-voltage capacitors, by a

cm ruler

Page 90: Conveyor Belt Robot

The capacitance is greatest when there is a narrow separation between large areas of conductor,

hence capacitor conductors are often called plates, referring to an early means of construction. In

practice, the dielectric between the plates passes a small amount of leakage current and also has

an electric field strength limit, resulting in a breakdown voltage, while the conductors and leads

introduce an undesired inductance and resistance.

Capacitors are widely used in electronic circuits for blocking direct current while allowing

alternating current to pass, in filter networks, for smoothing the output of power supplies, in the

resonant circuits that tune radios to particular frequencies, in electric power transmission

systems for stabilizing voltage and power flow, and for many other purposes

.

3.1 MAX232

The data which we are entering in to the hyper terminal editor is available at the COM1

port. Then the data enters in to the MAX232 voltage converter via the RS232 cable. The

MAX232 converts the voltage levels of the RS232 to the TTL level and then sends to the UART

of the microcontroller. So the main duty of the max232 is for the voltage conversions.

The MAX232 from Maxim was the first IC which in one package contains the necessary

drivers (two) and receivers (also two), to adapt the RS-232 signal voltage levels to TTL logic. It

became popular, because it just needs one voltage (+5V) and generates the necessary RS-232

Page 91: Conveyor Belt Robot

voltage levels (approx. -10V and +10V) internally. This greatly simplified the design of circuitry.

Circuitry designers no longer need to design and build a power supply with three voltages (e.g. -

12V, +5V, and +12V), but could just provide one +5V power supply, e.g. with the help of a

simple 78x05 voltage converter.

The MAX232 has a successor, the MAX232A. The ICs are almost identical, however, the

MAX232A is much more often used (and easier to get) than the original MAX232, and the

MAX232A only needs external capacitors 1/10th the capacity of what the original MAX232

needs.

It should be noted that the MAX 232(A) is just a driver/receiver. It does not generate the

necessary RS-232 sequence of marks and spaces with the right timing, it does not decode the RS-

232 signal, it does not provide a serial/parallel conversion. All it does is to convert signal

voltage levels. Generating serial data with the right timing and decoding serial data has to be

done by additional circuitry, e.g. by a 16550 UART or one of these small micro controllers (e.g.

Atmel AVR, Microchip PIC) getting more and more popular.

The MAX232 and MAX232A were once rather expensive ICs, but today they are cheap.

It has also helped that many companies now produce clones (ie. Sipex). These clones sometimes

need different external circuitry, e.g. the capacities of the external capacitors vary. It is

recommended to check the data sheet of the particular manufacturer of an IC instead of relying

on Maxim's original data sheet.

The original manufacturer (and now some clone manufacturers, too) offers a large series

of similar ICs, with different numbers of receivers and drivers, voltages, built-in or external

capacitors, etc. E.g. The MAX232 and MAX232A need external capacitors for the internal

voltage pump, while the MAX233 has these capacitors built-in. The MAX233 is also between

three and ten times more expensive in electronic shops than the MAX232A because of its

internal capacitors. It is also more difficult to get the MAX233 than the garden variety

MAX232A.

Page 92: Conveyor Belt Robot

A Typical Application

The MAX 232(A) has two receivers (converts from RS-232 to TTL voltage levels) and two

drivers (converts from TTL logic to RS-232 voltage levels). This means only two of the RS-232

signals can be converted in each direction. The old MC1488/1498 combo provided four drivers

and receivers.

Typically a pair of a driver/receiver of the MAX232 is used for

TX and RX

And the second one for

CTS and RTS.

There are not enough drivers/receivers in the MAX232 to also connect the DTR, DSR, and

DCD signals. Usually these signals can be omitted when e.g. communicating with a PC's serial

interface. If the DTE really requires these signals either a second MAX232 is needed, or some

other IC from the MAX232 family can be used (if it can be found in consumer electronic shops

at all). An alternative for DTR/DSR is also given below.

Maxim's data sheet explains the MAX232 family in great detail, including the pin

configuration and how to connect such an IC to external circuitry. This information can be used

as-is in own design to get a working RS-232 interface. Maxim's data just misses one critical

piece of information: How exactly to connect the RS-232 signals to the IC. So here is one

possible example:

MAX232 to RS232 DB9 Connection as a DCE

MAX232 Pin Nbr. MAX232 Pin Name Signal Voltage DB9 Pin

7 T2out CTS RS-232 7

8 R2in RTS RS-232 8

Page 93: Conveyor Belt Robot

9 R2out RTS TTL n/a

10 T2in CTS TTL n/a

11 T1in TX TTL n/a

12 R1out RX TTL n/a

13 R1in TX RS-232 3

14 T1out RX RS-232 2

15 GND GND 0 5

In addition one can directly wire DTR (DB9 pin 4) to DSR (DB9 pin 6) without going through

any circuitry. This gives automatic (brain dead) DSR acknowledgment of an incoming DTR

signal.

Sometimes pin 6 of the MAX232 is hard wired to DCD (DB9 pin 1). This is not

recommended. Pin 6 is the raw output of the voltage pump and inverter for the -10V voltage.

Drawing currents from the pin leads to a rapid breakdown of the voltage, and as a consequence

to a breakdown of the output voltage of the two RS-232 drivers. It is better to use software which

doesn't care about DCD, but does hardware-handshaking via CTS/RTS only.

The circuitry is completed by connecting five capacitors to the IC as it follows. The

MAX232 needs 1.0µF capacitors, the MAX232A needs 0.1µF capacitors. MAX232 clones show

similar differences. It is recommended to consult the corresponding data sheet. At least 16V

capacitor types should be used. If electrolytic or tantalic capacitors are used, the polarity has to

Page 94: Conveyor Belt Robot

be observed. The first pin as listed in the following table is always where the plus pole of the

capacitor should be connected to.

MAX232(A) external Capacitors

Capacitor + Pin - Pin Remark

C1 1 3

C2 4 5

C3 2 16

C4 GND 6This looks non-intuitive, but because pin 6 is

on -10V, GND gets the + connector, and not the -

C5 16 GND

The 5V power supply is connected to

+5V: Pin 16

GND:

FEATURES

Meet or Exceed TIA/EIA-232-F and ITU

Recommendation V.28

Page 95: Conveyor Belt Robot

Operate With Single 5-V Power Supply

Operate Up to 120 Kbit/s

Two Drivers and Two Receivers

30-V Input Levels

Low Supply Current . . . 8 mA Typical

Designed to be Interchangeable With

Maxim MAX232

ESD Protection Exceeds JESD 22

2000-V Human-Body Model (A114-A)

APPLICATIONS

TIA/EIA-232-F

Battery-Powered Systems

Terminals

Modems

Computers

Description/ordering information

The MAX232 is a dual driver/receiver that includes a capacitive voltage generator to

supply EIA-232 voltage levels from a single 5-V supply. Each receiver converts EIA-232 inputs

to 5-V TTL/CMOS levels. These receivers have a typical threshold of 1.3 V and a typical 30-V

inputs. Each driver converts TTL/CMOShysteresis of 0.5 V, and can accept input levels into

Page 96: Conveyor Belt Robot

EIA-232 levels. The driver, receiver, and voltage-generator library.functions are available as

cells in the Texas Instruments Lin ASIC

Page 97: Conveyor Belt Robot
Page 98: Conveyor Belt Robot

GEAR MOTOR

Gear motors are complete motive force systems consisting of an electric motor and a

reduction gear train integrated into one easy-to-mount and -configure package. This greatly

reduces the complexity and cost of designing and constructing power tools, machines and

appliances calling for high torque at relatively low shaft speed or RPM. Gear motors allow the

use of economical low-horsepower motors to provide great motive force at low speed such as in

lifts, winches, medical tables, jacks and robotics. They can be large enough to lift a building or

smallenoughtodriveatinyclock.

Operation Principle

Most synchronous AC electric motors have output ranges of from 1,200 to 3,600 revolutions per

minute. They also have both normal speed and stall-speed torque specifications. The reduction

gear trains used in gear motors are designed to reduce the output speed while increasing the

torque. The increase in torque is inversely proportional to the reduction in speed. Reduction

gearing allows small electric motors to move large driven loads, although more slowly than

larger electric motors. Reduction gears consist of a small gear driving a larger gear. There may

be several sets of these reduction gear sets in a reduction gear box.

Speed Reduction

Sometimes the goal of using a gear motor is to reduce the rotating shaft speed of a motor in the

device being driven, such as in a small electric clock where the tiny synchronous motor may be

spinning at 1,200 rpm but is reduced to one rpm to drive the second hand, and further reduced in

the clock mechanism to drive the minute and hour hands. Here the amount of driving force is

irrelevant as long as it is sufficient to overcome the frictional effects of the clock mechanism.

Page 99: Conveyor Belt Robot

Torque Multiplication

Another goal achievable with a gear motor is to use a small motor to generate a very large force

albeit at a low speed. These applications include the lifting mechanisms on hospital beds, power

recliners, and heavy machine lifts where the great force at low speed is the goal.

Motor Varieties

Most industrial gear motors are AC-powered, fixed-speed devices, although there are fixed-gear-

ratio, variable-speed motors that provide a greater degree of control. DC gear motors are used

primarily in automotive applications such as power winches on trucks, windshield wiper motors

and power seat or power window motors.

Many Applications

What power can openers, garage door openers, stair lifts, rotisserie motors, timer cycle knobs on

washing machines, power drills, cake mixers and electromechanical clocks have in common is

that they all use various integrations of gear motors to derive a large force from a relatively small

electric motor at a manageable speed. In industry, gear motor applications in jacks, cranes, lifts,

clamping, robotics, conveyance and mixing are too numerous to count.

VIEW OF A GEAR MOTOR

Page 100: Conveyor Belt Robot

GEAR MOTOR DRIVER

In this Project, We use L293D as a GEAR MOTOR DRIVER

INTRODUCTION

The L293D is a quadruple half H-bridge bidirectional motor driver IC that can drive current of

up to 600mA with voltage range of 4.5 to 36 volts. It is suitable to drive small DC-Geared

motors, bipolar stepper motor etc.

L293D is a 16 pin chip and is a popular motor driver which can be used for small motors that

have low output current.

SPECIFICATIONS

Supply Voltage Range 4.5V to 36V

600-mA Output current capability per driver

Separate Input-logic supply

It can drive small DC-geared motors, bipolar stepper motor.

Pulsed Current 1.2-A Per Driver

Thermal Shutdown

Internal ESD Protection

High-Noise-Immunity Inputs

APPLICATIONS

DC and stepper motor drives

Page 101: Conveyor Belt Robot

Position and velocity servomechanisms

L293D Pin diagram and functions.

The pin out of L293D is as shown below.

This IC is basically a Motor driver. It consists of four inputs, four outputs, four grounds

and two enables for each motors. We can drive two motors using single L293D chip. 

The below is the Truth table or the function table of the L293D motor driver.

Pin 1Pin 2 Pin 7 Function

High Low High Turn clockwise

High High Low Turn anti-clockwise

Page 102: Conveyor Belt Robot

High Low Low Stop

High High High Stop

Low Not applicableNot applicableStop

4. SOFTWARE TOOLS& INTIGRATION

ABOUT SOFTWARE

Software’s used are:

*Keil software for c programming

*Express PCB for lay out design

*Express SCH for schematic design

What's New in µVision3?

µVision3 adds many new features to the Editor like Text Templates, Quick Function

Navigation, and Syntax Coloring with brace high lighting Configuration Wizard for dialog based

startup and debugger setup. µVision3 is fully compatible to µVision2 and can be used in parallel

with µVision2.

What is µVision3?

µVision3 is an IDE (Integrated Development Environment) that helps you write, compile,

and debug embedded programs. It encapsulates the following components:

A project manager.

A make facility.

Tool configuration.

Page 103: Conveyor Belt Robot

Editor.

A powerful debugger.

To help you get started, several example programs (located in the \C51\Examples, \C251\

Examples, \C166\Examples, and \ARM\...\Examples) are provided.

o HELLO is a simple program that prints the string "Hello World" using the Serial

Interface.

o MEASURE is a data acquisition system for analog and digital systems.

o TRAFFIC is a traffic light controller with the RTX Tiny operating system.

o SIEVE is the SIEVE Benchmark.

o DHRY is the Dhrystone Benchmark.

o WHETS is the Single-Precision Whetstone Benchmark.

Additional example programs not listed here are provided for each device architecture.

Building an Application in µVision2

To build (compile, assemble, and link) an application in µVision2, you must:

1. Select Project -(forexample,166\EXAMPLES\HELLO\HELLO.UV2).

2. Select Project - Rebuild all target files or Build target.

µVision2 compiles, assembles, and links the files in your project.

Creating Your Own Application in µVision2

To create a new project in µVision2, you must:

1. Select Project - New Project.

Page 104: Conveyor Belt Robot

2. Select a directory and enter the name of the project file.

3. Select Project - Select Device and select an 8051, 251, or C16x/ST10 device from the

Device Database™.

4. Create source files to add to the project.

5. Select Project - Targets, Groups, Files. Add/Files, select Source Group1, and add the

source files to the project.

6. Select Project - Options and set the tool options. Note when you select the target device

from the Device Database™ all special options are set automatically. You typically only

need to configure the memory map of your target hardware. Default memory model

settings are optimal for most applications.

7. Select Project - Rebuild all target files or Build target.

Debugging an Application in µVision2

To debug an application created using µVision2, you must:

1. Select Debug - Start/Stop Debug Session.

2. Use the Step toolbar buttons to single-step through your program. You may enter G,

main in the Output Window to execute to the main C function.

3. Open the Serial Window using the Serial #1 button on the toolbar.

Debug your program using standard options like Step, Go, Break, and so on.

Starting µVision2 and Creating a Project

µVision2 is a standard Windows application and started by clicking on the program icon.

To create a new project file select from the µVision2 menu.

Project – New Project…. This opens a standard Windows dialog that asks you

Page 105: Conveyor Belt Robot

for the new project file name.

We suggest that you use a separate folder for each project. You can simply use the icon

Create New Folder in this dialog to get a new empty folder. Then select this folder and enter the

file name for the new project, i.e. Project1. µVision2 creates a new project file with the name

PROJECT1.UV2 which contains a default target and file group name. You can see these names

in the Project.

Window – Files.

Now use from the menu Project – Select Device for Target and select a CPU for your project.

The Select Device dialog box shows the µVision2 device database. Just select the micro

controller you use. We are using for our examples the Philips 80C51RD+ CPU. This selection

sets necessary tool options for the 80C51RD+ device and simplifies in this way the tool

Configuration.

Building Projects and Creating a HEX Files

Typical, the tool settings under Options – Target are all you need to start a new application. You

may translate all source files and line the application with a click on the Build Target toolbar

icon. When you build an application with syntax errors, µVision2 will display errors and

warning messages in the Output Window – Build page. A double click on a message line opens

the source file on the correct location in a µVision2 editor window. Once you have successfully

generated your application you can start debugging.

After you have tested your application, it is required to create an Intel HEX file to

download the software into an EPROM programmer or simulator. µVision2 creates HEX files

with each build process when Create HEX files under Options for Target – Output is enabled.

Page 106: Conveyor Belt Robot

You may start your PROM programming utility after the make process when you specify the

program under the option Run User Program #1.

CPU Simulation

µVision2 simulates up to 16 Mbytes of memory from which areas can be mapped for

read, write, or code execution access. The µVision2 simulator traps and reports illegal memory

access.

In addition to memory mapping, the simulator also provides support for the integrated

peripherals of the various 8051 derivatives. The on-chip peripherals of the CPU you have

selected are configured from the Device.

Database selection

you have made when you create your project target. Refer to page 58 for more

Information about selecting a device. You may select and display the on-chip peripheral

components using the Debug menu. You can also change the aspects of each peripheral using the

controls in the dialog boxes.

Start Debugging

You start the debug mode of µVision2 with the Debug – Start/Stop Debug Session command.

Depending on the Options for Target – Debug Configuration, µVision2 will load the application

program and run the startup code µVision2 saves the editor screen layout and restores the screen

layout of the last debug session. If the program execution stops, µVision2 opens an editor

window with the source text or shows CPU instructions in the disassembly window. The next

executable statement is marked with a yellow arrow. During debugging, most editor features are

still available.

Page 107: Conveyor Belt Robot

For example, you can use the find command or correct program errors. Program source text of

your application is shown in the same windows. The µVision2 debug mode differs from the edit

mode in the following aspects:

The “Debug Menu and Debug Commands” described on page 28 are Available. The

additional debug windows are discussed in the following.

The project structure or tool parameters cannot be modified. All build Commands are

disabled.

Disassembly Window

The Disassembly window shows your target program as mixed source and assembly program or

just assembly code. A trace history of previously executed instructions may be displayed with

Debug – View Trace Records. To enable the trace history, set Debug – Enable/Disable Trace

Recording.

If you select the Disassembly Window as the active window all program step commands work

on CPU instruction level rather than program source lines. You can select a text line and set or

modify code breakpoints using toolbar buttons or the context menu commands.

You may use the dialog Debug – Inline Assembly… to modify the CPU instructions.

That allows you to correct mistakes or to make temporary changes to the target program you are

debugging.

Steps for executing the Keil programs:

1. Click on the Keil uVision Icon on Desktop

2. The following fig will appear

Page 108: Conveyor Belt Robot

3. Click on the Project menu from the title bar

4. Then Click on New Project

Page 109: Conveyor Belt Robot

5. Save the Project by typing suitable project name with no extension in u r own folder

sited in either C:\ or D:\

6. Then Click on Save button above.

7. Select the component for u r project. i.e. Atmel……

8. Click on the + Symbol beside of Atmel.

Page 110: Conveyor Belt Robot

9. Select AT89C51 as shown below

10. Then Click on “OK”

11. The Following fig will appear

Page 111: Conveyor Belt Robot

12. Then Click either YES or NO………mostly “NO”

13. Now your project is ready to USE

14. Now double click on the Target1, you would get another option “Source group 1” as

shown in next page.

Page 112: Conveyor Belt Robot

15. Click on the file option from menu bar and select “new”

16. The next screen will be as shown in next page, and just maximize it by double

clicking on its blue boarder.

Page 113: Conveyor Belt Robot

17. Now start writing program in either in “C” or “ASM”

18. For a program written in Assembly, then save it with extension “. asm” and for “C”

based program save it with extension “ .C”

19. Now right click on Source group 1 and click on “Add files to Group Source”

Page 114: Conveyor Belt Robot

20. Now you will get another window, on which by default “C” files will appear.

21. Now select as per your file extension given while saving the file

22. Click only one time on option “ADD”

23. Now Press function key F7 to compile. Any error will appear if so happen.

Page 115: Conveyor Belt Robot

24. If the file contains no error, then press Control+F5 simultaneously.

25. The new window is as follows

26. Then Click “OK”

27. Now Click on the Peripherals from menu bar, and check your required port as shown in fig

below

Page 116: Conveyor Belt Robot

28. Drag the port a side and click in the program file.

29. Now keep Pressing function key “F11” slowly and observe.

30. You are running your program successfully

Page 117: Conveyor Belt Robot

Express PCB

Express PCB is a Circuit Design Software and PCB manufacturing service. One can learn

almost everything you need to know about Express PCB from the help topics included with the

programs given.

Details:

Express PCB, Version 5.6.0

5. CONCLUSION

The project DESIGNING AND CONSTRUCTION OF MOVABLE ROBOTIC has been

successfully designed and tested.

Integrating features of all the hardware components used have developed it. Presence of

every module has been reasoned out and placed carefully thus contributing to the best working of

the unit.

Secondly, using highly advanced IC’s and with the help of growing technology

the project has been successfully implemented.

Page 118: Conveyor Belt Robot

6. BIBLIOGRAPHY

The 8051 Micro controller and Embedded Systems

-Muhammad Ali Mazidi

Janice Gillispie Mazidi

The 8051 Micro controller Architecture,

Programming & Applications

-Kenneth J.Ayala

Fundamentals of Micro processors and Micro computers

-B.Ram

Micro processor Architecture, Programming

Page 119: Conveyor Belt Robot

& Applications

-Ramesh S.Gaonkar

Electronic Components

-D.V.Prasad

Wireless Communications

- Theodore S. Rappaport

Mobile Tele Communications

- William C.Y. Lee

REFERENCES ON THE WEB:

www.national.com

www.atmel.com

www.microsoftsearch.com

www.geocities.com

http://tycho.usno.navy.mil/gpscurr.html

Page 120: Conveyor Belt Robot