You are on page 1of 39

TWO MONTHS INDUSTRIAL TRAINING REPORT

Submitted for partial fulfillment of award of

BACHELOR OF ELECTRONICS & COMMUNICATION ENGINEERING in

YADWINDRA COLLEGE OF ENGINEERING (T. SABO) BATHINDA

Submitted by:
INDU BALA Roll No. 20902011 2ND Year ECE

CONTENTS 1) PCB Designing Functions of PCB Classifications of PCBs Technique used for PCB design PCB design software

2) OrCad design environment PCB design steps in OrCad i. Entry to schematic ii. Creating Netlist Placement of Layout Plus Setting board parameters Creating board outline Placement of components Conductor routing Design rule check Post processing

3) Embedded Systems
2

What is Embedded System Applications Difference between microprocessor & micro controller Types of microcontroller Architectures Difference between CISC & RISC History of 8051 8051 core architecture Pin description of 8051 Connectors used Advantage of Embedded C over Assembly language programming Interfacing o LCD interfacing o Relay Interfacing

6) Project Details (velocity measurement)

7) Components used and working

8) Design of project

9) Programming using c language

10) Biblography

PCB DESIGNING PCB stands for PRINTED CIRCUIT BOARD. Printed circuit board (PCB) provides both the physical structure for mounting and holding the components as well as the electrical interconnection between the components. That means a PCB = PWB (printed wiring board) is the platform upon which electronic components such as integrated circuit chips and other components are mounted. A PCB consists of a non-conducting substrate (typically fiber glass with epoxy as resin) upon which the conductive pattern or circuitry is formed. Copper is the most prevalent conductor although nickel, silver and tin are also used in some cases. Types of PCB PCB may be of different types:1) Single-sided 2) Double-sided 3) Multilayer

Single sided PCBs: - As the name suggest in these designs the conductive pattern is only at in one side. And also the size is large in these case but these are cheap.

Double sided PCBs: - These are the PCBs on which the conductive pattern is in on both sides. The size of board is small in this case but it is costlier than that of above.

Multilayer PCBs: - In this case the board consists of alternating layers of conducting pattern and insulating material. The conductive material is connected across the layers through plated through holes. The size of this PCB is smaller than that of double sided PCB but it is very costly.

FUNCTIONS OF PCB Printed circuited boards are dielectric substrates with metallic circuitry formed on that. They are some times referred to as the base line in electronic packaging. Electronic packaging is fundamentally an inter connection technology and the PCB is the baseline building block of this technology.

TECHNIQUES USED FOR PCB DESIGNING There mainly two techniques which are use for the PCB designs. 1. Hand Taping 2. Computer Aided Design

1) PCBs using Hand Taping: o PCB design using hand taping is the process of technical drawing. o In hand taping method layout should be prepared on grid paper. o In hand taping, components pads can be prepared by using black pads. o Routing of the board can be done by tapes with different widths. Each layer (top, bottom) has to prepare separately.

DISADVANTAGS OF HAND-TAPING FOR PCB DESINING:

o Each layer has to be designed separately. o We cannot generate NCD files for CNC drilling. o Difficult to modify the design in the designing process or after designing. o Difficult to get good design overview. 2) PCB DESIGNING USING CAD All the above difficulties can be removed by using CAB system. CAD system for PCB designing requires following: o A computer system.
5

o PCB design software like OrCad, CADSTAR, Protel, TANGO, Mentor etc. The main advantages are given below:Auto placement o Auto routing o After routing, optimization of tracks can be done. o Provides physical design reuse modules o Electrical rule check (ERC) o All the layers are generated from the same design by giving different options. o Bill of material can be generated which contains number of different components used. o We can draw conductors as an arc, semi-circular at different angles. o Design Rule Check o Advanced CAD systems have high speed analysis. o CAD system provides all NCD files and Gerber data files for photo plotting.

TRADITIONAL DESIGN FLOW IN CAD- SYSTEM

Capture

Gerber tools

Gerber and plotter drawing

Libraries Layout Footprint libraries

Gerber and drill files

Overview of a PCB Design Software

OrCad Design Environment OrCad has a long history of providing individuals and teams with a complete set of technologies that offer unprecedented productivity, seamless tool integration, and exceptional value. New 10.5 release continues that tradition. Today's lower cost and yet highly sophisticated electronic design automation systems have created a unique challenge to nearly every engineering department. Therefore the use of EDA tools has become increasingly important as product lifecycles have become shorter and shorter. Modern electronic design automation (EDA) tools are beginning to support a more efficient and integrated approach to electronic.OrCad Capture design entry is the most widely used schematic entry system in electronic design today for one simple reason: fast and universal design entry. Whether you're designing a new analog circuit, revising schematic diagram for an existing PCB, or designing a digital block diagram with an HDL module, OrCad Capture provides simple schematic commands you need to enter, modify and verify the design for PCB. OrCad Layout offers PCB designers and PCB design teams the power and flexibility to create and share PCB data and constraints across the design flow.

Once the Cadence splash screen passes, go to the File Menu, and select New, Project.

The following Dialogue Box will present itself.

After

some

processing, you will be presented with your projects hierarchy

Traverse the hierarchy as shown below, to access the schematic.

Double-click on PAGE1 to access the schematic The following window should look somewhat familiar.

Now from right side choose the tools and place them from place parts according to the design as shown under . To join the components choose place wire and join them using wires.
9

As shown design of power supply:-

The Part editor: The part editor is used to create and edit parts. From the view menu of the part editor you can choose either part or package. In part view one can: Create and edit parts and symbols, then store in new or existing libraries. Create and edit power and ground symbols, off-page connector symbols, and title block Use the tool palettes electrical tools to place pins on parts, and its drawing tools to draw parts and symbols.

The Session Log:

10

The session log lists the events that have occurred during the current Capture session, includes message resulting from using captures tools. To display contextsensitive help for an error message, put the cursor in the error message line in the session log press F1. The ruler along the top appears in either inches or mill meters, depending on which measurement system is selected in the window panel. Your tab setting are saved and used each time you start capture.

The Tool Palette: Capture has two tool palettes: one for the schematic page editor and one for the part editor. Both tool palettes are dock able and resizable. They can also display tool tips that identify each tool. The drawing tools on the two tool palettes are identical, however, each tool palette has different electrical tools after you choose a tool, and you press the right mouse button to display a context- sensitive pop-up menu. 1:- The schematic page editor tool palette:

11

The first group of tools on the tool palette is electrical tools, used to place electrical connectivity objects. The second group of tools is Drawing tools, used to create graphical objects without electrical connectivity.

2:-Selecting and deselecting of objects Once one selects an object, one can perform operations on it, include moving, copying, cutting, mirroring, rotating, resizing, or editing. One can also select multiple, objects and edit them, or group them in to a single object. Grouping objects maintain relation ship among them while one moves them to another location.

Creating Net list File Net-list file is a document file which contains information about the logical interconnections between signals and pins. Before one create a net list file, be sure ones project is completed, annotated and it is free from electrical rule violations. A net list file consists of nets, components, connectors, junctions, no connection symbol, power and ground symbols.

Creation of net list in capture: Select your design in the project manager. From the tools, choose create net list. The net list dialog box displays. Choose a net list format tab.
12

If necessary, set the part value and PCB foot print combined property strings to reflect the information you want in the net list. Click ok to create the net list. In the net list file text box, enter a name for the output file. If the selected format creates an additional file, enter its file name in the second text box.

PLACEMENT OF LAYOUT PLUS What is Layout Plus? Layout plus is one part for the PCB design in which we place as well as route the components an set unit of measurement, grids, and spacing in OrCad. Within other soft wares you also have to place and route the components in similar way. For the placement and routing of the components we normally use auto-placement and auto-routing. Unfortunately, in a lot of soft wares some critical signals have to be routed manually before auto-routing. In layout plus we also define the layer stacks, pad stacks and via's.

Steps for board design: At first, we have created a net list from our schematic diagram by using capture. Layout plus includes design rules in order to guide logical placement and routing. That means, load the net list into layout to create the board. At the same time you have to specify the board parameters. Specify board parameters: Specifying global setting for the board, including nits of measurements, grid, and spacing Place components: Use the components tool in order to place manually the components which are fixed by the system designer on the board or otherwise use auto-placement.

13

Route the board: Use different routing technologies to route the board and take advantage of push and shove (a routing technology), which moves track you are currently routing as well as you can also auto route the board. Provide finishing of the board: Layout supplies an ordered progression of commands on the auto menu for finishing your design. These commands include design rule check, cleanup design, rename components, back annotate, run post processor, and create reports.

The design window: The design window provides a graphical display of printed circuit board, it is primary window you use when designing your board. It also provides tools to facilitate the design process such as to update components and design rule violation.

14

Main window Method to create a board with Layout Plus: Ensure that net list with all footprints and necessary information has been created. Create a directory in which the schematic design, net list, and boar will co-exit and put the schematic design and net list. OrCad provides a directory for this purpose. From the layout session frames file menu, choose New. The load template file in the dialog box displayed.

15

Design window Select the technology template (.TCH), then choose the open button and load the net list in other box. Then apply the auto ECO. If necessary, respond to link footprints to component dialog. Draw the board outline by using the obstacle tool in the tool bar.

Setting board parameters: There is some parameter which should be set before placing the components on board. They are as follows:Set Datum Create a board outline Set units of measurements Set system grid Add mount holes Creating of board outline: Board outline is the graphical representation of the size of the actual PCB board. So it is the main step in layout, to draw the board outline of the actual size of PCB board. Placement of components: Placement of components means that to place the components in designed box. A designer should follow the following steps before going for it: Optimize the board for component placement. Load the placement strategy file. Place components on the board. Optimize placement using various placements

16

Choose the components tool bar button. From the pop up men, choose the queue for placement. The components selection criteria dialog box appears. Enter the reference designator of the components that you want to place in the appropriate text box, and click ok. Drag the components to desired location, place it there. Design Rule Check:In manual designs every thing was checked as a possible source of error. Components sizes, hole sizes, conductor widths and clearance, land-to-hole-ratio, board areas to be free of components, clearance to the edges, positional accuracy and of course electrical interconnections had tad to be personally reviewed with a great deal of care. After completing the design of printed circuit board with the help of an EDA-Tool, a designer has again to verify the PCB in order to find out errors. Such type of verifications/design rule check contains beside the general verifications commonly two types: Physical verification Electrical verification Post processing:Post processing can be done once the design is completed in all aspects. The common way is still a process to generate GERBER data and NCD files which can be used for photo plotting and for steps of CNC manufacturing and PCB- drilling. These are the regulators which are able to produce positive and negative voltage. S. no. 1 2 3 4 Name of regulator LM 7805 LM 7810 LM7912 LM7915 Output voltage 5v 10v -12v -15v

17

Features: 1) Output voltage adjustable from 1.2V to 37V 2) 1.5A output current guaranteed, 55C to +150C 3) Line regulation typically 0.01%/V 4) Load regulation typically 0.3% 5) Excellent thermal regulation, 0.002%/W 6) 77 dB ripple rejection

These two Ic's i.e. LM337and LM317are mainly used in the regulated power supplies because using these regulator a wide range of output can be obtain which can be varied from 0v to 30v, which is much sufficient to drive any electronic circuit.

18

EMBEDDED SYSTEM

What is Embedded System? Embedded system employs a combination of software & hardware to perform a specific function i.e. which is capable of taking decision on the behalf of users desire. It is a part of a larger system which may not be a computerWorks in a reactive & time constrained environment. Any electronic system that uses a CPU chip, but that is not a general-purpose workstation, desktop or laptop computer is known as embedded system. Such systems generally use microprocessors; microcontroller or they may use customdesigned chips or both. They are used in automobiles, planes, trains, space vehicles, machine tools, cameras, consumer and office appliances, cell phones, PDAs and other handhelds as well as robots and toys. The uses are endless, and billions of microprocessors are shipped every year for a myriad of applications. In embedded systems, the software is permanently set into a read-only memory such as a ROM or flash memory chip, in contrast to a general-purpose computer that loads its programs into RAM each time. Sometimes, single board and rack mounted general-purpose computers are called "embedded computers" if used to cont The objective of embedded system is to execute as fast as necessary in an asynchronous world using the small amount of code and with the highest level of reliability. Embedded System Applications : Consumer electronics, e.g., cameras, cell phones etc. Consumer products, e.g. washers, microwave ovens etc. Automobiles (anti-lock braking, engine control etc.) Industrial process controller & defense applications. Computer/Communication products, e.g. printers, FAX machines etc. Medical Equipments. ATMs Aircrafts DIFFERENCE BETWEEN MICROPROCESSORS

19

AND MICROCONTROLLERS: A Microprocessor is a general purpose digital computer central processing unit(C.P.U) popularly known as CPU on the chip. The Microprocessors contain no RAM, no ROM, and no I/P O/P ports on the chip itself. On the other hand a Microcontroller has a C.P.U(microprocessor) in addition to a fixed amount of RAM, ROM, I/O ports and a timer all on a single chip. In order to make a Microprocessor functional we must add RAM, ROM, I/O Ports and timers externally to them,i.e any amount of external memory can be added to it. But in controllers there is a fixed amount of memory which makes them ideal for many applications. The Microprocessors have many operational codes(opcodes) for moving data from external memory to the C.P.U Whereas Microcontrollers may have one or two operational codes.

DISADVANTAGES OF MICROPROCESSORS OVER MICROCONTROLLERS System designed using Microprocessors are bulky They are expensive than Microcontrollers We need to add some external devices such as PPI chip, Memory, Timer/counter chip, Interrupt controller chip,etc. to make it functional. Types of microcontroller architecture:

20

There are two types of Microcontroller architecture designed for embedded system development. These are: 1)RISC- Reduced instruction set computer 2)CISC- Complex instruction set computer Difference between CISC and RISC: CISC stands for Complex Instruction Set Computer. Most PC's use CPU based on this architecture. For instance Intel and AMD CPU's are based on CISC architectures. Typically CISC chips have a large amount of different and complex instructions. In common CISC chips are relatively slow (compared to RISC chips) per instruction, but use little (less than RISC) instructions. MCS-51 family microcontrollers based on CISC architecture. RICS stands for Reduced Instruction Set Computer. The philosophy behind it is that almost no one uses complex assembly language instructions as used by CISC, and people mostly use compilers which never use complex instructions. Therefore fewer, simpler and faster instructions would be better, than the large, complex and slower CISC instructions. However, more instructions are needed to accomplish a task. Atmells AVR microcontroller based on RISC architecture. History of 8051 Intel Corporation introduced an 8-bit microcontroller called 8051 in 1981 this controller had 128 bytes of RAM, 4k bytes of on chip ROM, two timers, one serial port, and four ports all are on single chip. The 8051 is an 8 bit processor, meaning that the CPU can work on only 8 bit data at a time. Data larger than 8 bits broken into 8 bit pieces to be processed by CPU. It has for I/O 8 bit wide. Features of the 8051:Feature ROM RAM Timer I/O pins Serial port Interrupt sources Quantity 4K bytes 128 bytes 2 32 1 6

21

8051 Architecture Overview The 8051 family is one of the most common microcontroller architectures used worldwide. 8051 based microcontrollers are offered in hundreds of variants from many different silicon manufacturers .The 8051 is based on an 8-bit CISC core with Harvard architecture. It's an 8-bit CPU, optimized for control applications with extensive Boolean processing (single-bit logic capabilities), 64K program and data memory address space and various on-chip peripherals. The 8051 microcontroller family offers developers a wide variety of highintegration and cost-effective solutions for virtually every basic embedded control application. From traffic control equipment to input devices and computer networking products, 8051 u.c deliver high performance together with a choice of configurations and options matched to the special needs of each application. Whether it's low power operation, higher frequency performance, expanded onchip RAM, or an application-specific requirement, there's a version of the 8051 microcontroller that's right for the job. When it's time to upgrade product features and functionality, the 8051 architecture puts you on the first step of a smooth and cost-effective upgrade path - to the enhanced performance of the 151 and 251 microcontrollers.

Uses i. ii. Ease-of-use

More integrated features like RF and USB iii. iv. Less power usage

Smaller processing power

22

Block diagram of 8051

Pin configuration of 8051

23

There are four ports P0, P1, P2 and P3 each use 8 pins, making them 8-bit ports. All the ports upon RESET are configured as output, ready to be used as output ports. To use any of these ports as an input port, it must be programmed. Port 0:- Port 0 occupies a total of 8 pins (pins 32-39) .It can be used for input or output. To use the pins of port 0 as both input and output ports, each pin must be connected externally to a 10K ohm pull-up resistor. This is due to the fact that P0 is an open drain, unlike P1, P2, and P3.Open drain is a term used for MOS chips in the same way that open collector is used for TTL chips. With external pull-up resistors connected upon reset, port 0 is configured as an output port. Port 0 as input:- With resistors connected to port 0, in order to make it an input, the port must be programmed by writing 1 to all the bits. In the following code, port 0 is configured first as an input port by writing 1's to it, and then data is received from the port and sent to P1. Dual Role of Port 0 :-Port 0 is also designated as AD0-AD7, allowing it to be used for both address and data. When connecting an 8051/31 to an external memory, port 0 provides both address and data. The 8051 multiplexes address and data through port 0 to save pins. ALE indicates if P0 has address or data. When ALE = 0, it provides data D0-D7, but when ALE =1 it has address and data with the help of a 74LS373 latch. Port 1:- Port 1 occupies a total of 8 pins (pins 1 through 8). It can be used as input or output. In contrast to port 0, this port does not need any pull-up resistors since it already has pull-up resistors internally. Upon reset, Port 1 is configured as an output port.

24

Port 2 :-Port 2 occupies a total of 8 pins (pins 21- 28). It can be used as input or output. Just like P1, P2 does not need any pull-up resistors since it already has pullup resistors internally. Upon reset,Port 2 is configured as an output port. Port 2 as input:- To make port 2 an input, it must programmed as such by writing 1 to all its bits. In the following code, port 2 is configured first as an input port by writing 1s to it. Then data is received from that port and is sent to P1 continuously. Dual role of port 2:- As shown in pin configuration 8051, port 2 is also designed as A8-A15, indicating the dual function. Since an 8031 is capable of accessing 64K bytes of external memory, it needs a path for the 16 bits of the address. While P0 provides the lower 8 bits via A0-A7, it is the job of P2 to provide bits A8-A15 of the address. In other words, when 8031 is connected to external memory, P2 is used for the upper 8 bits of the 16 bit address, and it cannot be used for I/O. Port 3:- port 3 occupies a total of 8 pins, pins 10 through 17. It can be used as input or output. P3 does not need any pull-up resistors, the same as P1 and P2 did not. Although port 3 is configured as an output port upon reset. Port 3 has the additional function of providing some extremely important signals such as interrupts. This information applies both 8051 and 8031 chips. P3.0 and P3.1 are used for the RxD and TxD serial communications signals.. ALE/PROG Address Latch Enable is an output pulse for latching the low byte of the address during accesses to external memory. This pin is also the program pulse input (PROG) during Flash programming. In normal operation, ALE is emitted at a constant rate of 1/ 6 the oscillator frequency and may be used for external timing or
25

clocking purposes. Note, however, that one ALE pulse is skipped during each access to external data memory. PSEN Program Store Enable is the read strobe to external program memory. When the AT89S8252 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 when 12-volt programming is selected. XTAL1 Input to the inverting oscillator amplifier and input to the internal clock operating circuit. XTAL2 Output from the inverting oscillator amplifier.

AT89s8252
AT89S8252 is an ATMEL controller with the core of intel MCS-51. It has same pin configuration as give above. The AT89S8252 is a low-power, high-performance CMOS 8-bit microcomputer with 8K bytes of Downloadable Flash programmable and erasable read only memory and 2K bytes of EEPROM. The device is manufactured using Atmels high density nonvolatile memory technology and is compatible with the industry standard 80C51 instruction set and pinout. The on-chip Downloadable Flash allows the program memory to be reprogrammed in-system through an SPI serial interface or by a conventional nonvolatile memory programmer. By combining a versatile 8bit CPU with Downloadable Flash on a monolithic chip, the Atmel AT89S8252 is a powerful microcomputer which provides a highly flexible and cost effective

26

solution to many embedded control applications. The AT89S8252 provides the following standard features: 8K bytes of Downloadable Flash, 2K bytes of EEPROM, 256 bytes of RAM, 32 I/O lines, programmable watchdog timer, two Data Pointers, three 16-bit timer/counters, a six-vector two-level interrupt architecture, a full duplex serial port, on-chip oscillator, and clock circuitry. In addition, the AT89S8252 is designed with static logic for operation down to zero frequency and supports two software selectable power saving modes. Features 2K bytes EEPROM 4.0V to 6V Operating Range 256 x 8 bit Internal RAM 32 Programmable I/O Lines Three 16 bit Timer/Counters Programmable UART Serial Channel SPI Serial Interface Hardware interfacings and programming There are two types of programming language used for microcontroller programming: 1)Low Level Language(Assembly Language) 2) High Level Language(C Language)_

Hardware interfacings and programming There are two types of programming language used for microcontroller programming: 1)Low Level Language(Assembly Language) 2) High Level Language(C Language)

27

Advantages of C over Assembly language programming:

Knowledge of the processor instruction set is not required.

Details like register allocation and addressing of memory and data is managed by the compiler. Programs get a formal structure and can be divided into separate functions. Programming and program test time is drastically reduced, this increases efficiency. Keywords and operational functions can be used that come closer to how humans think. The supplied and supported C libraries contain many standard routines such as numeric conversions. Reusable code: Existing program parts can be more easily included into new programs, because of the comfortable modular program construction techniques. The C language based on the ANSI standard is very portable. Existing programs can be quickly adapted to other processors as needed.

THE 8051 INTERRUPTS


There are two methods in which a micro-controller can provide its services to its internal and external environment: 1) POLLING: Microcontroller checks the device continuously while using this method. But it results in wastage of machine cycles of the micro-controller. 2) INTERRUPTS: Here every device tells the micro-controller when it needs the services from microcontroller. Actually, only 5 interrupts are available to the user in the 8051, but many manufacturers data sheets state that there are 6 interrupts since they include reset. The 6 interrupts in the 8051 are allocated as follows:

28

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 locations 000BH and 001BH in the interrupt vector table belong to timer0 and timer1, respectively. 3).Two interrupts are set aside for hardware external hardware interrupts. Pin numbers 12(p3.2) and 13(p3.3) in port 3 are the external hardware interrupts INT0 and INT1, respectively. These external interrupts are also referred to as EX1 and EX2. 4).Serial communication has a single interrupts that belongs to both receive and transmit.

ELECTROMAGNETIC RELAYS
A relay is an electrically controllable switch widely used in industrial controls, automobiles and appliances. It allows the isolation of two separate sections of a system with two different voltage sources. The electromechanical (or electromagnetic) relay (EMR) has 3 components: the coil, spring and contacts. When current flows through the coil, a magnetic field is created around the coil (the coil is energized) which causes the armature to be attracted to the coil. The armatures contact acts like a switch and closes or opens a circuit. When the coil is not energized, a spring pulls the armature to its normal state of open or closed. In choosing a relay, the following characteristics need to be considered:

1)

2)

The contacts can be normally open (NO) or normally closed (NC). In the NC type, the contacts are closed when the coil is not energized. In the NO, the contacts are open when the coil is un-energized. The voltage and current needed to energize the coil. The voltage can vary from a few volts to 50 volts, while the current can be from few 20ma.

29

The function of each of the connections is shown in the table below:Pins 1 & 2 are the power supply lines, Vss & Vdd. The Vdd pin should be connected to the positive supply & Vss to the 0V supply or ground. Although the LCD module data sheets specify 5V D.C. supply (at only a few milliamps), supplies of 6V & 4.5V both work well, and even 3V is sufficient for some modules. Consequently, these modules can be effectively and economically powered by batteries.Pin 3 is a control pin, Vee, which is used to alter the contrast of the display. Ideally, these pin should be connected to a variable voltage supply.
J2 LCD

VCC

VCC

31

EA/VPP

Y1

VCC

33pF C1

40

U1

12

4 3 33pF C2

19 18 9 12 15

XTAL1 XTAL2 RST

P1.0/T2 P1.1/T2-EX P1.2 P1.3 P1.4/SS P1.5/MOSI P1.6/MISO P1.7/SCK

1 2 3 4 5 6 7 8 13 14

RS EN

P3.2/INT0 P3.3/INT1 P3.4/T0 P3.5/T1 P2.0/A8 P2.1/A9 P2.2/A10 P2.3/A11 P2.4/A12 P2.5/A13 P2.6/A14 P2.7/A15

VCC C3 10uF 16V R1 10K

Hardware intetrfacing of LCD with AT89s52 microcontroler

20

AT89S52

GND

32 33 34 35 36 37 38 39

P0.7/AD7 P0.6/AD6 P0.5/AD5 P0.4/AD4 P3.7/RD P0.3/AD3 P3.6/WR P0.2/AD2 PSEN P0.1/AD1 ALE/PROG P0.0/AD0 P3.0/RXD P3.1/TXD

21 22 23 24 25 26 27 28 17 16 29 30 10 11

30

VCC

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
R52 56E

PROJECT DETAILS
Project Name: VELOCITY MEASUREMENT Components used: In velocity measurement project the components used are Power supply Connectors 8051microcontroller L c d display Relays and Switches Burner Potentiometer Serial resistance The description of all the components are above given Working: This project velocity measurement work on the principle of embedding i.e. bedding all the components on a single chip. In real sense there are basically two types of I C Microprocessor Microcontroller In this project we use microcontroller . It will be programmed to work at low potential.Which will be constantly acchived due to potentiometer so at low potential I c will work out. As when a components pass in front of the led then due to this the sensors on because of no light falling on them so due to low potential the pnp transistor attach to it which working as the switch will become on and let the current to pass through them. Thus, with this the controller get the instruction to get on and start working and will measure the timing of the vehicle pass with the use of timer . So, due to this the distance between the the two sensors will be burned in as a instruction and with the velocity formula as V=D/T V = velocity of vehicle to be found D= distance between the two sensors(taken to be 10mm) T = time taken to complete the distance. Thus we find the velocity..

31

Design-VELOCITY MEASUREMENT

32

In the design the figure as c2,con1,d2,r57 etc are the name of the components in the incremental way acc to their use in the design to change it we have to go on annotate(U)in the project window and then at reset part to reference ?and give the name as our require if do not want any change then we go to undo. In design >>EN and <<RS are the offpage connectors which are used to extent the project or circuit to next page.
Applications: 1:-The concept used in this project has a wide scope. 2:-It can be used to control a large number of components working at different velocities at a time through a Computer. 3:-This project will help the traffic police to lessens the accidents caused due high speed of vehicles. 4:-We can control many machines at any time without moving from our place, just by pressing a key from our PC. 5:-By this the timing and work of the controller is reduced that it become easy to distinguish the high speed vehicle by using video camera with this controller. PROGRAM #include<at89s8252.h> #define RS P3_3 #define EN P3_4 #define LCDPRT P1 bit flag; void Init_Tmr0(void); //8-bit auto reload mode 100us Interrupt void en_tmr0_int(void); void delay (unsigned int i); void lcd_cmd(unsigned char a); void display(unsigned char b); void wait(void); void Init_lcd(void); void cursor_position(unsigned char c); void disp_dec(unsigned int digit); 33

unsigned int count,b; void main(void) { long int l; unsigned char d=100; unsigned char a=0; unsigned char v,h,i; unsigned int k; unsigned char sec; unsigned int sp; flag=0;sec=0; P0_0=1; P0_1=1; ET0=1; //timer 0 int bit enable EA=1; //global int enable //Init_Tmr0(); Init_lcd(); //c code for l c d display cursor_position(0x00); display('V'); display('e'); display('l'); display('='); while(1) { if(P0_0==1) { Init_Tmr0(); } if(P0_6==1) { TR0=0; i=TH0; h=TL0; k=(i*256)+h; l=(b*65536)+k; 34

sec=l/800000; lcd_cmd(0xc0); //disp_dec(sec); sp=d/sec; lcd_cmd(0x84); disp_dec(sp); display('m'); display('m'); display('/'); display('s'); }}} //c code for 8051 interrupt void tmr0_isr() interrupt 1 //ISR for t0 {b++;} void Init_Tmr0(void) { TR0=0; TMOD=TMOD&0xf0; //alter only T0 configuration TMOD=TMOD|0x01; //16-bit TH0=0x00; TR0=1; //run timer 0 } // c code for timer setting void en_tmr0_int(void) { ET0=1; //timer 0 int bit enable EA=1; //global int enable } void delay (unsigned int i) { while (i!=0) {i--; }} // c code for l c d commands void lcd_cmd(unsigned char a) 35

{ wait (); LCDPRT=a; RS=0; EN=1; EN=0; } void display(unsigned char b) { wait (); LCDPRT=b; RS=1; EN=1; EN=0; } void Init_lcd(void) { lcd_cmd(0x38); lcd_cmd(0x0c); lcd_cmd(0x01); } // c code for velocity conversion void disp_dec(unsigned int digit) { unsigned int temp; if(digit<100) { temp=digit/10; display(temp+48); temp=digit-temp*10; display(temp+48); } if(digit>99 && digit<1000) { temp=digit/100; 36

display(temp+48); digit=digit-(temp*100); temp=digit/10; display(temp+48); digit=digit-(temp*10); temp=digit; display(temp+48); } if(digit>999 && digit<10000) { temp=digit/1000; display(temp+48); digit=digit-(temp*1000); temp=digit/100; display(temp+48); digit=digit-(temp*100); temp=digit/10; display(temp+48); digit=digit-(temp*10); temp=digit; display(temp+48); } if(digit>10000) { temp=digit/10000; display(temp+48); digit=digit-(temp*10000); temp=digit/1000; display(temp+48); digit=digit-(temp*1000); temp=digit/100; display(temp+48); digit=digit-(temp*100); temp=digit/10; display(temp+48); 37

digit=digit-(temp*10); temp=digit; display(temp+48); }} After burning the program in the 8051 controller with the help of burner as shown on kit we can start our project and thus the velocity measurement project works.

38

BIBLIOGRAPHY

8051 Microcontroller Programming (Mohammad Ali Mazidi) http://www.google.co.in/ http://www.wikepedia.com/

39

You might also like