+ All Categories
Home > Documents > Industrial Automation Using i2c Protocol Documentation

Industrial Automation Using i2c Protocol Documentation

Date post: 09-Feb-2018
Category:
Upload: srinithi99
View: 220 times
Download: 0 times
Share this document with a friend

of 56

Transcript
  • 7/22/2019 Industrial Automation Using i2c Protocol Documentation

    1/56

    INDUSTRIAL AUTOMATION USING I2C PROTOCOL

    CHAPTER 1

    INTRODUCTION

    1

  • 7/22/2019 Industrial Automation Using i2c Protocol Documentation

    2/56

    INDUSTRIAL AUTOMATION USING I2C PROTOCOL

    1.1 MOTIVATION

    The motivation to our project INDUSTRIAL AUTOMATION USING I2C

    PROTOCOL is designed and implements multiple machines programmer. This project has

    three important modules; they are sensor, Microcontroller unit and Driver units of the machines.

    In this project fans, Lights and ! of the "ome or Industries are programmed to #$%#&& at the

    particular time. 'uch applications are motivated us to do the (roject successfully.

    1.2 STATEMENT OF PROBLEM

    $o) a day the automation field gets a )ide gro)th in the )orld )ide. *nder this concept

    here the project is developed. In this project the "ome or Industries, fans, lights and ! are

    controlled +y using I! !#MM*$I!TI#$. &or instance, if )ant to control one oven unit, it

    needs to set the schedule for the system at )hich time it )ant to s)itch #$%#&&. "ere the

    microcontroller follo)s the timing of the particular machine and control it. In this place the

    controller needs to )or- in real time to meet the dead line, other)ise the right ans)er +ecome

    )rong ans)er after the dead line.

    1.3 RELATED WORK

    To complete our project )e studied a+out (I! 1f/00 controller and its features. e

    also studied ho) to interface loads )ith (I! microcontroller, 2elays and 2elay Drivers. lso )e

    visited sites ho) stuff )or-s.com, ))).Microchip.com, ))).)i-ipedia.com.

    1.4 SCOPE OF WORK

    The project3 INDUSTRIAL AUTOMATION USING I2C PROTOCOL is used in

    scheduling the process of industrial machines and +y doing this the automation or automatic

    control over the loads )ere achieved.

    http://www.wikipedia.com/http://www.wikipedia.com/http://www.wikipedia.com/
  • 7/22/2019 Industrial Automation Using i2c Protocol Documentation

    3/56

    INDUSTRIAL AUTOMATION USING I2C PROTOCOL

    CHAPTER-2

    BACK GROUND INFORMATION

    4

  • 7/22/2019 Industrial Automation Using i2c Protocol Documentation

    4/56

    INDUSTRIAL AUTOMATION USING I2C PROTOCOL

    2.1 INTRODUCTION

    The project report descri+es the design Development and &a+rication of #ne demo unit

    of the project )or- INDUSTRIAL AUTOMATION USING I2C PROTOCOL3 +y using

    em+edded systems.

    $o) a day, )ith the advancement technology, particularly in the field of

    Microcontrollers, all the activities in our daily living have +ecome a part of Information

    technology and )e find microcontrollers in each and every application. Thus, trend is directing

    to)ards Microcontrollers +ased project )or-s. "o)ever, in this project )or- to program the

    #$%#&& timings different machines the microcontroller interacts )ith I! !#MM*$I!TI#$.

    Then the decisions are ta-en )ith the help of microcontroller and associated soft)are.

    The microcontroller +loc- is playing a major role in this project )or-. The micro

    controller chip used in this project )or- is (I! 1&/00 and this is li-e heart of the project )or-.

    The (I! 1&/00 microcontroller is a 567pin I!.

    The entire project )as developed in em+edded systems. system is something that maintains

    its e8istence and functions as a )hole through the interaction of its parts. 9.g. :ody, Man-ind,

    ccess !ontrol, etc system is a part of the )orld that a person or group of persons during some

    time interval and for some purpose choose to regard as a )hole, consisting of interrelated

    components, each component characteried +y properties that are selected as +eing relevant to the

    purpose.

    9m+edded 'ystem is a com+ination of hard)are and soft)are used to achieve a single

    specific tas-.

    9m+edded systems are computer systems that monitor, respond to, or control an e8ternal

    environment.

    9nvironment connected to systems through sensors, actuators and other I%# interfaces.

    9m+edded system must meet timing < other constraints imposed on it +y environment.

    n em+edded system is a microcontroller7+ased, soft)are driven, relia+le, real7time

    control system, autonomous, or human or net)or- interactive, operating on diverse

    physical varia+les and in diverse environments and sold into a competitive and cost

    conscious mar-et.

    5

  • 7/22/2019 Industrial Automation Using i2c Protocol Documentation

    5/56

    INDUSTRIAL AUTOMATION USING I2C PROTOCOL

    n em+edded system is not a computer system that is used primarily for processing, not a

    soft)are system on (! or *$I=, not a traditional +usiness or scientific application. "igh7end

    em+edded < lo)er end em+edded systems. "igh7end em+edded system 7 >enerally 4, 5 :it

    !ontrollers used )ith #'. 98amples (ersonal Digital ssistant and Mo+ile phones etc. Lo)er

    end em+edded systems 7 >enerally /, 1 :it !ontrollers used )ith a minimal operating systems

    and hard)are layout designed for the specific purpose. 98amples 'mall controllers and devices in

    our everyday life li-e ashing Machine, Micro)ave #vens, )here they are em+edded in.

    Microcontrollers are em+edded inside some other device so that they can control the

    features or actions of the project. nother name for a microcontroller therefore is 9m+edded

    !ontroller3. Microcontrollers are dedicated to one tas- and run one specific program. The

    program is stored in 2#M ?read only memory@ and generally does not change. Microcontrollers

    are often lo)7price devices.

    !oming to our project )henever the students standing in front of the door for entering in

    to the la+ is sensed +y the I2 sensor; this signal sends to controller through signal conditioning

    circuit. The controller ta-es it as an interrupt signal and gives control signal to the drive unit to

    open the door. 'ame li-e this in side la+ if any human +eing sensed +y the controller through I2

    transceiver it )ill further turn #$ the fans, !, lights using driver unit.

    2.2 PRELIMINARIES

    2.2.1 INTRODUCTION TO EMBEDDEDSYSTEMS

    9m+edded 'ystem is a com+ination of hard)are and soft)are used to achieve a single

    specific tas-. n em+edded system is a microcontroller7+ased, soft)are driven, relia+le, real7time

    control system, autonomous, or human or net)or- interactive, operating on diverse physical

    varia+les and in diverse environments and sold into a competitive and cost conscious mar-et.

    A

  • 7/22/2019 Industrial Automation Using i2c Protocol Documentation

    6/56

    INDUSTRIAL AUTOMATION USING I2C PROTOCOL

    BLOCK DIAGRAM FOR EMBEDDED SYSTEM

    FIGS 2.1 BLOCK DIAGRAM OF EMBEDDED SYSTEM

    CLASSIFICATION

    2eal Time 'ystems.

    2T' is one )hich has to respond to events )ithin a specified deadline.

    right ans)er after the dead line is a )rong ans)er

    RTS CLASSIFICATION

    "ard 2eal Time 'ystems

    'oft 2eal Time 'ystem

    HARD REAL TIME SYSTEM

    B"ardB real7time systems have very narro) response time.

    98ampleC $uclear po)er system, !ardiac pacema-er.

    SOFT REAL TIME SYSTEM

  • 7/22/2019 Industrial Automation Using i2c Protocol Documentation

    7/56

    INDUSTRIAL AUTOMATION USING I2C PROTOCOL

    B'oftB real7time systems have reduced constrains on

    BlatenessB +ut still must operate very uic-ly and repeata+le.

    98ampleC 2ail)ay reservation system E ta-es a fe) e8tra

    seconds the data remains valid.

    LANGUAGES USED

    !

    !FF

    Gava

    Linu8

    da

    ssem+ly

    MPLAB FEATURES

    M(L: Integrated Development 9nvironment ?ID9@ is a free, integrated toolset for the

    development of em+edded applications employing MicrochipHs (I! and ds(I!

    microcontrollers.

    M(L: Integrated Development 9nvironment ?ID9@ is a free, integrated toolset for the

    development of em+edded applications employing MicrochipHs (I! and ds(I!

    microcontrollers.

    M(L: ID9 runs as a 47+it application on M' indo)s, is easy to use and includes

    a host of free soft)are components for fast application development and super7charged

    de+ugging.

    M(L: ID9 also serves as a single, unified graphical user interface for additional

    Microchip and third party soft)are and hard)are development tools. Moving +et)een tools is a

    snap, and upgrading from the free soft)are simulator to hard)are de+ug and programming tools

    is done in a flash +ecause M(L: ID9 has the same user interface for all tools.

    M(L: ID9Js 'IM, high speed soft)are simulator for (I! and ds(I! ?Digital 'ignal

    (rocessing (I! Microcontroller@ devices )ith peripheral simulation, comple8 stimulus injection

    and register logging

    2.2.2 INTRODUCTION TO RELAYS

    0

  • 7/22/2019 Industrial Automation Using i2c Protocol Documentation

    8/56

    INDUSTRIAL AUTOMATION USING I2C PROTOCOL

    relay is usually an electromechanical device that is actuated +y an electrical current.

    The current flo)ing in one circuit causes the opening or closing of another circuit. 2elays are li-e

    remote control s)itches and are used in many applications +ecause of their relative simplicity,

    long life, and proven high relia+ility. 2elays are used in a )ide variety of applications throughout

    industry, such as in telephone e8changes, digital computers and automation systems. "ighly

    sophisticated relays are utilied to protect electric po)er systems against trou+le and po)er

    +lac-outs as )ell as to regulate and control the generation and distri+ution of po)er. In the home,

    relays are used in refrigerators, )ashing machines and dish)ashers, and heating and air7

    conditioning controls. lthough relays are generally associated )ith electrical circuitry, there are

    many other types, such as pneumatic and hydraulic. Input may +e electrical and output directly

    mechanical, or vice versa.

    2.2.3 I2C PROTOCOL:

    I! is a popular protocol and is supported +y many devices. This presentation ans)ers

    some uestions a+out I! and e8plains )ith a full e8ample ho) to connect a (I!micro M''(

    module to an 99(2#M. $e8t, )e )ill e8amine the use of I! on the (I!micro microcontroller.

    The details of ho) '(I is implemented on a (I!micro device )ill +e e8amined. e ill loo- at

    the M''( module, )hich is availa+le on a )ide selection of popular (I! microcontrollers. The

    )al-though )ill e8plore code for +oth )riting and reading a serial 99(2#M. The e8ample sends

    sample data to the 99(2#M, then reads +ac- the data and displays it. The code to do this loo-s

    rather long, +ut it is not comple8. e )ill +rea- the code do)n into smaller and easy to

    understand sections. &inally, there )ill +e a fe) resources given at the end of the presentation.

    These resources )ill allo) you to e8plore in more detail the I! interface.I! stands for Inter7

    Integrated !ircuit !ommunications.

    I! is implemented in the (I!micro +y a hard)are module called the Master

    'ynchronous 'erial (ort, -no)n as the M''( module . This module is +uilt into many different

    (I!micro devices. It allo)s I! serial communication +et)een t)o or more devices at a high

    speed and communicates )ith other (I!micro devices and many peripheral I!Js on the mar-et

    today.I! is a synchronous protocol that allo)s a master device to initiate communication )ith a

    slave device. Data is e8changed +et)een these devices. e )ill loo- at this more in detail as )e

    progress though this presentation. I! is also +i7directional. This is implemented +y an

    c-no)ledge3 system. The c-no)ledge3 system or !K3 system allo)s data to +e sent in

    one direction to one item on the I! +us, and then, that item )ill !K3 to indicate the data )as

    /

  • 7/22/2019 Industrial Automation Using i2c Protocol Documentation

    9/56

    INDUSTRIAL AUTOMATION USING I2C PROTOCOL

    received. e )ill loo- at this in detail later, as you can see, this is a po)erful feature of I!.

    'ince a peripheral can ac-no)ledge data, there is little confusion on )hether the data reached the

    peripheral and )hether it )as understood.

    I! is a synchronous protocol that allo)s a master device to initiate communication )ith

    a slave device. Data is e8changed +et)een these devices. 'ince I! is synchronous, it has a cloc-

    pulse along )ith the data. 2'4 and other asynchronous protocols do not use a cloc- pulse, +ut

    the data must +e timed very accurately. 'ince I! has a cloc- signal, the cloc- can vary )ithout

    disrupting the data. The data rate )ill simply change along )ith the changes in the cloc- rate.

    This ma-es I! ideal )hen the micro is +eing cloc-ed imprecisely, such as +y a 2! oscillator.

    I! is a Master7'lave protocol. $ormally, the master device controls the cloc- line, '!L.

    This line dictates the timing of all transfers on the I! +us. #ther devices can manipulate this

    line, +ut they can only force the line lo). This action means that item on the +us can not deal )ith

    more incoming data. :y forcing the line lo), it is impossi+le to cloc- more data in to any device.

    This is -no)n as !loc- 'tretching3. s stated earlier, no data )ill +e transferred unless the

    cloc- is manipulated. ll slaves are controlled +y the same cloc-, '!L. I! is a 'erial Interface

    and uses only the follo)ing t)o signals to serially e8change data )ith another deviceC

    'D 7 This signal is -no)n as 'erial Data. ny data sent from one device to another goes on this

    line.

    '!L 7 This is the 'erial !loc- signal. It is generated +y the master device and controls )hen data

    is sent and )hen it is read. s mentioned earlier, the signal can +e forced lo) so that no cloc- can

    occur. This is done +y a device that has +ecome too +usy to accept more data. I! lines can have

    only t)o possi+le electrical states. These states are -no)n as float high3 and drive lo)3. I!

    )or-s +y having a pull7up resistor on the line and only devices pull the line lo). If no device is

    pulling on the line, it )ill float high3. This is )hy pull7up resistors are important in I!. If no

    pull7up resistor )ere used, the line )ould float to an un-no)n state. If one tried to drive the line

    high, it might cause contention )ith a device trying to drive the line lo). This contention could

    damage the either or +oth devices driving the line. To prevent this, the pull7up7drive lo) system

    controls )hen one device has control of the +us. If another device tried to use the +us )hen it )as

    +usy, it )ould find the +us to +e driven lo) already and -no) it )as +usy. 9ven if it tried to use

    the +us accidentally, it )ould only drive it lo) and not damage other devices. LetJs no) discuss

    the data transfer element. The data +loc- represents the transfer of / +its of information. The data

    is sent on the 'D line and '!L produces a cloc-. The cloc- can +e aligned )ith the data to

    indicate )hether each +it is a 13 or a 63. Data on 'D is only considered valid )hen '!L is

  • 7/22/2019 Industrial Automation Using i2c Protocol Documentation

    10/56

    INDUSTRIAL AUTOMATION USING I2C PROTOCOL

    high. hen '!L is not high, the data is permitted to change. This is ho) the timing of each +it

    )or-s.

    The (I!micro microcontroller also can transmit data +ytes. To do so, )e load a +uffer

    )ith the +yte of data to send, tell it to send it and )ait for its completion. Data +ytes are used to

    transfer all -inds of information. hen communicating to another I! device, the / +its of data

    may +e a control code, an address or data. Many possi+ilities e8ist and they )ill +e discussed in

    detail in the manual for the device you are interfacing to. In this presentation )e )ill connect a

    serial 99(2#M to the +us and loo- at the signals involved. #ther I! devices )ill reuire similar

    signals, +ut may not +e identical. !hec- the device datasheet for the peripheral. Lastly )e )ill

    discuss theACK andNACK condition. device can !K3 or ac-no)ledge a transfer of each

    +yte +y +ringing the 'D line lo) during the thcloc- pulse of '!L.

    The +its of a transfer loo- li-e thisC / +its are cloc-ed out for the data, then during the

    th +it the item receiving the data gra+s the +us for one +it. If it drives this +it lo), then the

    device is signaling an !K3. #ther)ise, it it allo)s the 'D line to float high it is transmitting

    a $!K3. 2emem+er that the device must actively drive the +us lo) to send an !K, +ut a

    $!K could +e a passive response. This is one of the +enefits of I!.

    The I! engine sends data out on the I! +us using the !loc- ?'!L@ and Data ?'D@ lines for

    communication. The I! engine on the (I!micro device contains many registers )hich configure

    it as )ell as control its operation. The user has full access to these registers and )e )ill loo- at

    them later in this presentation.

    The I! engine on a peripheral is usually fairly transparent to the user. The data sheet on

    the peripheral )ill tell you ho) to use the peripheral +y telling you )hat commands must +e sent

    and ho) it )ill respond.

    ll / +its in this register are used for this I! mode and are the follo)ingC

    >!9$ 7 indicates >eneral !all 9$a+le3

    !K'TT 7 stands for !Kno)ledge +it 'TTus3

    !KDT 7 refers to the !Kno)ledge +it DaTa3

    !K9$ 7 controls the !Kno)lege 9$a+le3

    2!9$ 7 is the 2e!eive 9$a+le3

    (9$ 7 is the +it for sto( condition 9$a+le3

    29'9$ 7 is the control for a 2e'tart condition 9$a+le3

    '9$ 7 is the +it for 'tart condition 9$a+le3

    If &osc )ere 5 M", and ''(DD )ere ?decimal@, then lets calculate the I!

    speedC

    16

  • 7/22/2019 Industrial Automation Using i2c Protocol Documentation

    11/56

    INDUSTRIAL AUTOMATION USING I2C PROTOCOL

    !alculating the denominator first, )e add the ''(DD value of to 1 giving us 16.

    Then 16 is multiplied +y 5 to yield 56.

    5 M" divided +y 56 is 166 -" or 166 -+ps.

    11

  • 7/22/2019 Industrial Automation Using i2c Protocol Documentation

    12/56

    INDUSTRIAL AUTOMATION USING I2C PROTOCOL

    CHAPTER-3

    IMPORTANT APPROACHES TO THE PROECT

    1

  • 7/22/2019 Industrial Automation Using i2c Protocol Documentation

    13/56

    INDUSTRIAL AUTOMATION USING I2C PROTOCOL

    3.1 MICROCONTROLLER

    3.1.1 INTRODUCTION TO MICROCONTROLLER

    computer7on7a7chip is a variation of a microprocessor )hich com+ines the processor

    core ?!(*@, some memory, and I%# ?input%output@ lines, all on one chip. The computer7on7a7chip

    is called the microcomputer )hose proper meaning is a computer using a ?num+er of@

    microprocessor?s@ as its !(*s, )hile the concept of the microcomputer is -no)n to +e a

    microcontroller. microcontroller can +e vie)ed as a set of digital logic circuits integrated on a

    single silicon chip. This chip is used for only specific applications.

    Most microcontrollers do not reuire a su+stantial amount of time to learn ho) to

    efficiently program them, although many of them, )hich have uir-s, )hich you )ill have to

    understand +efore you, attempt to develop your first application.

    long )ith microcontrollers getting faster, smaller and more po)er efficient they are also

    getting more and more features. #ften, the first version of microcontroller )ill just have memory

    and digital I%#, +ut as the device family matures, more and more pat num+ers )ith varying

    features )ill +e availa+le.

    In this project )e used (I! 1f/00 microcontroller. &or most applications, )e )ill +e

    a+le to find a device )ithin the family that meets our specifications )ith a minimum of e8ternal

    devices, or an e8ternal +ut )hich )ill ma-e attaching e8ternal devices easier, +oth in terms of

    )iring and programming.

    3.1.2 MICRO CONTROLLER CORE FEATURES

    "igh7performance 2I'! !(*.

    #nly 4A single )ord instructions to learn.

    ll single cycle instructions e8cept for program +ranches )hich are t)o cycle.

    #perating speedC D! 7 6 M" cloc- input D! 7 66 ns instruction cycle.

    *p to /K 8 15 )ords of &L'" (rogram Memory, *p to 4/ 8 / +ytes of Data

    Memory ?2M@ *p to A 8 / +ytes of 99(2#M data memory.

    (in out compati+le to the (I!1!04:%05:%0%00

    Interrupt capa+ility ?up to 15 sources@

    9ight level deep hard)are stac-

    14

  • 7/22/2019 Industrial Automation Using i2c Protocol Documentation

    14/56

    INDUSTRIAL AUTOMATION USING I2C PROTOCOL

    Direct, indirect and relative addressing modes.

    (o)er7on 2eset ?(#2@.

    (o)er7up Timer ?(2T@ and #scillator 'tart7up Timer ?#'T@.

    atchdog Timer ?DT@ )ith its o)n on7chip 2! oscillator for relia+le operation.

    (rogramma+le code7protection.

    (o)er saving 'L99( mode.

    'electa+le oscillator options.

    Lo)7po)er, high7speed !M#' &L'"%99(2#M technology.

    &ully static design.

    In7!ircuit 'erial (rogramming ?I!'(@ .

    'ingle AN In7!ircuit 'erial (rogramming capa+ility.

    In7!ircuit De+ugging via t)o pins.

    (rocessor read%)rite access to program memory.

    ide operating voltage rangeC .6N to A.AN.

    "igh 'in-%'ource !urrentC A m.

    !ommercial and Industrial temperature ranges.

    Lo)7po)er consumption.

    3.1.3 ADVANTAGES OF USING A MICROCONTROLLER OVER MICROPROCESSOR

    A !"#$%&"' ($)) *#" + M$,',&'))"'

    >ather input from various sensors

    (rocess this input into a set of actions

    *se the output mechanisms on the Microcontroller to do something useful

    2M and 2#M are in+uilt in the M!.

    !heap compared to M(.

    Multi machine control is possi+le simultaneously.

    3.1.4 APPLICATIONS:

    !ell phones.

    !omputers.

    15

  • 7/22/2019 Industrial Automation Using i2c Protocol Documentation

    15/56

    INDUSTRIAL AUTOMATION USING I2C PROTOCOL

    2o+ots.

    Interfacing to t)o pcJs.

    3.2 PIC MICROCONTROLLER 1/F0A

    3.2.1 INTRODUCTION TO PIC MICROCONTROLLER 1/F0A

    The (I! 1f/00 microcontroller is a 567pin I!. The first pin of the controller is M!L2

    pin and the AN dc supply is given to this pin through 16KO resistor. This supply is also given to

    11thpin directly. The 1thpin of the controller is grounded. tan- circuit consists of a 5 M"P

    crystal oscillator and t)o pf capacitors is connected to 14 thand 15thpins of the (I!.

    3.2.2 FEATURES OF PIC MICROCONTROLLER 1/F0A

    #perating freuencyC D!76Mh.

    &lash program memory ?15 +it )ords@C/K

    Data memory ?in +ytes@C 4/

    99(2#M Data memory ?in +ytes@CA

    InterruptsC 1A

    I%o portsC , :, !, D, 9

    TimersC 4

    nalog comparatorsC

    InstructionsC 4A

    1A

  • 7/22/2019 Industrial Automation Using i2c Protocol Documentation

    16/56

    INDUSTRIAL AUTOMATION USING I2C PROTOCOL

    3.2.3 PIN DIAGRAM OF PIC 1/ F04A0A

    FIG 3.1 PIN DIAGRAM OF PIC 1/ F04A0A

    1

  • 7/22/2019 Industrial Automation Using i2c Protocol Documentation

    17/56

    INDUSTRIAL AUTOMATION USING I2C PROTOCOL

    3.2.4 FUNCTIONAL BLOCK DIAGRAM OF PIC 1/F0A

    FIG 3.2 PIN DIAGRAM OF PIC 1/F04A0A

    3.3 POWER SUPPLY UNIT

    CIRCUIT DIAGRAM

    10

  • 7/22/2019 Industrial Automation Using i2c Protocol Documentation

    18/56

    INDUSTRIAL AUTOMATION USING I2C PROTOCOL

    FIG 3.3 POWER SUPPLY UNIT

    POWER SUPPLY UNIT COSISTS OF FOLLOWING UNITS

    1@ 'tep do)n transformer

    @ 2ectifier unit

    4@ Input filter

    5@ 2egulator unit

    A@ #utput filter

    3.3.1 STEP DOWN TRANSFORMER

    The 'tep do)n Transformer is used to step do)n the main supply voltage from 46N !

    to lo)er value. This 46 ! voltage cannot +e used directly, thus it is stepped do)n. The

    Transformer consists of primary and secondary coils. To reduce or step do)n the voltage, the

    transformer is designed to contain less num+er of turns in its secondary core. The output from the

    secondary coil is also ! )aveform. Thus the conversion from ! to D! is essential. This

    conversion is achieved +y using the 2ectifier !ircuit%*nit.

    S" !(& '+'5"'#can step do)n incoming voltage, )hich ena+les you to have

    the correct voltage input for your electrical needs. &or e8ample, if our euipment has +een

    specified for input voltage of 1 volts, and the main po)er supply is 46 volts, )e )ill need a

    step down transformer, )hich decreases the incoming electrical voltage to +e compati+le )ith

    your 1 volt euipment.

    3.3.2 RECTIFIER UNIT

    The 2ectifier circuit is used to convert the ! voltage into its corresponding D! voltage.

    There are "alf7ave, &ull7ave and +ridge 2ectifiers availa+le for this specific function. The

    1/

  • 7/22/2019 Industrial Automation Using i2c Protocol Documentation

    19/56

    INDUSTRIAL AUTOMATION USING I2C PROTOCOL

    most important and simple device used in 2ectifier circuit is the diode. The simple function of the

    diode is to conduct )hen for)ard +iased and not to conduct in reverse +ias.

    B'$!%" '",$$"': +ridge rectifier ma-es use of four diodes in a +ridge arrangement to achieve

    full7)ave rectification. This is a )idely used configuration, +oth )ith individual diodes )ired assho)n and )ith single component +ridges )here the diode +ridge is )ired internally.

    !$!" 6'$!%" or 6'$!%" '",$$"' is an arrangement of four diodes in a +ridge

    configuration that provides the samepolarityof output voltagefor either polarity of input voltage.

    hen used in its most common application, for conversion of alternating current?!@ input into

    direct current?D!@ output, it is -no)n as a +ridge rectifier. +ridge rectifier provides full7)ave

    rectification from a t)o7)ire ! input, resulting in lo)er cost and )eight as compared to a

    center7tappedtransformerdesign.

    The &or)ard :ias is achieved +y connecting the diodeJs positive )ith positive of the

    +attery and negative )ith +atteryJs negative. The efficient circuit used is the &ull )ave :ridge

    rectifier circuit. The output voltage of the rectifier is in rippled form, the ripples from the

    o+tained D! voltage are removed using other circuits availa+le. The circuit used for removing the

    ripples is called &ilter circuit.

    3.3.3 INPUT FILTER

    !apacitors are used as filter. The ripples from the D! voltage are removed and pure D!

    voltage is o+tained. nd also these capacitors are used to reduce the harmonics of the input

    voltage. The primary action performed +y capacitor is charging and discharging. It charges in

    positive half cycle of the ! voltage and it )ill discharge in negative half cycle. 'o it allo)s only

    ! voltage and does not allo) the D! voltage. The 1666Qf capacitor serves as a BreservoirB

    1

    http://en.wikipedia.org/wiki/Diodehttp://en.wikipedia.org/wiki/Diodehttp://en.wikipedia.org/wiki/Bridge_circuithttp://en.wikipedia.org/wiki/Polarity_(physics)http://en.wikipedia.org/wiki/Volthttp://en.wikipedia.org/wiki/Alternating_currenthttp://en.wikipedia.org/wiki/Direct_currenthttp://en.wikipedia.org/wiki/Direct_currenthttp://en.wikipedia.org/wiki/Rectifierhttp://en.wikipedia.org/wiki/Rectifierhttp://en.wikipedia.org/wiki/Rectifierhttp://en.wikipedia.org/wiki/Rectifierhttp://en.wikipedia.org/wiki/Center_taphttp://en.wikipedia.org/wiki/Transformerhttp://en.wikipedia.org/wiki/Transformerhttp://en.wikipedia.org/wiki/Diodehttp://en.wikipedia.org/wiki/Bridge_circuithttp://en.wikipedia.org/wiki/Polarity_(physics)http://en.wikipedia.org/wiki/Volthttp://en.wikipedia.org/wiki/Alternating_currenthttp://en.wikipedia.org/wiki/Direct_currenthttp://en.wikipedia.org/wiki/Rectifierhttp://en.wikipedia.org/wiki/Rectifierhttp://en.wikipedia.org/wiki/Rectifierhttp://en.wikipedia.org/wiki/Center_taphttp://en.wikipedia.org/wiki/Transformer
  • 7/22/2019 Industrial Automation Using i2c Protocol Documentation

    20/56

    INDUSTRIAL AUTOMATION USING I2C PROTOCOL

    )hich maintains a reasona+le input voltage to the 0/6A throughout the entire cycle of the ac line

    voltage. The four rectifier diodes -eep recharging the reservoir capacitor on alternate half7cycles

    of the line voltage, and the capacitor is uite capa+le of sustaining any reasona+le load in +et)een

    charging pulses. This filter is fi8ed +efore the regulator. Thus the output is free from ripples.

    Input side the lo) pass filter has +een used.

    L( +## $)"':

    #ne simple electrical circuitthat )ill serve as a lo)7pass filter consists of a resistor in

    series )ith a load, and a capacitorin parallel )ith the load. The capacitor e8hi+its reactance, and

    +loc-s lo)7freuency signals, causing them to go through the load instead. t higher freuencies

    the reactance drops, and the capacitor effectively functions as a short circuit. The com+ination of

    resistance and capacitance gives you the time constantof the filter R SRC ?represented +y the

    >ree- letter tau@. The +rea- freuency, also called the turnover freuency or cutoff freuency?in

    hert@, is determined +y the time constantC or euivalently ?in radiansper second@C

    #ne )ay to understand this circuit is to focus on the time the capacitor ta-es to charge. It

    ta-es time to charge or discharge the capacitor through that resistorC

    t lo) freuencies, there is plenty of time for the capacitor to charge up to

    practically the same voltage as the input voltage.

    t high freuencies, the capacitor only has time to charge up a small amount

    +efore the input s)itches direction. The output goes up and do)n only a small fraction of the

    amount the input goes up and do)n. t dou+le the freuency, thereHs only time for it to charge up

    half the amount.

    6

    http://en.wikipedia.org/wiki/Electrical_circuithttp://en.wikipedia.org/wiki/Electrical_circuithttp://en.wikipedia.org/wiki/Resistorhttp://en.wikipedia.org/wiki/Resistorhttp://en.wikipedia.org/wiki/External_electric_loadhttp://en.wikipedia.org/wiki/Capacitorhttp://en.wikipedia.org/wiki/Capacitorhttp://en.wikipedia.org/wiki/Reactance_(electronics)http://en.wikipedia.org/wiki/Time_constanthttp://en.wikipedia.org/wiki/Time_constanthttp://en.wikipedia.org/wiki/Tauhttp://en.wikipedia.org/wiki/Cutoff_frequencyhttp://en.wikipedia.org/wiki/Radianshttp://en.wikipedia.org/wiki/Electrical_circuithttp://en.wikipedia.org/wiki/Resistorhttp://en.wikipedia.org/wiki/External_electric_loadhttp://en.wikipedia.org/wiki/Capacitorhttp://en.wikipedia.org/wiki/Reactance_(electronics)http://en.wikipedia.org/wiki/Time_constanthttp://en.wikipedia.org/wiki/Tauhttp://en.wikipedia.org/wiki/Cutoff_frequencyhttp://en.wikipedia.org/wiki/Radians
  • 7/22/2019 Industrial Automation Using i2c Protocol Documentation

    21/56

    INDUSTRIAL AUTOMATION USING I2C PROTOCOL

    3.3.4 REGULATOR UNIT

    FIG 3.4 078 REGULATOR

    2egulator regulates the output voltage to +e al)ays constant. The output voltage is

    maintained irrespective of the fluctuations in the input ! voltage. s and then the ! voltage

    changes, the D! voltage also changes. Thus to avoid this 2egulators are used. lso )hen the

    internal resistance of the po)er supply is greater than 46 ohms, the output gets affected. Thus this

    can +e successfully reduced here. Mean)hile it also contains current7limiting circuitry and

    thermal overload protection, so that the I! )onHt +e damaged in case of e8cessive load current; it

    )ill reduce its output voltage instead. The regulators are mainly classified for lo) voltage and for

    high voltage. &urther they can also +e classified asC

    1@ (ositive regulator

    Input pin

    >round pin

    #utput pin

    It regulates the positive voltage.

    @ $egative regulator

    >round pin

    Input pin

    #utput pin

    It regulates the negative voltage.

    1

  • 7/22/2019 Industrial Automation Using i2c Protocol Documentation

    22/56

    INDUSTRIAL AUTOMATION USING I2C PROTOCOL

    078 VOLTAGE REGULATOR:

    The 7805provides circuit designers )ith an easy )ay to regulate D! voltages to Av.

    9ncapsulated in a single chip%pac-age ?I!@, the 7805is a positive voltage D! regulatorthat has

    only 4 terminals. They areC Input voltage, >round, #utput Noltage.

    012 12V INTEGRATED CIRCUIT 3-TERMINAL POSITIVE VOLTAGE

    REGULATOR:

    The 0/1 fi8ed voltage regulator is a monolithic integrated circuit in a

    T#6 type pac-age designed for use in a )ide variety of applications

    including local, on+oard regulation. This regulator employs internal current

    limiting, thermal shutdo)n, and safe area compensation.

    ith adeuate heat7sin-ing it can deliver output currents in e8cess of 1.6

    ampere. lthough designed primarily as a fi8ed voltage regulator, thisdevice can +e used )ith e8ternal components to o+tain adjusta+le voltages

    and currents.

    3.3.8 OUTPUT FILTER

    The &ilter circuit is often fi8ed after the 2egulator circuit. !apacitor is most often used as

    filter. The principle of the capacitor is to charge and discharge. It charges during the positive half

    cycle of the ! voltage and discharges during the negative half cycle. The 16Qf and .61Qf

    capacitors serve to help -eep the po)er supply output voltage constant )hen load conditionschange. The electrolytic capacitor smoothJs out any long7term or lo) freuency variations.

    "o)ever, at high freuencies this capacitor is not very efficient. Therefore, the .61Qf is included

    to +ypass high7freuency changes, such as digital I! s)itching effects, to ground.

    3.4 LCD DISPLAY

    Liuid crystal display ?L!D@ has material )hich com+ines the properties of +oth liuid

    and crystals. They have a temperature range )ithin )hich the molecules are almost as mo+ile as

    they )ould +e in a liuid, +ut are grouped together in an order form similar to a crystal.

    LCD DISPLAY:

  • 7/22/2019 Industrial Automation Using i2c Protocol Documentation

    23/56

    INDUSTRIAL AUTOMATION USING I2C PROTOCOL

    More microcontroller devices are using Hsmart L!DH displays to output visual information. The

    follo)ing discussion covers the connection of a "itachi L!D display to a (I! microcontroller.

    L!D displays designed around "itachiHs L!D "D550/6 module, are ine8pensive, easy to use,

    and it is even possi+le to produce a readout using the / 8 /6 pi8els of the display. "itachi L!D

    displays have a standard '!II set of characters plus Gapanese, >ree- and mathematical sym+ols.

    &or an /7+it data +us, the display reuires a FAN supply plus 11 I%# lines. &or a 57+it data +us it

    only reuires the supply lines plus seven e8tra lines. hen the L!D display is not ena+led, data

    lines are tri7state )hich means they are in a state of high impedance ?as though they are

    disconnected@ and this means they do not interfere )ith the operation of the microcontroller )hen

    the display is not +eing addressed.

    The L!D also reuires 4 BcontrolB lines from the microcontroller.

    L%$, #+*# & ,&') )$&"#C

    9 6 ccess to L!D disa+led

    1 ccess to L!D ena+led

    2% 6 riting data to L!D

    4

    9na+le ?9@ This line allo)s access to the display through 2% and 2' lines. hen this line is

    lo), the L!D is disa+led and ignores signals from 2% and 2'. hen ?9@ line is

    high, the L!D chec-s the state of the t)o control lines and responds accordingly.

    2ead%rite ?2%@ This line determines the direction of data +et)een the L!D and microcontroller.

    hen it is lo), data is )ritten to the L!D. hen it is high, data is read from the

    L!D.

    2egister select ?2'@ ith the help of this line, the L!D interprets the type of data on data lines. hen it is

    lo), an instruction is +eing )ritten to the L!D. hen it is high, a character is +eing)ritten to the L!D.

  • 7/22/2019 Industrial Automation Using i2c Protocol Documentation

    24/56

    INDUSTRIAL AUTOMATION USING I2C PROTOCOL

    1 2eading data from L!D

    2' 6 Instruction

    1 !haracter

    riting data to the L!D is done in several stepsC

    'et 2% +it to lo)

    'et 2' +it to logic 6 or 1 ?instruction or character@

    'et data to data lines ?if it is )riting@

    'et 9 line to high

    'et 9 line to lo)

    2ead data from data lines ?if it is reading@.

    2eading data from the L!D is done in the same )ay, +ut control line 2% has to +e high. hen

    )e send a high to the L!D, it )ill reset and )ait for instructions. Typical instructions sent to

    L!D display after a reset areC turning on a display, turning on a cursor and )riting characters

    from left to right. hen the L!D is initialied, it is ready to continue receiving data or

    instructions. If it receives a character, it )ill )rite it on the display and move the cursor one space

    to the right. The !ursor mar-s the ne8t location )here a character )ill +e )ritten. hen )e )ant

    to )rite a string of characters, first )e need to set up the starting address, and then send one

    character at a time. !haracters that can +e sho)n on the display are stored in data display ?DD@

    2M. The sie of DD2M is /6 +ytes.

    The L!D display also possesses 5 +ytes of!haracter7>enerator ?!>@ 2M. This memory is

    used for characters defined +y the user. Data in !>

    2M is represented as an /7+it character +it7

    map. 9ach character ta-es up / +ytes of !> 2M,

    so the total num+er of characters, )hich the user

    can define, is eight. In order to read in the character

    +it7map to the L!D display, )e must first set the

    !> 2M address to starting point ?usually 6@, and

    then )rite data to the display. The definition of a

    HspecialH character is given in the picture.

    :efore )e access DD 2M after defining a special character, the program must set the DD 2M

    address. riting and reading data from any L!D memory is done from the last address )hich

    )as set up using set7address instruction. #nce the address of DD 2M is set, a ne) )ritten

    5

  • 7/22/2019 Industrial Automation Using i2c Protocol Documentation

    25/56

    INDUSTRIAL AUTOMATION USING I2C PROTOCOL

    character )ill +e displayed at the appropriate place on the screen. *ntil no) )e discussed the

    operation of )riting and reading to an L!D as if it )ere an ordinary memory. :ut this is not so.

    The L!D controller needs 56 to 16 microseconds ?u'@ for )riting and reading. #ther operations

    can ta-e up to A m'. during that time, the microcontroller cannot access the L!D, and so a

    program needs to -no) )hen the L!D is +usy. e can solve this in t)o )ays.

    #ne )ay is to chec- the :*' +it found on data line D0. This is not the +est method

    +ecause L!DHs can get stuc-, and program )ill then stay forever in a loop chec-ing the :*'

    +it. The other )ay is to introduce a delay in the program. The delay has to +e long enough for the

    L!D to finish the operation in process. Instructions for )riting to and reading from an L!D

    memorysho)n in the previous ta+le.t the +eginning )e mentioned that )e needed 11 I%# lines

    to communicate )ith an L!D. "o)ever, )e can communicate )ith an L!D through a /7+it data

    +us. The )iring for connection via a /7+it data +us is sho)n in the diagram +elo). In this

    e8ample )e use an L!D display )ith 81 characters, la+eled LM1=1 +y Gapanese ma-er

    '"2(.

    INTERFACING PIC MICROCONTROLLER TO LCDC

    A

  • 7/22/2019 Industrial Automation Using i2c Protocol Documentation

    26/56

    INDUSTRIAL AUTOMATION USING I2C PROTOCOL

    +

    L M 7 8 0 5

    1

    3

    2V I N

    G

    N

    D

    V O U T

    3 9

    2 7

    1 61 5

    1 31 1

    8

    7 8 1 2

    t r a n s f o r m e r+ 5 v

    3 4

    1 5

    1 1

    87

    O U T P U T

    1 0 3

    s t e p d o w n

    2 3 0 v

    2 8

    9

    6

    4

    1 N 4 0 0 7

    3 0

    43

    1 0 k

    1

    1 N 4 0 0 7

    3 2

    2 9

    2 2

    1 2

    3

    1 N 4 0 0 7

    P O T

    3 6

    3 1

    2 4

    1 2

    5

    3

    3 5

    2 6

    2 3

    1 0

    2 5

    1 3

    9

    2

    1 9

    6

    52

    L !1 0 0 0 u f

    2 1

    1

    2 0

    7

    1

    2 2 p f

    1 8

    1 4

    2

    5

    v

    2 2 p f

    3 8

    3 3

    1 7

    1 4

    4 " # $

    1 N 4 0 0 7

    4 0

    3 7

    1 0

    + 1 2 v

    P

    %

    %

    6

    f

    8

    7

    7

    &

    o display &ontC A 8 / dots

    o :uilt7in !ontrollerC"D550/6 or !omp

    o Input DataC5 :its or /7:its Interface

    o (o)er 'upplyC F5N 'ingle (o)er

    o Duty !ycleC 1%1 Duty

    3.8 RELAY DRIVER

  • 7/22/2019 Industrial Automation Using i2c Protocol Documentation

    27/56

    INDUSTRIAL AUTOMATION USING I2C PROTOCOL

    The *L$661, *L$66, *L$664 and *L$665are high Noltage, high current

    Darlington arrays each containing seven open collector Darlington pairs )ith common emitters.

    9ach channel rated at A66mand can )ithstand pea- currents of 66m.'uppressiondiodesare

    included for inductive load driving and the inputs are pinned opposite the outputs to simplify

    +oard layout.

    These versatile devices are useful for driving a )ide range of loads including solenoids,

    relays D! motors; L9D displays filament lamps, thermal print heads and high po)er +uffers. The

    *L$661%66%664 and 665 are supplied in 1pin plastic DI( pac-ages )ith a copper

    lead frame to reduce thermal resistance.

    They are availa+le also in small outline pac-age ?'#71@ as *L$661D%66D%664D%665D.

    3.8.1 FEATURES OF DRIVER

    '9N9$D2LI$>T#$' (92 (!K>9.

    #*T(*T !*229$T A66m (92 D2IN92 ?66m (9K@

    #*T(*T N#LT>9 A6N.

    I$T9>2T9D '*((29''I#$ DI#D9'

    I$D*!TIN9 L#D'.

    #*T(*T' !$ :9 (2LL9L9D

    "I>"92!*229$T.

    TTL%!M#'%(M#'%DTL!#M(TI:L9 I$(*T'.

    I$(*T' (I$$9D #((#'IT9 #*T(*T' T#

    'IM(LI&L#*T

    3.8.2 PIN CONNECTION

    0

  • 7/22/2019 Industrial Automation Using i2c Protocol Documentation

    28/56

    INDUSTRIAL AUTOMATION USING I2C PROTOCOL

    FIG 3.8PIN CONNECTIONS OF A RELAY

    3.8.3 RELAYS

    relay is usually an electromechanical device that is actuated +y an electrical current.

    The current flo)ing in one circuit causes the opening or closing of another circuit. 2elays are li-e

    remote control s)itches and are used in many applications +ecause of their relative simplicity,

    long life, and proven high relia+ility. 2elays are used in a )ide variety of applications throughout

    industry, such as in telephone e8changes, digital computers and automation systems. "ighlysophisticated relays are utilied to protect electric po)er systems against trou+le and po)er

    +lac-outs as )ell as to regulate and control the generation and distri+ution of po)er. In the home,

    relays are used in refrigerators, )ashing machines and dish)ashers, and heating and air7

    conditioning controls. lthough relays are generally associated )ith electrical circuitry, there are

    many other types, such as pneumatic and hydraulic. Input may +e electrical and output directly

    mechanical, or vice versa.

    ll relays contain a sensing unit, the electric coil, )hich is po)ered +y ! or D!

    current. hen the applied current or voltage e8ceeds a threshold value, the coil activates the

    armature, )hich operates either to close the open contacts or to open the closed contacts. hen a

    po)er is supplied to the coil, it generates a magnetic force that actuates the s)itch mechanism.

    The magnetic force is, in effect, relaying the action from one circuit to another. The first circuit is

    called the control circuit; the second is called the load circuit.

    /

  • 7/22/2019 Industrial Automation Using i2c Protocol Documentation

    29/56

    INDUSTRIAL AUTOMATION USING I2C PROTOCOL

    O&O C&'):98ampleC ir conditioning control, used to limit and control a high

    po)er3 load, such as a compressor Limit !ontrolC

    98ampleC Motor 'peed !ontrol, used to disconnect a motor if it runs slo)er or faster than

    the desired speed

    L%$, O"'+$&C 98ampleC Test 9uipment, used to connect the instrument to a num+er

    of testing points on the device under test.

    3.8.4 ELECTROMECHANICAL RELAYS

    In our project )e )ill +e using an electromechanical relay, )hich )ill +e a A pin relay

    and the )or-ing of the relay )ill +e li-e as. The general7purpose relay is rated +y the amount of

    current its s)itch contacts can handle. Most versions of the general7purpose relay have one to

    eight poles and can +e single or dou+le thro). These are found in computers, copy machines, and

    other consumer electronic euipment and appliances.

    FIG 3./ MECHANICAL RELAY

    3.8.4.1 INTERNAL OPERATION OF MECHANICAL RELAYS

    S+&!+'!C 'ingle 'ide 'ta+le )ith any of the follo)ing three different methods for

    closing contactsC

    1. F)"9*'" T"C The armature actuates the contact spring directly, and the contact is

    driven into a stationary contact, closing the circuit.

    . L$- T"C The movea+le piece is energied +y the armature, and the contact closes

  • 7/22/2019 Industrial Automation Using i2c Protocol Documentation

    30/56

    INDUSTRIAL AUTOMATION USING I2C PROTOCOL

    4. P)*&%"' T"C The lever action caused +y the energiation of the armature produces a

    long stro-e action. 2eedC 'ingle 'ide 'ta+le !ontact that involves lo) contact pressure and a

    simple contact point.

    5. P)+'$;"!C !an +e either a single side sta+le or dual7)inding. permanent magnet is

    used to either attract or repel the armature that controls the contact. definite polarity ?F or 7@ is

    reuired +y the relay coil. The latching option ma-es a polaried relay dual7)inding, meaning it

    remains in the current state after the coil is de7energied.

    3.8.8 LOAD TYPES

    Load parameters include the ma8imum permissi+le voltage and the ma8imum

    permissi+le current. The relay can handle +oth volts and amps. :oth the sie of the load and its

    type are important. There are four types of loadsC 1@ 2esistive, @ Inductive, 4@ ! or D!, and 5@

    "igh or Lo) Inrush

    3.8.8.1 RESISTIVE LOAD

    It is the one that primarily offers resistance to the flo) of current. 98amples of resistive

    loads include electric heaters, ranges and ovens, toasters and irons.

    3.8.8.2 INDUCTIVE LOADS

    It include po)er drills, electric mi8ers, fans, se)ing machines and vacuum cleaners.

    2elays that are going to +e su+jected to high7inrush inductive loads, such as an ! motor, )ill

    often +e rated in horsepo)er, rather than in volts and amps. This rating reflects the amount of

    po)er the relay contacts can handle at the moment the device is turned on ?or s)itched@.

    3.8.8.3 HIGH OR LOW IN RUSH

    'ome load types dra) significantly higher amounts of current ?amperage@ )hen first

    turned then they do )hen the circuit later sta+ilies ?loads may also pulsate as the circuit

    continues operating, thus increasing and decreasing the current@. n e8ample of a high inrush

    load is a light +ul+, )hich may dra) 16 or more times its normal operating current )hen first

    turned on ?some manufacturers refer to this as lamp load@.

    3.8.8.4 AC OR DC

    46

  • 7/22/2019 Industrial Automation Using i2c Protocol Documentation

    31/56

    INDUSTRIAL AUTOMATION USING I2C PROTOCOL

    This affects the contacts circuit of the relay ?due to 9M&@ and the timing seuencing. It

    may result in performance issues in the s)itching capacity of the relay for different load types

    ?I.e. resistive, inductive, etc.@.

    3./ TEMPERATURE SENSOR:

    F"+*'"#

    U !ali+rated directly in V !elsius ?!entigrade@

    U Linear F 16.6 mN%V! scale factor

    U 6.AV! accuracy guaranteea+le ?at FAV!@

    U 2ated for full 7AAV to F1A6V! range

    U 'uita+le for remote applications

    U Lo) cost due to )afer7level trimming

    U #perates from 5 to 46 volts

    U Less than 6 Q current drain

    U Lo) self7heating, 6.6/V! in still air

    U $onlinearity only WXV! typical

    U Lo) impedance output, 6.1 #hm for 1 m load

    T$,+) A)$,+$&

    G"&"'+) D"#,'$$&

    The LM4A series are precision integrated7circuit temperature sensors, )hose output voltage is

    linearly proportional to the !elsius ?!entigrade@ temperature. More...

    (2M9T2I! T:L9C

    Temperature ccuracy ?F%7@ 1, 6.A deg !

    'upply Min 5 Nolt

    Yuiescent !urrentZ A u

    Temperature Min 756, 6, 7AA deg !

    41

    http://www.national.com/mpf/LM/LM35.html#General%20Descriptionhttp://www.national.com/mpf/LM/LM35.html#General%20Description
  • 7/22/2019 Industrial Automation Using i2c Protocol Documentation

    32/56

    INDUSTRIAL AUTOMATION USING I2C PROTOCOL

    Temperature Ma8 166, 116, 1A6 deg !

    'ensor >ain 16 mN%Deg !

    'upply Ma8 46 Nolt

    'ingle 'upply $o

    #utput Impedance 6.5 #hm

    Yuiescent !urrent 6.6A m

    utomotive 'election >uide es

    G"&"'+) D"#,'$$&

    The LM4A series are precision integrated7circuit temperature sensors, )hose output voltage is

    linearly proportional to the !elsius ?!entigrade@ temperature. The LM4A thus has an advantage

    over linear temperature sensors cali+rated in V Kelvin, as the user is not reuired to su+tract a

    large constant voltage from its output to o+tain convenient !entigrade scaling. The LM4A does

    not reuire any e8ternal cali+ration or trimming to provide typical accuracies of WXV! at room

    temperature and W[V! over a full 7AA to F1A6V! temperature range. Lo) cost is assured +y

    trimming and cali+ration at the )afer level. The LM4AHs lo) output impedance, linear output, and

    precise inherent cali+ration ma-e interfacing to readout or control circuitry especially easy. It can

    +e used )ith single po)er supplies, or )ith plus and minus supplies. s it dra)s only 6 Q from

    its supply, it has very lo) self7heating, less than 6.1V! in still air. The LM4A is rated to operate

    over a 7AAV to F1A6V! temperature range, )hile the LM4A! is rated for a 756V to F116V! range ?7

    16V )ith improved accuracy@. The LM4A series is availa+le pac-aged in hermetic T#75

    transistor pac-ages, )hile the LM4A!, LM4A!, and LM4AD are also availa+le in the plastic

    T#7 transistor pac-age. The LM4AD is also availa+le in an /7lead surface mount small outline

    pac-age and a plastic T#76 pac-age.

    4

  • 7/22/2019 Industrial Automation Using i2c Protocol Documentation

    33/56

    INDUSTRIAL AUTOMATION USING I2C PROTOCOL

    CHAPTER-4

    DESCRIBING ABOUT PROECT IMPLEMENTATION

    44

  • 7/22/2019 Industrial Automation Using i2c Protocol Documentation

    34/56

    INDUSTRIAL AUTOMATION USING I2C PROTOCOL

    4.1 BLOCK DIAGRAME OF INDUSTRIAL AUTOMATION USING I2C PROTOCOL

    45

    LCD display

    Master

    PIC micro-controller

    Keypad

    Driver Unit

    Power supply

    Unit

    Human

    detection

    sensorDriver Unit

    Temperature

    sensor

    Slave

    PIC micro-controller 1

    Load or

    Equipment

    Slave

    PIC micro-controller 2

    I2C Protocol I2C Protocol

    Fan Light

    Alarm unit

  • 7/22/2019 Industrial Automation Using i2c Protocol Documentation

    35/56

    INDUSTRIAL AUTOMATION USING I2C PROTOCOL

    4.2 DESCRIPTION OF THE BLOCK DIAGRAM

    The entire project is po)ered )ith the po)er supply unit, the project it needs t)o

    different dc po)er supply one is F1v it is maintained through LM0/1 positive 1v regulator

    and one more dc FAv supply is maintained through LM0/6A positive Av regulator. The major

    parts of the project are I2 sensors , Driver circuits and Microcontrollers of (I!1&/00. "ere

    )e are using three (I! controllers, one is master and another t)o is slave.

    The t)o sensors are placed in t)o different places, and they are connected to the different

    controllers. hen any ma8imum temperature is finding +y the temperature sensor, it send the

    alert to the master controller. Then the controller )ill +lo) the +uer. hen any particle or

    human is finding +y the human detection sensor, second slave controller )ill send the alert to the

    master controller.

    In this project )e are going to design the hard)are circuit for industrial monitor )ith

    alarm in many rooms. "ere )e are using many sensors and only one controller )ith display unit.

    Display unit is used to display )hich one is found the human.

    4A

  • 7/22/2019 Industrial Automation Using i2c Protocol Documentation

    36/56

    INDUSTRIAL AUTOMATION USING I2C PROTOCOL

    4.3 CIRCUIT DIAGRAM

    +

    U 3

    L M 7 8 0 5

    1

    3

    2V I N

    G

    N

    D

    V O U T

    U 4

    1

    3

    2V I N

    G

    N

    D

    V O U T

    T R A N S F O R M E R

    ' T ( P ! O ) *

    L " 7 8 1 2

    + 1 2 v

    O U T P U T

    12

    34

    56

    78

    91 0

    1 11 2

    1 31 4

    1 51 6

    1 71 8

    1 9

    2 0

    40

    3938

    3736

    3534

    3332

    3130

    2928

    2726

    2524

    2322

    21

    P

    %

    1

    6

    +

    8

    7

    7

    &

    1 0,

    4 " # $

    2 2 p f2 2 p f

    L !

    1 2 9 1 03 4 5 6 1 1 1 2 13 1 4 15 1 67 8

    + 5v

    +5 v

    P OT

    1 0 3

    1 * 4 0 0 7

    1 * 4 0 0 7

    1 * 4 0 0 7

    1 * 4 0 0 7

    1 0 0 0 - f

    + 5 v + 5 v+5 v+ 5v

    ,1,2,3,4

    . U / / (

    +5 v

    U

    L

    *

    2

    0

    0

    3

    12345678 9

    1 01 11 21 31 31 41 51 6

    + 1 2 v

    & *

    * * O

    P

    %

    1

    6

    +

    8

    7

    7

    &

    2 2

    2 1

    18

    19

    20

    14

    15

    8

    9

    3 0

    2 9

    6

    7

    2 6

    2 5

    3 4

    3 3

    2 8

    2 7

    3 2

    3 1

    16

    17

    12

    13

    10

    11

    2

    34

    5

    1

    3 8

    3 7

    4 0

    3 9

    3 6

    3 5

    2 4

    2 3

    38

    37

    1

    22

    21

    18

    19

    20

    P

    %

    1

    6

    +

    8

    7

    7

    &

    24

    23

    14

    15

    30

    29

    36

    35

    28

    2726

    25

    8

    9

    40

    39

    16

    17

    6

    7

    10

    11

    32

    31

    4

    5

    12

    13

    34

    33

    2

    3

    + 5 v

    + 5 v

    L " 3 5

    + 5v

    5

    + 1 2 v

    *

    16

    L O & !

    *O1314

    8

    13

    79

    2 15

    U

    L

    *

    2

    0

    0

    3

    10

    1211

    4

    1

    6

    3

    L

    *O*

    + 5 v

    + 5 v

    +5 v

    + 5v

    % T & * ' " % T T (

    % ( ( % ( % ( ( % (

    +5 v

    +5 v

    % T & * ' " % T T (

    FIG 4.3 CIRCUIT DIAGRAM OF INDUSTRIAL AUTOMATION USING I2C

    PROTOCOL

    4

  • 7/22/2019 Industrial Automation Using i2c Protocol Documentation

    37/56

    INDUSTRIAL AUTOMATION USING I2C PROTOCOL

    4.4 POWER SUPPLY DIAGRAM

    FIG 4.3 POWER SUPPLY DIAGRAM

    4.8 CIRCUIT DESCRIPTION

    4.8.1 POWER SUPPLY

    (o)er supply unit consists of 'tep do)n transformer, 2ectifier, Input filter,

    2egulator unit, #utput filter.

    The 'tep do)n Transformer is used to step do)n the main supply voltage from

    46N ! to lo)er value. This 46 ! voltage cannot +e used directly, thus it is stepped do)n.

    The Transformer consists of primary and secondary coils. To reduce or step do)n the voltage, the

    transformer is designed to contain less num+er of turns in its secondary core. The output from the

    secondary coil is also ! )aveform. Thus the conversion from ! to D! is essential. This

    conversion is achieved +y using the 2ectifier !ircuit%*nit.

    The 2ectifier circuit is used to convert the ! voltage into its corresponding D!

    voltage. There are "alf7ave, &ull7ave and +ridge 2ectifiers availa+le for this specific

    function. The most important and simple device used in 2ectifier circuit is the diode. The simple

    function of the diode is to conduct )hen for)ard +iased and not to conduct in reverse +ias.

    The &or)ard :ias is achieved +y connecting the diodeJs positive )ith positive of the

    +attery and negative )ith +atteryJs negative. The efficient circuit used is the &ull )ave :ridge

    rectifier circuit. The output voltage of the rectifier is in rippled form, the ripples from the

    o+tained D! voltage are removed using other circuits availa+le. The circuit used for removing the

    ripples is called &ilter circuit.

    40

  • 7/22/2019 Industrial Automation Using i2c Protocol Documentation

    38/56

    INDUSTRIAL AUTOMATION USING I2C PROTOCOL

    !apacitors are used as filter. The ripples from the D! voltage are removed and pure

    D! voltage is o+tained. nd also these capacitors are used to reduce the harmonics of the input

    voltage. The primary action performed +y capacitor is charging and discharging. It charges in

    positive half cycle of the ! voltage and it )ill discharge in negative half cycle. "ere )e used

    1666Q& capacitor. 'o it allo)s only ! voltage and does not allo) the D! voltage. This filter is

    fi8ed +efore the regulator. Thus the output is free from ripples.

    2egulator regulates the output voltage to +e al)ays constant. The output voltage is

    maintained irrespective of the fluctuations in the input ! voltage. s and then the ! voltage

    changes, the D! voltage also changes. Thus to avoid this 2egulators are used. lso )hen the

    internal resistance of the po)er supply is greater than 46 ohms, the output gets affected. Thus this

    can +e successfully reduced here. The regulators are mainly classified for lo) voltage and for

    high voltage. "ere )e used 0/6A positive regulator. It reduces the N dc voltage to AN dc

    Noltage.

    The &ilter circuit is often fi8ed after the 2egulator circuit. !apacitor is most often

    used as filter. The principle of the capacitor is to charge and discharge. It charges during the

    positive half cycle of the ! voltage and discharges during the negative half cycle. 'o it allo)s

    only ! voltage and does not allo) the D! voltage. This filter is fi8ed after the 2egulator circuit

    to filter any of the possi+ly found ripples in the output received finally. "ere )e used 6.1Q&

    capacitor. The output at this stage is AN and is given to the Microcontroller

    In the po)er supply circuit t)o regulators are used. 0/6A regulator is used to

    produce positive AN dc and 0/1 regulator produces positive 1N dc voltage. 2elays and *L$

    664 drivers operates at 1N dc and microcontroller and sensors are operated at AN dc voltage.

    The output of the 0/6A regulator is connected to (I! 1f/00 microcontroller, sensors and the

    output of the 0/1 regulator is connected to driver I!s and relays.

    4.8.2 CONTROLLER CIRCUIT

    The (I! 1f/00 microcontroller is a 567pin I!. The first pin of the controller is

    M!L2 pin and the AN dc supply is given to this pin through 16KO resistor. This supply is also

    given to 11thpin directly. The 1thpin of the controller is grounded. tan- circuit consists of a 5

    M"P crystal oscillator and t)o pf capacitors are connected to 14 thand 15thpins of the (I!.

    The circuit consist one driver I! *L$ 664 is acts as voltage driver. It is a 17 pin I!.

    This is of $($ transistor type. nd this I! is a com+ination of 0 transistors. t a time )e can

    4/

  • 7/22/2019 Industrial Automation Using i2c Protocol Documentation

    39/56

    INDUSTRIAL AUTOMATION USING I2C PROTOCOL

    connect seven loads to each I!. In this project )e used relays and they connected to driver.

    These relays act as s)itches. The / thpin of driver I!s is grounded and the thpin is connected to

    1N dc voltage )hich is from 0/1 regulator.

    &irst to t)o pins of driver I! are connected to 2:6, 2:1 pins of the controller

    respectively. 'imilarly 1Ath, 1thpins are connected to 2elays 21 and 2, respectively. The relays

    used in this project are of 'ingle pole 'ingle thro) type.

    The 2elay Driver !ircuit is the main circuit that ena+les the actual control over the

    applications. s per the project designed, the 2elay Driver circuit signals the appliances to +e

    used if the user is valid or authenticated. "ere )e are using transistor as the relay driver circuit.

    2elay is connected )ith the transistor, )hich generally contains five pins totally. The first t)o

    pins are connected )ith the transistor and contain the magnetic coil )ound +et)een them. The

    rest of the pins are common point, $ormally #pen ?$#@ point and $ormally !lose ?$!@ point.

    Initially common point is in contact )ith $ormally !lose point. The magnetic coil also

    contains an arrangement very similar to that of a hoo-. hen supply is given at the supply point,

    the magnetic coil of the relay gets energied or activated. Due to this a magnetic field is created

    that lifts the hoo- up)ards. Thus the arrangement that )as initially closed gets opened no). The

    status of the relay point gets changed ?i.e. common point gets connected )ith normally open

    point@.

    The status of the relay is depends upon the conduction of the transistor. The transistor

    configuration used here is that of common emitter mode. The conduction of the transistor

    depends on the +ase voltage of the transistor. The supply to the transistor is given from the

    regulator of the po)er supply +oard. $ormally transistor acts as a s)itch. The s)itch then gets

    activated +y the Microcontroller.

    The output of the relay driver circuit is given to any of the port pins. The Microcontroller

    is programmed to respond corresponding to the relay signal o+tained. Thus the transistor acts as a

    s)itch to control the relay and indirectly controls the appliances. The -eys )ere connected in

    2:0, 2:, 2:A, and 2:5 pins of the microcontroller. The L!D display unit it contains 1 pinsthe 1th < th 7 t)o pins supply pins 1A th< 1thpin +ac-light pins, 4 rdpin +rightness adjustment

    pin, 5thpin 2'7reset pin, A thpin 2 pin ?read%)rite pin@ thpin 9$7ena+le pin these things are

    interfaced )ith microcontroller 2!1, 2!, 2!4 respectively and 0 thto 15thpin are connected in

    (2#TD of the microcontroller.

    4

  • 7/22/2019 Industrial Automation Using i2c Protocol Documentation

    40/56

    INDUSTRIAL AUTOMATION USING I2C PROTOCOL

    CHAPTER-8

    SOFTWARE RE

  • 7/22/2019 Industrial Automation Using i2c Protocol Documentation

    41/56

    INDUSTRIAL AUTOMATION USING I2C PROTOCOL

    SOFTWARE RE

  • 7/22/2019 Industrial Automation Using i2c Protocol Documentation

    42/56

    INDUSTRIAL AUTOMATION USING I2C PROTOCOL

    >eneral Motors, hirlpool, Yualcomm, Gohn Deere and many others, "I7T9!"Hs relia+le

    development tools and ! compilers, com+ined )ith )orld7class support have helped serious

    em+edded soft)are programmers to create hundreds of +rea-through ne) solutions.

    hichever em+edded processor family you are targeting )ith your soft)are, )hether it is

    the 2M, (I!! or /6A1 series, "I7T9!" tools and ! compilers can help you )rite +etter code

    and +ring it to mar-et faster.

    "I7T9!" (I!! is a high7performance ! compiler for the Microchip (I! micro

    16%1%15%1%10 series of microcontrollers. "I7T9!" (I!! is an industrial7strength $'I !

    compiler 7 not a su+set implementation li-e some other (I! compilers. The (I!! compiler

    implements full I'#%$'I !, )ith the e8ception of recursion. ll data types are supported

    including 5 and 4 +it I999 standard floating point. "I7T9!" (I!! ma-es full use of specific

    (I! features and using an intelligent optimier, can generate high7uality code easily rivalinghand7)ritten assem+ler. utomatic handling of page and +an- selection frees the programmer

    from the trivial details of assem+ler code.

    8.4 EMBEDDED C COMPILER

    $'I ! 7 full featured and porta+le

    2elia+le 7 mature, field7proven technology

    Multiple ! optimiation levels

    n optimiing assem+ler

    &ull lin-er, )ith overlaying of local varia+les to minimie 2M usage

    !omprehensive ! li+rary )ith all source code provided

    Includes support for 57+it and 47+it I999 floating point and 47+it long data types

    Mi8ed ! and assem+ler programming

    *nlimited num+er of source files

    Listings sho)ing generated assem+ler

    !ompati+le 7 integrates into the M(L: ID9, M(L: I!D and most 4rd7party

    development tools

    2uns on multiple platformsC indo)s, Linu8, *$I=, Mac #' =, 'olaris

    5

  • 7/22/2019 Industrial Automation Using i2c Protocol Documentation

    43/56

    INDUSTRIAL AUTOMATION USING I2C PROTOCOL

    8.8 EMBEDDED DEVELOPMENT ENVIRONMENT

    This environment allo)s you to manage all of your (I! projects. ou can compile,

    assem+le and lin- your em+edded application )ith a single step.

    #ptionally, the compiler may +e run directly from the command line, allo)ing you to

    compile, assem+le and lin- using one command. This ena+les the compiler to +e integrated into

    third party development environments, such as MicrochipHs M(L: ID9.

    8./ EMBEDDED SYSTEM TOOLS

    8./.1 ASSEMBLER

    n assem+ler is a computer programfor translating assem+ly language\ essentially, a

    mnemonicrepresentation of machine language\ into o+ject code. cross assem+ler ?see cross

    compiler@ produces code for one type of processor, +ut runs on another. The computational step

    )here an assem+ler is run is -no)n as assem+ly time. Translating assem+ly instruction

    mnemonics into opcodes, assem+lers provide the a+ility to use sym+olic names for memory

    locations ?saving tedious calculations and manually updating addresses )hen a program is

    slightly modified@, and macrofacilities for performing te8tual su+stitution \ typically used to

    encode common short seuences of instructions to run inline instead of in a su+routine.

    ssem+lers are far simpler to )rite than compilersfor high7level languages.

    8./.2 ASSEMBLY LANGUAGE HAS SEVERAL BENEFITS

    S""!C ssem+ly language programs are generally the fastest programs around.

    S+,"C ssem+ly language programs are often the smallest.

    C++6$)$:ou can do things in assem+ly )hich are difficult or impossi+le in "igh

    level languages.

    K&()"!%"C our -no)ledge of assem+ly language )ill help you )rite +etter programs,

    even )hen using "igh level languages. n e8ample of an assem+ler )e use in our project is 2D

    A1.

    8./.3 SIMULATOR

    'imulator is a machine that simulates an environment for the purpose of training or

    research. e use a *M(' simulator for this purpose in our project.

    54

    http://en.wikipedia.org/wiki/Computer_programhttp://en.wikipedia.org/wiki/Assembly_languagehttp://en.wikipedia.org/wiki/Mnemonichttp://en.wikipedia.org/wiki/Mnemonichttp://en.wikipedia.org/wiki/Machine_languagehttp://en.wikipedia.org/wiki/Machine_languagehttp://en.wikipedia.org/wiki/Object_codehttp://en.wikipedia.org/wiki/Object_codehttp://en.wikipedia.org/wiki/Cross_compilerhttp://en.wikipedia.org/wiki/Cross_compilerhttp://en.wikipedia.org/wiki/Opcodehttp://en.wikipedia.org/wiki/Macrohttp://en.wikipedia.org/wiki/Subroutinehttp://en.wikipedia.org/wiki/Subroutinehttp://en.wikipedia.org/wiki/Compilerhttp://en.wikipedia.org/wiki/High-level_languagehttp://en.wikipedia.org/wiki/High-level_languagehttp://en.wikipedia.org/wiki/Computer_programhttp://en.wikipedia.org/wiki/Assembly_languagehttp://en.wikipedia.org/wiki/Mnemonichttp://en.wikipedia.org/wiki/Machine_languagehttp://en.wikipedia.org/wiki/Object_codehttp://en.wikipedia.org/wiki/Cross_compilerhttp://en.wikipedia.org/wiki/Cross_compilerhttp://en.wikipedia.org/wiki/Opcodehttp://en.wikipedia.org/wiki/Macrohttp://en.wikipedia.org/wiki/Subroutinehttp://en.wikipedia.org/wiki/Compilerhttp://en.wikipedia.org/wiki/High-level_language
  • 7/22/2019 Industrial Automation Using i2c Protocol Documentation

    44/56

    INDUSTRIAL AUTOMATION USING I2C PROTOCOL

    8./.4COMPILER

    compiler is a program that reads a program in one language, the source language and

    translates into an euivalent program in another language, the target language. The translation

    process should also report the presence of errors in the source program.

    'ource (rogram ] !ompiler ]Target

    (rogram

    ^

    9rror

    Messages

    There are t)o parts of compilation. The analysis part +rea-s up the source program into

    constant piece and creates an intermediate representation of the source program. The synthesis

    part constructs the desired target program from the intermediate representation.

    8./.8 COUSINS OF THE COMPILER ARE

    1. (reprocessor.

    . ssem+ler.

    4. Loader and Lin-7editor.

    naive approach to that front end might run the phases serially.

    1. Le8ical analyer ta-es the source program as an input and produces a long string of

    to-ens.

    . 'ynta8 nalyer ta-es an out of le8ical analyer and produces a large tree.

    'emantic analyer ta-es the output of synta8 analyer and produces another tree.

    'imilarly, intermediate code generator ta-es a tree as an input produced +y semantic analyer and

    produces intermediate code

    8././ PHASES OF COMPILER

    The compiler has a num+er of phases plus sym+ol ta+le manager and an error handler.

    55

  • 7/22/2019 Industrial Automation Using i2c Protocol Documentation

    45/56

    INDUSTRIAL AUTOMATION USING I2C PROTOCOL

    Input 'ource

    (rogram

    ^

    Le8ical

    nalyer

    ^

    'ynta8

    nalyer

    ^

    'ym+ol

    Ta+le

    Manager

    'emantic

    nalyer

    9rror

    "andler

    ^

    Intermediate

    !ode >enerator

    ^

    !ode

    #ptimier

    ^

    !ode >enerator

    ^

    #ut Target

    (rogram

    FABRICATION DETAILS

    The fa+rication of one demonstration unit is carried out in the follo)ing seuence.

    &inaliing the total circuit diagram, listing out the components and sources of

    procurement.

    (rocuring the components, testing the components and screening the components.

    5A

  • 7/22/2019 Industrial Automation Using i2c Protocol Documentation

    46/56

    INDUSTRIAL AUTOMATION USING I2C PROTOCOL

    Ma-ing layout, repairing the interconnection diagram as per the circuit diagram.

    ssem+ling the components as per the component layout and circuit diagram and

    soldering components..

    8. COMPONENTS USED

    1. 'tep Do)n Transformer :? 46%1N@ E 1 $o.

    . Diodes :?1$5660@ E 5 $o

    4. !apacitors :1666Q& E 1 $o, p&7 $os

    5. 2egulators :0/1 E 1 $o, 0/6A E 1 $o

    A. Light 9mitting Diodes :L9D_s E $os

    . Driver I!s :*L$ 664 E 1$o

    0. (I! microcontroller :1f/00 E 1 $o

    /. 2elays :'ingle (ole 'ingle Thro) Type $os

    . !rystal #scillator :5M" E 1$os

    16. 2esistors :446 O E 1$os,16 KO7 A $o

    :1 KO E $os

    5

  • 7/22/2019 Industrial Automation Using i2c Protocol Documentation

    47/56

    INDUSTRIAL AUTOMATION USING I2C PROTOCOL

    CHAPTER-/

    RESULTS

    RESULT

    50

  • 7/22/2019 Industrial Automation Using i2c Protocol Documentation

    48/56

    INDUSTRIAL AUTOMATION USING I2C PROTOCOL

    5/

  • 7/22/2019 Industrial Automation Using i2c Protocol Documentation

    49/56

    INDUSTRIAL AUTOMATION USING I2C PROTOCOL

    CHAPTER-

    CONCLUSION

    .1 APPLICATIONS

    1. In comple8 +uildings

    . In te8tiles industries

    4. 9nergy management systems

    5

  • 7/22/2019 Industrial Automation Using i2c Protocol Documentation

    50/56

    INDUSTRIAL AUTOMATION USING I2C PROTOCOL

    5. In spinning mills

    .2 CONCLUSION

    The 'ystem operated successfully.

    .3 FUTURE SCOPE OF THE PROECT

    This project can +e enhanced in future to home and office automation and also to -no)

    ho) the euipments or mechinaries in the industry are )or-ing.

    A6

  • 7/22/2019 Industrial Automation Using i2c Protocol Documentation

    51/56

    INDUSTRIAL AUTOMATION USING I2C PROTOCOL

    CHAPTER-0

    BIBLIOGRAPHY

    BIBLIOGRAPHY

    BOOKS

    !ustomiing and programming ur pic microcontroller7 M" P'"!,

    !omplete guide to pic microcontroller 7"-6

    A1

  • 7/22/2019 Industrial Automation Using i2c Protocol Documentation

    52/56

    INDUSTRIAL AUTOMATION USING I2C PROTOCOL

    ! programming for em+edded systems- K$' *'"))

    Teach yourself electronics and electricity7 S+& G$6)$#,

    9m+edded Microcomputer system-&++& (.V+)+&2777

    9m+edded (I! microcontroller7 & P"+5+&

    WEB SITIES:

    Microchips.com

    httpC%%))).mi-roele-troni-a.co.yu%english%product%+oo-s%(I!+oo-%6Z*vod.htm

    ho) stuff )or-s.com

    APPENDI-A

    CODING:

    `includepic.hb

    A

    http://www.mikroelektronika.co.yu/english/product/books/PICbook/0_Uvod.htmhttp://www.mikroelektronika.co.yu/english/product/books/PICbook/0_Uvod.htm
  • 7/22/2019 Industrial Automation Using i2c Protocol Documentation

    53/56

    INDUSTRIAL AUTOMATION USING I2C PROTOCOL

    void delay?@;

    unsigned int iS6;

    signed int countS6;

    `define ir1 2:0

    `define ir 2:

    `define dcZfor 2D0

    `define dcZrev 2D

    `define light 2DA

    `define fan 2D5

    void main?@

    T2I'!S686;

    T2I'DS6866;

    T2I'S6866;

    T2I':S68&&;

    T2I'9S6866;

    (#2T!S6=66;

    (#2TDS6=66;

    (#2TS6=66;

    (#2T:S6=66;

    (#2T9S6=66;

    )hile?1@

    A4

  • 7/22/2019 Industrial Automation Using i2c Protocol Documentation

    54/56

    INDUSTRIAL AUTOMATION USING I2C PROTOCOL

    if?ir1SS1@

    dcZforS1;

    countFF;

    delay?@;

    delay?@;

    delay?@;

    dcZforS6;

    delay?@;

    dcZrevS1;

    delay?@;

    delay?@;

    delay?@;

    dcZrevS6;

    if?countbS1@

    if?irSS1@

    dcZforS1;

    count77;

    A5

  • 7/22/2019 Industrial Automation Using i2c Protocol Documentation

    55/56

    INDUSTRIAL AUTOMATION USING I2C PROTOCOL

    if?count S6@

    countS6;

    delay?@;

    delay?@;

    delay?@;

    dcZforS6;

    delay?@;

    dcZrevS1;

    delay?@;

    delay?@;

    delay?@;

    dcZrevS6;

    if?countSS6@

    fanS6;

    lightS6;

    if?countbS1@

    fanS1;

    AA

  • 7/22/2019 Industrial Automation Using i2c Protocol Documentation

    56/56

    INDUSTRIAL AUTOMATION USING I2C PROTOCOL

    lightS1;

    void delay?@

    for?iS6;iSA6666;iFF@;

    INSTALLING CODING INTO PIC MICROCONTROLLER

    1. rite the program in M(L: ID9.

    . 'ave the file as .c. and compile it.

    4. fter successful compilation of the coding close the M(L: ID9.

    5. &i8 the !ontroller I! into (I! &lash -it.

    A. Then clic- on Micro controller Micro 'ystems (I! &lash 'oft)are Icon on the des-top.

    . It displays on dialog +o8. Then select open and select the program )hich )e already

    saved as .c.0. Then it as-s the !onfirmation that The I! is empty, select o-.

    /. Then it as-s &uses 'ettings, select 9'

    . Then it displays &uses 'ettings Dialog :o8.

    16. In that put DT 77 b Disa+led, 2T77 b 9na+led, #scillator77 b =T then clic- on #K.

    11. Then it displays the (rogram successfully installed into (I!.

    1. Then 2emove the I! from the (I! &lash and it is ready for used into the project or circuit

    operation.


Recommended