+ All Categories
Home > Documents > Two Months Industrial Training

Two Months Industrial Training

Date post: 06-Apr-2018
Category:
Upload: gaurav-gulati
View: 216 times
Download: 0 times
Share this document with a friend

of 76

Transcript
  • 8/3/2019 Two Months Industrial Training

    1/76

    TWO MONTHS INDUSTRIAL

    TRAINING REPORT

    Submitted for partial fulfillment of award of

    BACHELOR OF ELECTRONICS & COMMUNICATIONENGINEERING

    Maharishi MarkandeswarUniversity

    Maharishi Markandeswar EngineeringCollege

    Mullana,Ambala

    Submitted by:

    Ishan kaushikRoll No.

    110919673rd Year(5th sem)

    ECE

    1

  • 8/3/2019 Two Months Industrial Training

    2/76

    CONTENTS

    1) Company profile

    2) PCB Designing

    Functions of PCB

    Classifications of PCBs

    Technique used for PCB design

    PCB design software

    3) 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

    4) Power system design

    Unregulated power supplies

    Regulated power supplies

    Bench supply diagram

    5) Embedded Systems

    What is Embedded System

    Applications

    Difference between microprocessor & micro controller

    2

  • 8/3/2019 Two Months Industrial Training

    3/76

    Types of microcontroller Architectures

    Difference between CISC & RISC

    History of 8051

    8051 core architecture

    Pin description of 8051 Atmels AT89S8252 microcontroller

    Feature of AT89S8252

    Pin description of AT89S8252

    Hardware interfacing & programming using AT89S8252

    Software used for Embedded system design using MCS-51 family

    Advantage of Embedded C over Assembly language programming

    Interfacing

    o LED interfacing

    o LCD interfacing

    o Seven Segment Display Interfacing

    o ADC interfacing

    o Relay Interfacing

    o Matrix Keyboard Interfacing

    o Serial communication [b/w PC & Microcontroller]

    o Hardware interrupt programming

    6) Project Details (Home Automation)

    3

  • 8/3/2019 Two Months Industrial Training

    4/76

    ACKNOWLEDGEMENT

    First of all I would like to thank almighty GOD who has given this wonderful gift of life to

    us. He is the one who is guiding us in right direction to follow noble path of humanity. Inmy six months industrial training it is a wonderful experience to be a part of NETMAX

    TECHNOLOGIESwhere I have opportunity to work under brilliant minds. I owe my deep

    regards for the supporting and kind staff authorities who are helping me in my lean patches

    during these six months. The knowledge I am gaining throughout my studies have the

    practical implementation during this period. I am grateful to all the staff of NETMAX and

    for their timely support and sharing of their experience with me. I would like to express my

    heartiest concern for Mr. Harmesh lal for his able guidance and for his inspiring attitude,

    praiseworthy attitude and honest support. Not to forget the pain staking efforts of our

    college training and placement cell and specially my training and placement officer Mr.

    Charanjeet Singh. Last but not the least I would express my utmost regards for the

    electronics and communication department of our Institute.

    4

  • 8/3/2019 Two Months Industrial Training

    5/76

    COMPANY PROFILE

    Netmax Technologies is an organization which is established in the field of NetworkSupport, Network training and Embedded systems. It provides support and training in thefield of networking solutions (CISCO, LINUX) and embedded systems (Micro controller

    based design, Electronics system design).

    In Education, it has strategic alliance with REDHAT Inc. It is also NOVELLEDUCATION PARTNER with which it provides NOVELL and SUSE LINUX courses.

    Netmax technologies also conduct courses in CADENCE based design tools.

    Netmax Technologies also provide Technical Research & Development support andconsultancy to some Electronics companies.

    Their clients for R&D support in field of embedded systems are:

    1) Recorders and Medicare ltd Chandigarh.2) TELEBOX India ltd.3) Lotus Machines Pvt. Ltd. Chandigarh.4) Impearl Electronics Pvt. Ltd. Chandigarh.5) KANTA Electrical Ltd. Mohali.

    The partial list of our clients for network field is as below:

    1) CEDTI, Mohali2) Premier ISP, Chandigarh3) Innovative Solutions, Chandigarh4) Emmtel ISP, Chandigarh5) NIPER, Mohali6) Navik Technologies, Chandigarh7) Software Technology Parks India, Mohali8) Glide Internet Services9) Rana Group10) IDS11) HFCL Infotel Ltd.12) Targus technologies pvt ltd13) STPI, Mohali14) BBMB15) The Tribune16) Quark

    5

  • 8/3/2019 Two Months Industrial Training

    6/76

    17) Ind Swift

    Support Area (Networking Solutions)

    a) LINUX / UNIX networks

    b) SUN networksc) CISCO devices (Routers, Switches, Firewalls, Cache Engine, RAS etc)d) Bandwidth Manager software and hardwaree) Radio Linksf) Security Solutions

    Design Services (Embedded Systems)

    a) AVR family

    b) MCS 51c) ELECTRONIC SYSTEM DESIGN

    Network Training

    a) CISCO CCNA, CCNPb) RED HAT LINUXc) SUN SOLARISd) WINDOWS 2000, 2003

    Netmax Technologies is a leader in education services and developer of innovativeembedded solutions. To meet the demands of Post PC era Netmax provides completesolutions as well as design-to-order services to satisfy its customers.

    6

  • 8/3/2019 Two Months Industrial Training

    7/76

    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 (printedwiring 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 layersthrough plated through holes. The size of this PCB is smaller than that of double sided

    PCB but it is very costly.

    PCBs may also be either rigid, flexible, or the combination of two (rigid-flex). When the

    electronic components have been mounted on the PCB, the combination of PCB and

    7

  • 8/3/2019 Two Months Industrial Training

    8/76

    components is an electronic assembly, also called PRINTED CIRCUIT ASSEMBLY. This

    assembly is the basic building block for all the electronic appliances such as television,

    computer and other goods.

    FUNCTIONS OF PCBPrinted 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.

    8

  • 8/3/2019 Two Months Industrial Training

    9/76

    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.

    o PCB design software like OrCad, CADSTAR, Protel, TANGO, Mentor etc.

    o A photo plotter for art work generation.

    There are many enhanced features in electronics design automation tools which not

    possible in the hand taping. The main advantages are given below:

    o 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 differentoptions.

    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.

    BASIC DESIGN STEPS IN CAD- SYSTEM

    The following design steps are very common while designing a PCD in CAD:

    9

  • 8/3/2019 Two Months Industrial Training

    10/76

    Entry the schematic diagram.

    Net list file creation.

    Placement of components manually or automatically.

    Routing of the board using manual routing tools or auto router

    Design rule check physical and electrical.

    Artwork generation.

    A TRADITIONAL DESIGN FLOW IN CAD- SYSTEM

    Overview of a PCB Design Software

    There many soft wares which are used for PCB designs. Some of them are given below:-

    OrCad

    CADSTAR

    Protel

    TANGO

    Mentor

    Capture

    Libraries

    Footprint

    libraries

    Layout

    Gerbertools

    Gerberand drillfiles

    Gerber andplotterdrawing

    10

  • 8/3/2019 Two Months Industrial Training

    11/76

    The most commonly software which are used for PCB design in India are Protel and

    OrCad

    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. OrCad Layout delivers all the capabilities to designers need from netlist to

    place and route, to final output. The ease-of use and intuitive capabilities of OrCad Layout

    provides for quick startup and rapid learning right out of the box.

    11

  • 8/3/2019 Two Months Industrial Training

    12/76

    PCB DESIGN STEPS IN OrCad 10.5

    Entry of Schematic Diagram

    Schematic diagram provides the functional flow and the graphical representation of anelectronic circuit. The entry of schematic diagram is the first step in PCB design using

    OrCad.

    A schematic diagram consists of:-

    Electrical connections(nets)

    Junctions

    Integrated circuits symbols Discrete components symbols like resistors, capacitors etc.

    Input / output connectors

    Power and ground symbols

    Buses

    No connection symbols

    Components reference names

    Text

    The Schematic Page Editor:

    The schematic page editor is used to display and edit schematic pages. So that one can

    parts; wires; buses and draw graphics. The schematic page editor has a tool palette that youcan use to draw and place everything you need to create a schematic page. One can print

    from within the schematic page editor, or from the project window.

    12

  • 8/3/2019 Two Months Industrial Training

    13/76

    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:

    The session log lists the events that have occurred during the current Capture

    session, includes message resulting from using captures tools. To display context-sensitive

    help for an error message, put the cursor in the error message line in the session log press

    F1.13

  • 8/3/2019 Two Months Industrial Training

    14/76

    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.

    One can search for information in the session log using the find command on the Edit

    menu. You can also save the contents of the of the session log to a file, which is useful

    when working with Orcads technical support to solve technical problems. The default

    filename is SESSION.TXT.

    The Toolbar:

    Captures toolbar is dock able (that means you can select and drag the toolbar to new

    location) as well as resizable, and displays tool tips for each tool; by choosing a tool button

    you can quickly perform a task. If tool button is dimmed, you cant perform that task in the

    current situation.

    14

  • 8/3/2019 Two Months Industrial Training

    15/76

    Some of the tools operate only on what you have selected, while others give you a choice

    of either operating on what is selected or expanding the scope to entire project.

    You can hide the toolbar, then display it again when u need it. For hiding select from the

    schematic page editors view menu, choose TOOLBAR.

    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.

    The schematic page editor tool palette:

    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.

    15

  • 8/3/2019 Two Months Industrial Training

    16/76

    The part editor tool palette:

    The first group of tools on the part palette is electrical tools, used to place pins and

    symbols. They have been already explained above within the schematic page editor tools.

    The second group of tools is drawing tools, used to create graphical objects without objectsany electrical connectivity and is described:

    Pin Tools: Place pins on part

    Pin Array: Place multiple pins on part

    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.16

  • 8/3/2019 Two Months Industrial Training

    17/76

    Choose a net list format tab.

    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 thecomponents 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.

    17

  • 8/3/2019 Two Months Industrial Training

    18/76

    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.

    Main window

    18

  • 8/3/2019 Two Months Industrial Training

    19/76

    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.

    Design window

    Select the technology template (.TCH), then choose the open button and load the net

    list in other box.19

  • 8/3/2019 Two Months Industrial Training

    20/76

    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

    Components can be placed by using two techniques:-

    20

  • 8/3/2019 Two Months Industrial Training

    21/76

    1) Manual placement of components

    2) Auto placement of components

    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 referencedesignator 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.

    Conductor Routing in Layout:-

    After placing all the components the other main step is to route the board from the

    electrical connections between the components. One may route board manually or

    automatically by auto router.

    100% auto routing can be achieved only when components are placed in the order of

    functional flow of electronic circuit. The main routing tool available in OrCad is as flow:-

    Add/edit route mode

    Edit segment mode

    Shove track mode

    Auto path route mode

    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:-

    21

  • 8/3/2019 Two Months Industrial Training

    22/76

    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.

    POWER SYSTEM DESIGN

    First part of electronics ckts. is power. The main power supply is in AC but mostly

    electronic ckts. work with DC. So a system is required to convert ac to dc and these

    sources should able to produce stable supplies.

    Power supplies may be used in. may be of different types such as regulated, unregulated,

    smps etc.

    Unregulated power supplies

    These are the power supplies in which the out put is not constant. That it is varies with

    input voltage, load, and also effected by the environment conditions such as

    temperature, etc. so these are the variable supplies. Commonly these supplies are not

    employed as there efficiency is very less. The unregulated power can be obtained using

    rectifying circuit after AC supply.

    Regulated power supplies

    These are the power supplies in which the output voltage is constant, i.e. the out put

    voltage is independent of the input voltage, load and other external conditions. So to

    obtain the regulated voltage using different regulators. The regulator voltage is mainly

    the DC voltage, it may AC to or DC to DC voltage. A better approach to power supply

    design is to use enough capacitance to reduce ripple to low level, then use an active

    feedback circuit to eliminate the remaining ripple and dependence of output voltage on

    22

  • 8/3/2019 Two Months Industrial Training

    23/76

    input, load and environment conditions. These active devices are known as Regulators.

    These regulators can be used to produce negative and positive voltage of required value.

    The voltage regulators are of three types:-

    1) Constant positive voltage regulators

    2) Constant negative voltage regulators3) Variable voltage regulators

    Constant positive voltage regulators:- These are the regulators which are able to

    produce positive and constant voltage. Some of them are given below:-

    S. no. Name of regulator Output voltage1 LM 7805 5v

    2 LM 7810 10v3 LM 7812 12v4 LM 7815 15vThese regulators are used according to the required voltage need.

    Constant negative voltage regulators:- These are also the constant output voltage regulator

    but there output is negative in polarity. These regulators are also employed according to

    voltage requirements. Some of them are given below with there outputs:-

    S. no Name of regulator Output voltage1 LM7905 -5v2 LM7910 -10v3 LM7912 -12v4 LM7915 -15v

    Variable voltage regulators:- These are the regulator whose output voltage can be varied

    according to the desired need. These regulators again of two types i.e.:-

    Positive

    Negative

    23

  • 8/3/2019 Two Months Industrial Training

    24/76

    The output of these regulators can be varied by varying the resistance of the variable

    resistance which is connected to the adjustable pin the regulators. So these are the most

    commonly used regulators in the electronic industry as wide range of stable voltage can be

    obtained from single chip by varying the resistance connected to the adjustable pin of the

    regulators. The most commonly variable regulators are:-

    LM317 (it is positive regulator)

    LM 337(it is negative regulator)

    There description is given below:-

    LM317 3-Terminal Adjustable Regulator:-

    General Description:

    The LM317 series of adjustable 3-terminal positive voltage regulators is capable of

    supplying in excess of 1.5A over a 1.2V to 37V output range. They are exceptionally easy

    to use and require only two external resistors to set the output voltage. Further, both line

    and load regulation is better than standard fixed regulators. Also, the LM117 is packaged

    in standard transistor packages which are easily mounted and handled. In addition to higher

    performance than fixed regulators, theLM317 series offers full overload protection

    available only in ICs. Included on the chip are current limit, thermal overload protection

    and safe area protection. All overload protection circuitry remains fully functional even if

    the adjustment terminal is disconnected. Normally, no capacitors are needed unless the

    device is situated more than 6 inches from the input filter capacitors in which case an input

    bypass is needed. An optional output capacitor can be added to improve transient response.

    The adjustment terminal can be bypassed to achieve very high ripple rejection ratios which

    are difficult to achieve with standard voltage, supplies of several hundred volts can be

    regulated as long as the maximum input to output differential is not exceeded, i.e., avoid

    short-circuiting the output.24

  • 8/3/2019 Two Months Industrial Training

    25/76

    Also, it makes an especially simple adjustable switching regulator, a programmable output

    regulator, or by connecting a fixed resistor between the adjustment pin and output,

    theLM317 can be used as a precision current regulator. Supplies with electronic shutdown

    can be achieved by clamping the adjustment terminal to ground which programs the output

    to 1.2V where most loads draw little current.

    Typical application:

    U 1

    L M 3 1 7 / C Y L

    V I N3

    A

    D

    J

    1

    V O U T2

    R 1

    2 2 0 E

    C 1

    . 1 u F

    C 2

    . 1 u F

    R 2

    5 k

    V OV I N

    Features

    1. Guaranteed 1% output voltage tolerance (LM317A)

    2. Guaranteed max. 0.01%/V line regulation (LM317A)

    3. Guaranteed max. 0.3% load regulation (LM317)

    4. Guaranteed 1.5A output current

    5. Adjustable output down to 1.2V

    6. Current limit constant with temperature

    25

  • 8/3/2019 Two Months Industrial Training

    26/76

    7. P+ Product Enhancement tested

    8. 80 dB ripple rejection

    9. Output is short-circuit protected

    Packages of LM317

    I

    Application Hints:

    In operation, the LM317 develops a nominal 1.25V reference voltage, VREF, between the

    output and adjustment terminal. The reference voltage is impressed across program resistorR1 and, since the voltage is constant, constant current I1 then flows through the output set

    resistor R2, giving an output voltage of

    26

  • 8/3/2019 Two Months Industrial Training

    27/76

    Since the 100A current from the

    adjustment terminal represents an errorterm, the LM317 was designed to

    minimize IADJ and make it very

    constant with line and load changes.

    To do this, all quiescent operating

    current is returned to the output

    establishing a minimum load current

    requirement. If there is insufficient

    load on the output, the output will rise.

    PROTECTION DIODES:-

    When external capacitors are used with any IC regulator it is sometimes necessary to add

    protection diodes to prevent the capacitors from discharging through low current points

    into the regulator. Most 10F capacitors have low enough internal series resistance to

    deliver 20A spikes when shorted. Although the surge is short, there is enough energy to

    damage parts of the IC. When an output capacitor is connected to a regulator and the input

    is shorted, the output capacitor will discharge into the output of the regulator. The

    discharge current depends on the value of the capacitor, the output voltage of the regulator,and the rate of decrease of VIN. In the LM317, this discharge path is through a large

    junction that is able to sustain 15A surge with no problem. This is not true of other types of

    27

  • 8/3/2019 Two Months Industrial Training

    28/76

    positive regulators. For output capacitors of 25F or less, there is no need to use diodes.

    The bypass capacitor on the adjustment terminal can discharge through a low current

    junction. Discharge occurs when either the input or output is shorted. Internal to the

    LM317 is a 50 resistor which limits the peak discharge current. No protection is needed

    for output voltages of 25V or less and 10F capacitance. Figure 3 shows an LM317 with

    protection diodes included for use with outputs greater than 25V and high values of output

    capacitance.

    28

  • 8/3/2019 Two Months Industrial Training

    29/76

    LM337 3-Terminal Adjustable Regulator:-

    General Description:

    The LM337 is adjustable 3-terminal negative voltage regulators capable of supplying in

    excess of 1.5A over an output voltage range of 1.2V to 37V. These regulators are

    exceptionally easy to apply, requiring only 2 external resistors to set the output voltage and1 output capacitor for frequency compensation. The circuit design has been optimized for

    excellent regulation and low thermal transients. Further, the LM337 series features internal

    current limiting, thermal shutdown and safe-area compensation, making them virtually

    blowout-proof against overloads. The LM337 serves a wide variety of applications

    including local on-card regulation, programmable-output voltage regulation or precision

    current regulation. The LM337 are ideal complements to the LM317 adjustable positive

    regulators.

    Pin diagram

    29

  • 8/3/2019 Two Months Industrial Training

    30/76

    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%/V4) Load regulation typically 0.3%

    5) Excellent thermal regulation, 0.002%/W

    6) 77 dB ripple rejection

    7) Excellent rejection of thermal transients

    8) Temperature-independent current limit

    9) Internal thermal overload protection

    10) Standard 3-lead transistor package

    11) Output is short circuit protected.

    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.

    30

  • 8/3/2019 Two Months Industrial Training

    31/76

    Bench supply diagram

    L 2

    I N D U C T O R A I

    1234

    56

    U 6

    L M 3 3 7 / T O 2 2 0

    A

    D

    J

    1

    V I N2

    V O U T3

    J 7

    C

    123- V S

    D 41 N 4 0 0 7

    1

    2

    D 3

    1

    N

    4

    0

    0

    7

    1

    2

    C 8

    2 2 0 0 u F 5 0 V

    C 1 42 2 0 0 u F 5 0 V

    J 8

    C O N 3

    123

    C

    1

    2

    1

    0

    u

    F

    2

    5

    V

    T

    A

    N

    T

    D 51 N 4 0 0 7

    1 2

    C 1 5

    4

    7

    0

    u

    F

    5

    0

    V

    C 1 1

    1 0 4

    D 21 N 4 0 0 7

    12

    R 8

    R

    C 1 71 0 4

    R 1 7

    R

    C 9

    4

    7

    0

    u

    F

    5

    0

    V

    U 5L M 3 1 7 / T O 2 2 0

    V I N3

    A

    D

    J

    1

    V O U T2

    C

    1

    3

    1

    0

    u

    F

    2

    5

    V

    T

    A

    N

    T

    - V S

    R

    1

    6

    1K

    1

    W

    R

    1

    2

    1

    K

    1

    W

    C 1 0

    C A P

    - +

    B R 1B R I D G E

    2

    1

    4

    3

    C 1 6

    C A P

    R 1 0

    P O TR 9

    R

    R 1 1

    R

    R 1 4

    P O TR 1 3

    R

    R 1 5

    R

    L 1

    I N D U C T O R A U I

    123 4

    56

    V S

    31

  • 8/3/2019 Two Months Industrial Training

    32/76

    EMBEDDED SYSTEM

    What is Embedded System?

    Embedded system employs a combination of software & hardware to perform a specific

    function. It is a part of a larger system which may not be a computerWorks in areactive & time constrained environment.Any electronic system that uses a CPU chip, but that is not a general-purposeworkstation, desktop or laptop computer is known as embedded system. Such systemsgenerally use microprocessors; microcontroller or they may use custom-designed chipsor both. They are used in automobiles, planes, trains, space vehicles, machine tools,cameras, consumer and office appliances, cell phones, PDAs and other handhelds aswell as robots and toys. The uses are endless, and billions of microprocessors areshipped every year for a myriad of applications.

    In embedded systems, the software is permanently set into a read-only memory such asa 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

    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

    32

  • 8/3/2019 Two Months Industrial Training

    33/76

    DIFFERENCE BETWEEN MICROPROCESSORS

    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.

    33

  • 8/3/2019 Two Months Industrial Training

    34/76

    Types of microcontroller architecture:

    There are two types of Microcontroller architecture designed for embedded systemdevelopment. 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 thisarchitecture. For instance Intel and AMD CPU's are based on CISC architectures.Typically CISC chips have a large amount of different and complex instructions. Incommon CISC chips are relatively slow (compared to RISC chips) per instruction, but uselittle (less than RISC) instructions. MCS-51 family microcontrollers based on CISCarchitecture.

    RICS stands for Reduced Instruction Set Computer. The philosophy behind it is that almostno one uses complex assembly language instructions as used by CISC, and people mostlyuse compilers which never use complex instructions. Therefore fewer, simpler and fasterinstructions would be better, than the large, complex and slower CISC instructions.However, more instructions are needed to accomplish a task. Atmells AVRmicrocontroller based on RISC architecture.

    History of 8051Intel Corporation introduced an 8-bit microcontroller called 8051 in 1981 this controllerhad 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 canwork 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 QuantityROM 4K bytesRAM 128 bytes

    Timer 2I/O pins 32

    Serial port 1Interrupt sources 6

    34

  • 8/3/2019 Two Months Industrial Training

    35/76

    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 high-integration 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 deliverhigh 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 on-chip 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.

    35

  • 8/3/2019 Two Months Industrial Training

    36/76

    Block diagram of 8051

    36

  • 8/3/2019 Two Months Industrial Training

    37/76

    Internal Architecture of 8051

    37

  • 8/3/2019 Two Months Industrial Training

    38/76

    Pin configuration of 8051

    38

  • 8/3/2019 Two Months Industrial Training

    39/76

    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 collectoris

    used for TTL chips. With external pull-up resistors connected upon reset, port 0 is

    configured as an output port. For example, the following code will continuously send outto port 0 the alternating values 55H and AAH

    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

    39

  • 8/3/2019 Two Months Industrial Training

    40/76

    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. For

    40

  • 8/3/2019 Two Months Industrial Training

    41/76

    example, the following code will continuously send out to port1 the alternating values 55h

    & AAh

    Port 1 as input:-To make port1 an input port, it must be programmed as such by writing 1

    to all its bits. In the following code port1 is configured first as an input port by writing 1s

    to it, then data is received from the port and saved in R7 ,R6 & R5.

    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 pull-up

    resistors internally. Upon reset,Port 2 is configured as an output port. For example, the

    following code will send out continuously to port 2 the alternating values 55h and AAH.

    That is all the bits of port 2 toggle continuously.

    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:- In systems based on the 8751, 8951, and DS5000, P2 is used as

    simple I/O. However, in 8031-based systems, port 2 must be used along with P0 to provide

    the 16-bit address for the external memory. 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.

    41

  • 8/3/2019 Two Months Industrial Training

    42/76

    Port 3:- port 3 occupies a total of 8 pins, pins 10 through 17. It can be used as input oroutput. 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 ofproviding some extremely important signals such as interrupts. This information appliesboth 8051 and 8031 chips. There functions are as follows:-

    P3.0 and P3.1 are

    used for the RxD and

    TxD serial

    communications signals.

    Bits P3.2 and P3.3 are set

    aside for external

    interrupts. Bits P3.4 and

    P3.5 are used for timers 0 and 1. Finally P3.6 and P3.7 are used to provide the WR and RD

    signals of external memories connected in 8031 based systems.

    ALE/PROG

    Address Latch Enable is an output pulse for latching the low byte of the address duringaccesses to external memory. This pin is also the program pulse input (PROG) duringFlash programming. In normal operation, ALE is emitted at a constant rate of 1/ 6 theoscillator 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. Ifdesired, ALE operation can be disabled by setting bit 0 of SFR location 8EH. With the bitset, ALE is active only during a MOVX or MOVC instruction. Otherwise, the pin is

    weakly pulled high. Setting the ALE-disable bit has no effect if the microcontroller is inexternal execution mode.

    PSEN

    Program Store Enable is the read strobe to external program memory. When theAT89S8252 is executing code from external program memory, PSEN is activated twiceeach machine

    PORT 3 Function pinP3.0 RxD 10P3.1 TxD 11P3.2 ___

    Int012

    P3.3 ___ Int1

    13

    P3.4 T0 14P3.5 T1 15P3.6 ___

    WR16

    P3.7 ___ RD

    17

    42

  • 8/3/2019 Two Months Industrial Training

    43/76

    cycle, except that two PSEN activations are skipped during each access to external datamemory.

    EA/VPP

    External Access Enable. EA must be strapped to GND in order to enable the device tofetch 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. EAshould 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.

    AT89s8252AT89S8252 is an ATMEL controller with the core of intel MCS-51. It has same pinconfiguration 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 bytesof EEPROM. The device is manufactured using Atmels high density nonvolatile memorytechnology 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 8-bit CPU with Downloadable Flash on amonolithic chip, the Atmel AT89S8252 is a powerful microcomputer which provides ahighly flexible and cost effective solution to many embedded control applications. TheAT89S8252 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 AT89S8252is designed with static logic for operation down to zero frequency and supports twosoftware selectable power saving modes. The Idle Mode stops the CPU while allowing theRAM, timer/counters, serial port, and interrupt system to continue functioning. The PowerDown Mode saves the RAM contents but freezes the oscillator, disabling all other chipfunctions until the next interrupt or hardware reset.The Downloadable Flash can be changed a single byte at a time and is accessible throughthe SPI serial interface. Holding RESET active forces the SPI bus into a serial

    programming interface and allows the program memory to be written to or read fromunless Lock Bit 2 has been activated.

    43

  • 8/3/2019 Two Months Industrial Training

    44/76

    Features Compatible with MCS-51Products 8K bytes of In-System Reprogrammable Downloadable Flash Memory- SPI Serial Interface for Program Downloading

    - Endurance: 1,000 Write/Erase Cycles 2K bytes EEPROM- Endurance: 100,000 Write/Erase Cycles 4.0V to 6V Operating Range Fully Static Operation: 0 Hz to 24 MHz Three-Level Program Memory Lock 256 x 8 bit Internal RAM 32 Programmable I/O Lines Three 16 bit Timer/Counters Nine Interrupt Sources Programmable UART Serial Channel SPI Serial Interface Low Power Idle and Power Down Modes Interrupt Recovery From Power Down Programmable Watchdog Timer Dual Data Pointer Power Off Flag

    Pin Description

    Furthermore, P1.4, P1.5, P1.6, and P1.7 can be configured as the SPI slave port select, datainput/output and shift clock input/output pins as shown in the following table.

    44

  • 8/3/2019 Two Months Industrial Training

    45/76

    Port 1 also receives the low-order address bytes during Flash programming andverification.

    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)_

    ALE/PROG

    Address Latch Enable is an output pulse for latching the low byte of the address duringaccesses to external memory. This pin is also the program pulse input (PROG) duringFlash programming. In normal operation, ALE is emitted at a constant rate of 1/ 6 theoscillator 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. Ifdesired, ALE operation can be disabled by setting bit 0 of SFR location 8EH. With the bitset, ALE is active only during a MOVX or MOVC instruction. Otherwise, the pin isweakly pulled high. Setting the ALE-disable bit has no effect if the microcontroller is inexternal execution mode.

    PSEN

    Program Store Enable is the read strobe to external program memory. When theAT89S8252 is executing code from external program memory, PSEN is activated twiceeach machine

    45

  • 8/3/2019 Two Months Industrial Training

    46/76

    cycle, except that two PSEN activations are skipped during each access to external datamemory.

    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. EAshould 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.

    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)

    Programming in assembly language:

    TOOLS USED:

    1). 8051 assembler cum simulator.2).command prompt as a programming environment.

    Introduction to programming in assembly language:

    assembly languages weredeveloped that provided mnemonics for the machine code instructions, plus others featuresthat made programming faster and less prone to error.The term mnemonic is frequentlyused in computer science and engg. literature to refer to codes and abbreviations that arerelatively easy to remember .Asssembly language programs must be translated into

    46

  • 8/3/2019 Two Months Industrial Training

    47/76

    machine code by a program called an ASSEMBLER.Assembly language is referred to asa low-level-language .

    Now we look at 8051 assembly language format and use an 8051Assembler to create a ready-to run program.

    An assembly language instruction consists of four fields:-

    [label:] mnemonic [operands] [;comment]

    Brackets indicates that a field is optional,and not all lines have them.Bracket shouldnot be typed in.1.The label field allows the program to refer to a line of code by name.the label field cannot exceed a certain no. of characters.

    2.The assembly language mnemonics(instruction) and operands fields together perform thereal work of the program and accomplish the tasks for which the program was written.

    3.The comment field begins with a ;. Comments may be at the and of a line or on a lineby themselvess .

    8051 basic instructions:we describe the basic instructions of the 8051 andgive their formats with some examples.1).arithmetic instructions2).logical instructions

    3).jump,loop,call instructions

    arithmetic instructions:

    the arithmetic instructions are used to perform arithmeticoperations like addition,subtraction ,multiplication, division etc.

    1)ADD:- this instruction is used to add 2 operands.the 1 operand should be in accumulatorand 2 in the other register.

    eg. MOV R0,#20

    MOV A,#10ADD A,R0MOV P1,A

    Here,# is used to load immediate value and we observe the final value on port 1.

    2)MUL:-this instruction is used to multiply 2 operands. the 1 operand should be inaccumulator and 2 in the other register.

    47

  • 8/3/2019 Two Months Industrial Training

    48/76

    eg.MOV R0,#20MOV A,#10MUL ABMOV P1,A

    Here,# is used to load immediate value and we observe the final value on port 1.

    3)DIV:- this instruction is used to divide 2 operands. the 1 operand should be inaccumulator and 2 in the other register.

    eg.MOV R0,#20MOV A,#10DIV ABMOV P1,A

    Here,# is used to load immediate value and we observe the final value on port 1.

    logical instructions: Apart from the input/output instructions ,logic instructions are someof the most widely used instructions.the logical instructions are used to perform logicaloperations likeAND,OR,EXOR etc.

    1). MOV A,#35H ;A=35HANL A,#0FH ;A AND 0FH(now A=05)

    According to this operation, the content 35H gets ANDing with 0FH.

    2). MOV A,#04 ;A=04ORL A,#30H ;A=A OR 30H(now A=34H)

    According to this operation, the content 35H gets ANDing with 0FH.

    Jump,loop,call instructions:the Jump,loop,call instructions are used to perform logical

    operations in the sequence of instructions to be executed ,it is often necessary to transferprogram control to a different location.

    48

  • 8/3/2019 Two Months Industrial Training

    49/76

    We have used high level language for microcontroller programming due to its givenadvantages over assembly:

    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 humansthink.

    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 thismethod. But it results in wastage of machine cycles of the micro-controller.

    2) INTERRUPTS: Here every device tells the micro-controller when it needs theservices from microcontroller.

    49

  • 8/3/2019 Two Months Industrial Training

    50/76

    Actually, only 5 interrupts are available to the user in the 8051, but many manufacturersdata sheets state that there are 6 interrupts since they include reset. The 6 interrupts in the8051 are allocated as follows:

    1).Reset: when the reset pin is activated, the 8051 jumps to address location 0000.this isthe 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 interruptvector table belong to timer0 and timer1, respectively.

    3).Two interrupts are set aside for hardware external hardware interrupts. Pin numbers12(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, automobilesand appliances. It allows the isolation of two separate sections of a system with twodifferent voltage sources. The electromechanical (or electromagnetic) relay (EMR) has 3components: the coil, spring and contacts. When current flows through the coil, a magneticfield is created around the coil (the coil is energized) which causes the armature to beattracted 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 orclosed.

    In choosing a relay, the following characteristics need to be considered:

    1) The contacts can be normally open (NO) or normally closed (NC). Inthe 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.

    2) There can be one or more contacts (SPST, SPDT, DPDT relays).3) 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 fewmA to 20mA. The relay has a minimum voltage below which the coilwill not be energized. This minimum voltage is called the pull-involtage.

    50

  • 8/3/2019 Two Months Industrial Training

    51/76

    INTERFACING OF VARIOUS DEVICES

    1) LED Interfacing

    H a r d w a r e i n t e r f a c i n g o f L E D w i t h A T 8 9 s 8 2 5

    T i t l e

    S i z eD o c u m e n t N u m b e r R e v

    D a t e : S h e e t o f

    < D o c > < R e

    < T i t l e >

    C u s t o m

    1 1T u e s d a y , D e c e m b e r 2 6 , 2

    Q 2 1

    B C 5 4 7 A

    Q 1 4B C 5 4 7 A

    D 2 6

    L E D

    V C C

    R 4 0

    3 3 0 E

    D 2 7

    L E D

    V C C

    R 4 1

    3 3 0 E

    V C C

    D 2 8

    L E D

    R 6 1

    3 3 0 E

    D 2 9

    L E D

    R 6 2

    3 3 0 E

    V C C

    Q 1 5

    B C 5 4 7 A

    D 2 2

    L E D

    R 3 7

    3 3 0 E

    V C C

    Q 1 6

    B C 5 4 7 A

    Q 1 7

    B C 5 4 7 A

    Q 1 8

    B C 5 4 7 A

    D 2 3

    L E D

    V C C

    R 3 8

    3 3 0 E

    Q 1 9

    B C 5 4 7 AD 2 4

    L E D

    V C C

    R 3 9

    3 3 0 E

    D 2 5

    L E D

    R 6 3

    3 3 0 E

    V C C

    Q 2 0

    B C 5 4 7 A

    U 1 0

    A T 8 9 S 8 2 5 2

    R S T9

    X T A L 21 8 X T A L 11 9

    G

    N

    D

    2

    0

    P S E N2 9

    A L E / P R O G3 0

    E

    A

    /V

    P

    P

    3

    1

    V

    C

    C

    4

    0

    P 1 . 0 / T 21

    P 1 . 1 / T 2 - E X2

    P 1 . 23

    P 1 . 34

    P 1 . 4 / S S5

    P 1 . 5 / M O S I6

    P 1 . 6 / M I S O7

    P 1 . 7 / S C K8

    P 2 . 0 / A 82 1

    P 2 . 1 / A 92 2

    P 2 . 2 / A 1 02 3

    P 2 . 3 / A 1 12 4

    P 2 . 4 / A 1 22 5P 2 . 5 / A 1 3

    2 6

    P 2 . 6 / A 1 42 7

    P 2 . 7 / A 1 52 8

    P 3 . 0 / R X D1 0P 3 . 1 / T X D1 1

    P 3 . 2 / I N T 01 2

    P 3 . 3 / I N T 11 3

    P 3 . 4 / T 01 4

    P 3 . 5 / T 11 5

    P 3 . 6 / W R1 6P 3 . 7 / R D1 7

    P 0 . 0 / A D 03 9

    P 0 . 1 / A D 13 8

    P 0 . 2 / A D 23 7

    P 0 . 3 / A D 33 6

    P 0 . 4 / A D 43 5

    P 0 . 5 / A D 53 4

    P 0 . 6 / A D 63 3

    P 0 . 7 / A D 73 2

    C 4 53 3 p F

    C 4 63 3 p F

    Y 8

    8 M h z

    1

    2

    3

    4

    V C CV C C

    R 71 0 K

    C 4 71 0 u F / 1 6 V

    V C C

    C 4 81 0 4

    51

  • 8/3/2019 Two Months Industrial Training

    52/76

    C code for Blinking LEDs connected on PORT2:

    #includevoid delay(unsigned int i);

    void main(void)

    {

    While(1){P2=0x00;Delay(0xffff);P2=0x00;Delay(0xff);}}void delay(unsigned int i)

    {while(i!=0){i--;}}

    C code for running LED connected on PORT2:

    #includevoid delay(unsigned int i);void main (){P0=0x00;while (1){delay(0xffff);P2_0=1;delay(0xffff);P2_0=0;P2_1=1;delay(0xffff);P2_1=0;P2_2=1;

    52

  • 8/3/2019 Two Months Industrial Training

    53/76

    delay(0xffff);P2_2=0;P2_3=1;delay(0xffff);P2_3=0;P2_4=1;

    delay(0xffff);P2_4=0;P2_5=1;delay(0xffff);P2_5=0;P2_6=1;delay(0xffff);P2_6=0;P2_7=1;delay(0xffff);P2_7=0;P2_0=1

    }}

    void delay(unsigned int i){while (i!=0)

    {i--;}}

    2) Hardware interfacing of LCD(JHD162A):

    On most displays, the pins are numbered on the LCDs printed circuit board, but if not, it is

    quit easy to locate pin1. Since the pin is connected to ground, it often has a thicker PCB

    track connected to it, and it is generally connected to the metal work at some point.

    53

  • 8/3/2019 Two Months Industrial Training

    54/76

    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. A preset potentiometer connected betweenthe power supply lines, with its wiper connected to the contrast pin is suitable in many cases,

    but be aware that some modules may require a

    negative potential; as low as 7V in some cases. For absolute simplicity, connecting this pin to

    0V will often suffice.

    Pin 4 is register select (RS) line.

    PIN NO. NAME FUNCTION1 Vss Ground2 Vdd +ve supply3 Vee contrast

    54

  • 8/3/2019 Two Months Industrial Training

    55/76

    4 RS Register select5 R/W Read/Write6 E Enable7 D0 Data Bit 08 D1 Data Bit 19 D2 Data Bit 2

    10 D3 Data Bit 311 D4 Data Bit 412 D5 Data Bit 513 D6 Data Bit 614 D7 Data Bit 7

    Three command control inputs. When this line is low, data bytes transferred to thedisplay are treated as commands, and data bytes read from the display indicate itsstatus. By setting the RS line high, character data can be transferred to and from the

    module.

    Pin 5 is (R/W) line. This line is pulled low in order to write commands or character datato the module, or pulled high to read character data or status information from itsregisters.

    Pin 6 is Enable (E) line. This input is used to initiate the actual transfer of commands orcharacter data between the module and the data lines. When writing to the display, datais transferred only on the high to low transition of this signal. However, when readingfrom the display, data will become available shortly after the low to high transition andremain available until the signal falls low again.

    Pins 7 to 14 are the eight data bus lines (D0 to D7). Data can be transferred to and fromthe display, either as a single 8-bit byte or as two 4-bit nibbles. In the latter case, onlythe upper four data lines (D4 to D7) are used. This $-bit mode is beneficial when usinga microcontroller, as fewer I/O lines are required.

    55

  • 8/3/2019 Two Months Industrial Training

    56/76

    U 1

    A T 8 9 S 5 2

    R S T9

    X T A L 21 8 X T A L 11 9

    G

    N

    D

    2

    0

    P S E N2 9

    A L E / P R O G3 0

    E

    A

    /V

    P

    P

    3

    1

    V

    C

    C

    4

    0

    P 1 . 0 / T 21

    P 1 . 1 / T 2 - E X2

    P 1 . 23

    P 1 . 34

    P 1 . 4 / S S5

    P 1 . 5 / M O S I6

    P 1 . 6 / M I S O7

    P 1 . 7 / S C K8

    P 2 . 0 / A 82 1

    P 2 . 1 / A 92 2

    P 2 . 2 / A 1 02 3

    P 2 . 3 / A 1 12 4

    P 2 . 4 / A 1 22 5

    P 2 . 5 / A 1 32 6

    P 2 . 6 / A 1 42 7

    P 2 . 7 / A 1 52 8

    P 3 . 0 / R X D1 0

    P 3 . 1 / T X D1 1

    P 3 . 2 / I N T 01 2

    P 3 . 3 / I N T 11 3

    P 3 . 4 / T 01 4

    P 3 . 5 / T 11 5

    P 3 . 6 / W R1 6

    P 3 . 7 / R D1 7

    P 0 . 0 / A D 03 9 P 0 . 1 / A D 13 8 P 0 . 2 / A D 23 7 P 0 . 3 / A D 33 6

    P 0 . 4 / A D 43 5 P 0 . 5 / A D 53 4 P 0 . 6 / A D 63 3 P 0 . 7 / A D 73 2

    J 2 L C D

    1 2 3 4 5 6 7 8 9

    1

    0

    1

    1

    1

    2

    1

    3

    1

    4

    1

    5

    1

    6

    C 13 3 p F

    C 23 3 p F

    Y 1

    1

    2

    3

    4

    R 11 0 K

    C 31 0 u F 1 6 V

    V C C

    V

    C

    C R 5 2

    5 6 E

    V

    C

    C

    V C C

    RS

    H a r d w a r e i n t e t r f a c i n g o f L C D w i t h

    EN

    C code for LCD display

    #include #define LCDPRT P1#define RS P3_3#define EN P3_4

    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 main(void){init_lcd();

    56

  • 8/3/2019 Two Months Industrial Training

    57/76

    while(1)

    {cursor_position(0x01);display('N');cursor_position(0x02);

    display('E');cursor_position(0x03);display('T');cursor_position(0x04);display('M');cursor_position(0x05);display('A');cursor_position(0x06);display('X');

    }

    }

    void delay (unsigned int i){while (i!=0){i--;

    }}

    void lcd_cmd(unsigned char a){wait();LCDPRT=a;RS=0;EN=1;EN=0;}void display(unsigned char b){

    wait ();LCDPRT=b;RS=1;EN=1;

    57

  • 8/3/2019 Two Months Industrial Training

    58/76

    EN=0;}void wait(void){unsigned int count=300;while(count!=0)

    {count--;}

    }

    void Init_lcd(void){lcd_cmd(0x3c);lcd_cmd(0x0c);lcd_cmd(0x06);lcd_cmd(0x01);

    }void clear_lcd(void){lcd_cmd(0x01);}

    void cursor_position(unsigned char c){lcd_cmd(c+0x80);}

    C code for string display on LCD:

    #include#define LCDPRT P1#define RS P3_3#define EN P3_4code unsigned char name_arry[]={"NETMAX$"};void display_string(unsigned char *sp);void lcd_cmd(unsigned char a);void display(unsigned char b);void wait(void);void Init_lcd(void);

    58

  • 8/3/2019 Two Months Industrial Training

    59/76

    void cursor_position(unsigned char c);

    void main(void){Init_lcd();cursor_position(0x40);

    display_string(&name_arry);

    }

    void display_string(unsigned char *sp)

    {while(*sp!='$')

    {

    display(*sp);

    sp=sp+1;}

    }

    void lcd_cmd(unsigned char a)

    {wait ();LCDPRT=a;RS=0;EN=1;EN=0;}void display(unsigned char b){wait ();LCDPRT=b;RS=1;EN=1;EN=0;}void wait(void){unsigned int count=300;

    59

  • 8/3/2019 Two Months Industrial Training

    60/76

    while(count!=0){count--;}

    }void Init_lcd(void)

    {lcd_cmd(0x3c);lcd_cmd(0x0c);lcd_cmd(0x06);

    lcd_cmd(0x01);}void cursor_position(unsigned char c){lcd_cmd(c+0x80);}

    3) ADC-0804 interfacing with AT89s52:

    The ADC0804 family is CMOS 8-Bit, successive-approximation A/D converters

    which use a modified potentiometer ladder and are designed to operate with the

    8080A control bus via three-state outputs. These converters appear to the

    processor as memory locations or I/O ports, and hence no interfacing logic is

    required. The differential analog voltage input has good common mode- rejection

    and permits offsetting the analog zero-input voltage value. In addition, the voltage

    reference input can be adjusted to allow encoding any smaller analog voltage span

    to the full 8 bits of resolution.

    Features

    80C48 and 80C80/85 Bus Compatible - No Interfacing Logic Required

    Conversion Time < 100s

    Easy Interface to Most Microprocessors

    Differential Analog Voltage Inputs

    60

  • 8/3/2019 Two Months Industrial Training

    61/76

    TTL Compatible Inputs and Outputs

    On-Chip Clock Generator

    0V to 5V Analog Voltage Input Range (Single + 5V Supply)

    No Zero-Adjust Required

    PIN DIAGRAM

    61

  • 8/3/2019 Two Months Industrial Training

    62/76

    Hardware interfacing of ADC-0804 for Temperature monitoring

    R 21 0 K

    C 6

    1 0 u F 1 6 V

    V C C

    C 1 31 0 4

    E O C

    S O C

    V C C

    C 1 41 u f /

    R 6

    2 2 0 E

    U 4A D C 0 8 0 4

    + I N6

    - I N7

    A

    G

    N

    D

    8

    V R E F / 2

    9

    G

    N

    D

    1

    0

    D B 71 1 D B 61 2 D B 51 3 D B 41 4 D B 3

    1 5 D B 21 6 D B 11 7 D B 01 8

    C L K R1 9

    V

    C

    C

    /V

    R

    E

    F

    2

    0

    C L K I N4

    I N T R5

    C S1

    R D2

    W R3

    V C C

    R 51 0 K

    R 1 7

    1 0 K

    C 7

    1 5 0 p F

    U 2 1T L 4 3 1

    2

    3

    1

    C 81 u f / 1 6 v

    C 9C A P

    R SE N

    L C D

    C O N 1 6 _ 0

    1 2 3 4 5 6 7 8 9

    1

    0

    1

    1

    1

    2

    1

    3

    1

    4

    1

    5

    1

    6

    V C CR S E N R 5 5

    5 6 E

    Temprature monitoring system

    U 2 2L M 3 5 / S O

    G N D3

    V C C1

    2

    O U T P U T

    R 5 3

    1 k

    V C C

    U 2

    A T 8 9 S 8 2 5 2

    R S T9

    X T A L 21 8 X T A L 11 9

    G

    N

    D

    2

    0

    P S E N2 9 A L E / P R O G3 0

    E

    A

    /V

    P

    P

    3

    1

    V

    C

    C

    4

    0

    P 1 . 0 / T 21

    P 1 . 1 / T 2 - E X2

    P 1 . 23

    P 1 . 34

    P 1 . 4 / S S5

    P 1 . 5 / M O S I6

    P 1 . 6 / M I S O7

    P 1 . 7 / S C K8

    P 2 . 0 / A 82 1

    P 2 . 1 / A 92 2

    P 2 . 2 / A 1 02 3

    P 2 . 3 / A 1 1

    2 4

    P 2 . 4 / A 1 22 5

    P 2 . 5 / A 1 32 6

    P 2 . 6 / A 1 42 7

    P 2 . 7 / A 1 52 8

    P 3 . 0 / R X D1 0

    P 3 . 1 / T X D1 1

    P 3 . 2 / I N T 01 2

    P 3 . 3 / I N T 11 3

    P 3 . 4 / T 01 4

    P 3 . 5 / T 11 5

    P 3 . 6 / W R1 6

    P 3 . 7 / R D1 7

    P 0 . 0 / A D 03 9 P 0 . 1 / A D 1

    3 8 P 0 . 2 / A D 23 7 P 0 . 3 / A D 33 6 P 0 . 4 / A D 43 5 P 0 . 5 / A D 53 4 P 0 . 6 / A D 63 3 P 0 . 7 / A D 73 2

    C 43 3 p F

    C 53 3 p F

    Y 2

    C R Y S T A L

    1

    2

    3

    4

    V C CV C C

    When interfacing is being done then gets lowered then only it allows the

    controller to read the data, otherwise controller can not read the data.

    is always grounded.

    is software controlled.

    C- code For temperature monitoring system

    #include #define LCDPRT P1#define RS P3_3#define EN P3_4#define SOC P3_2

    62

  • 8/3/2019 Two Months Industrial Training

    63/76

    #define EOC P3_5unsigned char read_adc(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 clear_lcd(void);void cursor_position(unsigned char c);

    void disp_dec(unsigned int digit);code unsigned char table[16]={'0','1','2','3','4','5','6','7','8','9'};

    void main(void){unsigned char e;P2=0xff;Init_lcd();while(1){cursor_position(0x00);e=read_adc();disp_dec(e);}

    }unsigned char read_adc(void)

    {unsigned char n;SOC=0;SOC=1;while(EOC==1){

    n=P2;}

    return n;}

    void delay (unsigned int i){while (i!=0){i--;}

    }

    63

  • 8/3/2019 Two Months Industrial Training

    64/76

    void lcd_cmd(unsigned char a){wait();LCDPRT=a;RS=0;EN=1;

    EN=0;}void display(unsigned char b){

    wait ();LCDPRT=b;RS=1;EN=1;EN=0;}void wait(void){unsigned int count=300;while(count!=0){count--;}

    }

    void Init_lcd(void){lcd_cmd(0x3c);lcd_cmd(0x0c);lcd_cmd(0x06);lcd_cmd(0x01);}

    void cursor_position(unsigned char c){lcd_cmd(c+0x80);}

    void disp_dec(unsigned int digit){

    64

  • 8/3/2019 Two Months Industrial Training

    65/76

    unsigned int temp;if(digit99 && digit

  • 8/3/2019 Two Months Industrial Training

    66/76

    C- code for serial transmission(from Microcontroller to PC)

    #includevoid Init_SPT(void);

    void transmit_serial(unsigned char a);void delay(unsigned int i);void main(void){Init_SPT();while(1){delay(0XFFFF);transmit_serial('N');delay(0XFFFF);

    transmit_serial('E');delay(0XFFFF);

    transmit_serial('T');delay(0XFFFF);

    transmit_serial('M');delay(0XFFFF);

    transmit_serial('A');delay(0XFFFF);

    transmit_serial('X');

    delay(0XFFFF);

    }

    }void Init_SPT(void){

    TMOD=0x20;

    TH1=0xfd;

    TR1=1;

    SCON=0x40;

    66

  • 8/3/2019 Two Months Industrial Training

    67/76

    }void transmit_serial(unsigned char a){SBUF=a;delay(500);TI=0;

    }void delay(unsigned int i){while(i!=0){i--;

    }}

    b)Serial Reception(From PC to microcontroller)

    J 3 L C D

    1 2 3 4 5 6 7 8 9

    1

    0

    1

    1

    1

    2

    1

    3

    1

    4

    1

    5

    1

    6

    V

    C

    C

    NETMAX

    R 5 4

    5 6 E

    V

    C

    C

    R S E N

    R SE N

    S P T T X D

    S P T R X D

    U 1 1

    A T 8 9 S 8 2 5 2

    R S T9

    X T A L 21 8 X T A L 11 9

    G

    N

    D

    2

    0

    P S E N2 9

    A L E / P R O G3 0

    E

    A

    /V

    P

    P

    3

    1

    V

    C

    C

    4

    0

    P 1 . 0 / T 21

    P 1 . 1 / T 2 - E X2

    P 1 . 23

    P 1 . 34

    P 1 . 4 / S S5

    P 1 . 5 / M O S I6

    P 1 . 6 / M I S O7

    P 1 . 7 / S C K8

    P 2 . 0 / A 82 1

    P 2 . 1 / A 92 2

    P 2 . 2 / A 1 02 3

    P 2 . 3 / A 1 12 4

    P 2 . 4 / A 1 22 5

    P 2 . 5 / A 1 32 6

    P 2 . 6 / A 1 42 7

    P 2 . 7 / A 1 52 8

    P 3 . 0 / R X D1 0P 3 . 1 / T X D1 1

    P 3 . 2 / I N T 01 2

    P 3 . 3 / I N T 11 3

    P 3 . 4 / T 01 4

    P 3 . 5 / T 11 5

    P 3 . 6 / W R1 6

    P 3 . 7 / R D1 7

    P 0 . 0 / A D 03 9 P 0 . 1 / A D 13 8

    P 0 . 2 / A D 23 7 P 0 . 3 / A D 33 6

    P 0 . 4 / A D 43 5 P 0 . 5 / A D 53 4 P 0 . 6 / A D 63 3

    P 0 . 7 / A D 73 2

    C 3 43 3 p F

    C 3 53 3 p F

    Y 9

    C R Y S T A L

    1

    2

    3

    4

    V C CV C C

    R 81 0 K

    C 4 91 0 u F 1 6 V

    V C C

    C 5 01 0 4

    C 5 11 0 U F / 1 6 V

    V C C

    C 5 21 0 U F / 1 6 V

    V C C

    C 5 31 0 U F / 1 6 V

    C 5 41 0 4

    C 5 51 0 U F / 1 6 V

    U 1 2

    M A X 2 3 2

    C 1 +1

    C 1 -3

    C 2 +4

    C 2 -5

    V

    C

    C

    1

    6

    G

    N

    D

    1

    5

    V +2

    V -6

    R 1 O U T1 2

    R 2 O U T9

    T 1 I N1 1

    T 2 I N1 0

    R 1 I N1 3

    R 2 I N8

    T 1 O U T1 4

    T 2 O U T7

    J 8

    S E R I A L P

    12

    3

    67

  • 8/3/2019 Two Months Industrial Training

    68/76

    C- code for serial reception:#include #define LCDPRT P1#define RS P3_3

    #define EN P3_4

    void Init_SPT(void);unsigned char receive_serial(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 clear_lcd(void);void cursor_position(unsigned char d);void disp_hex(unsigned char digit);void disp_dec(unsigned int digit);code unsigned char lkup_tbl01[16]={'0','1','2','3','4','5','6','7','8','9','A','B','C','D','E','F'};

    void main(void){

    unsigned char e;

    Init_lcd();Init_SPT();

    while(1){

    e=receive_serial();cursor_position(0x00);display(e);

    }

    }void Init_SPT(void){

    68

  • 8/3/2019 Two Months Industrial Training

    69/76

    PCON=PCON&0x7F;

    TMOD=TMOD&0x0F;

    TMOD=TMOD|0x20;

    TH1=0xfd;SCON=0X50;

    TR1=1;

    }

    void delay (unsigned int i){while (i!=0){i--;}

    }void lcd_cmd(unsigned char a){wait();

    LCDPRT=a;RS=0;EN=1;EN=0;}void display(unsigned char b){wait ();LCDPRT=b;RS=1;EN=1;EN=0;}void wait(void){unsigned int count=300;while(count!=0){

    69

  • 8/3/2019 Two Months Industrial Training

    70/76

    count--;}

    }

    void Init_lcd(void)

    {lcd_cmd(0x3c);lcd_cmd(0x0C);lcd_cmd(0x06);lcd_cmd(0x14);lcd_cmd(0x1C);lcd_cmd(0x01);

    }void cursor_position(unsigned char d){lcd_cmd(d+0x80);}

    Interfacing of seven segment display

    V C C

    R 1 92 2 0 E

    R 2 02 2 0 E

    R 2 12 2 0 E

    cR 2 42 2 0 E

    V C C

    R 2 52 2 0 E

    U 1 6

    A T 8 9 S 8 2 5 2

    R S T9

    X T A L 21 8 X T A L 11 9

    G

    N

    D

    2

    0

    P S E N2 9 A L E / P R O G3 0

    E

    A

    /V

    P

    P

    3

    1

    V

    C

    C

    4

    0

    P 1 . 0 / T 21

    P 1 . 1 / T 2 - E X2

    P 1 . 23

    P 1 . 34

    P 1 . 4 / S S5

    P 1 . 5 / M O S I6

    P 1 . 6 / M I S O7

    P 1 . 7 / S C K8

    P 2 . 0 / A 82 1

    P 2 . 1 / A 92 2

    P 2 . 2 / A 1 02 3

    P 2 . 3 / A 1 1

    2 4

    P 2 . 4 / A 1 22 5

    P 2 . 5 / A 1 32 6

    P 2 . 6 / A 1 42 7

    P 2 . 7 / A 1 52 8

    P 3 . 0 / R X D1 0P 3 . 1 / T X D1 1P 3 . 2 / I N T 01 2P 3 . 3 / I N T 11 3P 3 . 4 / T 01 4P 3 . 5 / T 11 5P 3 . 6 / W R1 6P 3 . 7 / R D1 7

    P 0 . 0 / A D 03 9

    P 0 . 1 / A D 13 8

    P 0 . 2 / A D 23 7

    P 0 . 3 / A D 33 6

    P 0 . 4 / A D 43 5

    P 0 . 5 / A D 53 4

    P 0 . 6 / A D 63 3

    P 0 . 7 / A D 73 2

    Y 3

    8 M h z

    1

    2

    3

    4

    V C CV C C

    R 3 42 2 0 E

    R 3 51 0 K S I P

    1

    23456789

    R 3 61 0 K

    C 4 81 0 u F / 1 6 V

    V C C

    P 0 1P 0 2P 0 3P 0 4P 0 5P 0 6P 0 7

    V C C

    P 0 8

    V C C

    d

    C 4 91 0 4

    V C CV C C

    V

    C

    C

    R 3 7

    1 0 k S I P

    1

    2345678

    e

    C 4 2

    3 3 P F

    C 4 33 3 P F

    U 37 4 L S 4 7

    D 07 D 11 D 22 D 36

    B I / R B O4

    R B I5

    L T3

    A1 3B1 2

    C1 1

    D1 0

    E9

    F1 5

    G1 4

    V

    C

    C

    1

    6

    G

    N

    D

    8

    U 1 2

    7 4 L S 4 7

    D 07 D 11 D 22 D 36

    B I / R B O4

    R B I5

    L T3

    A1 3B1 2

    C1 1D1 0E9

    F1 5

    G1 4

    V

    C

    C

    1

    6

    G

    N

    D

    8

    c

    V C C

    U 1

    D I P

    d

    2

    e

    1

    d

    7

    G

    /V

    3

    c

    4

    d

    ot

    5

    e

    6

    G

    /V

    8

    d

    ot

    9

    c

    1

    0

    b

    1

    1

    a

    1

    2

    G

    /v

    1

    3

    g

    1

    5

    b

    1

    6

    a

    1

    7

    G

    /V

    1

    8

    f

    1

    9

    g

    2

    0

    f

    1

    4

    V

    C

    C

    d

    R 1 32 2 0 E

    V C C

    R 3 2 2 0 E

    R 7 2 2 0 E

    R 1 1

    1 0 k S I P

    1

    2345678

    R 1 42 2 0 E

    R 8 2 2 0 E

    e

    R 9 2 2 0 ER 1 52 2 0 E

    R 1 62 2 0 E

    V C C

    70

  • 8/3/2019 Two Months Industrial Training

    71/76

    C code for seven segment display

    #include#define EOC P3_6

    #define SOC P3_7void delay(unsigned int i);unsigned char read_adc(void);void dec(unsigned int digit) ;void main (void){unsigned char a=0;P0=0x08;while(1){

    delay(0xffff);a=read_adc();dec(a);

    a++;delay(0xffff);dec(a);P0=1;

    delay(0xffff);

    P0=2;delay(0xffff);

    P0=3;

    delay(0xffff);P0=4;delay(0xffff);

    }

    }

    void delay(unsigned int i){while(i!=0){i--;

    71

  • 8/3/2019 Two Months Industrial Training

    72/76

    }}

    unsigned char read_adc(void){

    unsigned char n=0;SOC=0;

    SOC=1;while(EOC==1){n=P2;

    }return n;

    }

    void dec(unsigned int x){

    x=(x/10)*6+x;P0=x;

    }

    void bcdconv(unsigned int mb)

    {unsigned char x;unsigned char y;x=mb&0x0f;x=x|0x30;y=mb&0xf0;y=y>>4;y=y|0x30;display(y);display(x);}

    72

  • 8/3/2019 Two Months Industrial Training

    73/76

    6) 8051 Interrupt Programming

    C-code for handling of INT0 interrupt:

    #include

    void delay(unsigned int i){while(i!=0)i--;}void int0(void) interrupt 0{if(INT0==0){while(1){

    P0=0xF0;delay(0xFFFF);P0=0x0F;delay(0xFFFF);}}}void main(){EA=1;EX0=1;While(1){

    P0=0xFF;delay(0xFFFF);P0=0x00;delay(0xFFFF);}}

    73

  • 8/3/2019 Two Months Industrial Training

    74/76

    PRO JECT DETAILS

    Project Name: Home AutomationDescription and Working: The project is concerned about controlling theswitching (on or off) of various home appliances such as lights, fan, heater, etc usingAt89s8252 microcontroller. This microcontroller is programmed to work with thekeyboard of the computer using serial port communication.

    Serial communication uses a single data line instead of 8-bit data line ofparallel communication which makes it much cheaper. For serial datacommunication to work, the byte of data must be converted to serial bits using aparallel-in-serial-out shift register then it can be transmitted over a single data line.This also means that at the receiving end there must be a serial-in-parallel-out shiftregister to receive the serial data and pack them into a byte.

    The ASCII codes of the keys pressed from keyboard are sent to themicrocontroller. The MAX232 IC is used to convert the voltage levels of Computer inaccordance with the voltage levels of Microcontroller. The codes received by themicrocontroller are stored in SBUF (Serial Buffer). These codes are evaluated insidethe if-else statement and accordingly the pins (on any port) of microcontroller are

    made high or low. The relay corresponding to a HIGH pin is driven to makeconnection between pole and NO and the device connected to it is switched ONwhereas one corresponding to a LOW pin remains OFF.

    Using the configuration as:On pressing KEYBOARD 1: {device 1 ON} & {device 2 OFF}.

    KEYBOARD 2: {device 2 ON} & {device 1 OFF}.KEYBOARD 3: {BOTH DEVICE OFF}.KEYBOARD 4: {BOHT DEVICE ON}.

    So, we use the device configuration as 1 and 2, respectively.

    Block Diagram:

    Circuit Diagram:

    74

  • 8/3/2019 Two Months Industrial Training

    75/76

    Applications:

    The concept used in this project has a wide scope. It can be used to control a largenumber of appliances at a time through a Computer. All the devices of a home canbe connecte


Recommended