Pic Project

download Pic Project

of 22

Transcript of Pic Project

  • 8/14/2019 Pic Project

    1/22

    REAL-TIME DATA ACQUISITION

    FROM TEMPERATURE AND

    LIGHT SENSORS

    Robin Jacob

  • 8/14/2019 Pic Project

    2/22

    Serial Peripheral Interface (SPI)

    SPI is a serial bus standard established by

    Motorola and supported in silicon products from

    various manufacturers. SPI interfaces are available on popular

    communication processors such as the MPC8260

    and microcontrollers such as the M68HC11.

    It is a synchronous serial data link that operates infull duplex (signals carrying data go in both

    directions simultaneously).

  • 8/14/2019 Pic Project

    3/22

    SPI

    Devices communicate using a master/slaverelationship, in which the master initiates the dataframe.

    When the master generates a clock and selects aslave device, data may be transferred in either or

    both directions simultaneously.

    In fact, as far as SPI is concerned, data are alwaystransferred in both directions.

    It is up to the master and slave devices to knowwhether a received byte is meaningful or not.

  • 8/14/2019 Pic Project

    4/22

    SPI

    A device must discard the received byte in a

    "transmit only" frame or generate a dummy

    byte for a "receive only" frame.

    Single master, single slave SPI implementation

  • 8/14/2019 Pic Project

    5/22

    SPI

    SPI specifies four signals: clock (SCLK); master

    data output, slave data input (MOSI); master data

    input, slave data output (MISO); and slave select(SS).

    SCLK is generated by the master and input to all

    slaves. MOSI carries data from master to slave.

    MISO carries data from slave back to master.

    A slave device is selected when the master asserts

    its SS signal.

  • 8/14/2019 Pic Project

    6/22

    SPI

    If multiple slave devices exist, the mastergenerates a separate slave select signal for eachslave.

    The master generates slave select signals usinggeneral-purpose discrete input/output pins or otherlogic.

    This consists of old-fashioned bit banging and canbe pretty sensitive. You have to time it relative tothe other signals and ensure, for example, that youdon't toggle a select line in the middle of a frame.

  • 8/14/2019 Pic Project

    7/22

    SPI

    Single master, multiple slave SPI implementation

  • 8/14/2019 Pic Project

    8/22

    SPI

    SPI doesn't describe a specific way to implement

    multi-master systems, some SPI devices support

    additional signals that make such implementationspossible. However, it's complicated and usually

    unnecessary, so it's not often done.

    A pair of parameters called clock polarity (CPOL)

    and clock phase (CPHA) determine the edges ofthe clock signal on which the data are driven and

    sampled.

  • 8/14/2019 Pic Project

    9/22

    SPI

    Each of the two parameters has two possiblestates, which allows for four possiblecombinations, all of which are incompatible withone another.

    A master/slave pair must use the same parameterpair values to communicate.

    If multiple slaves are used that are fixed indifferent configurations, the master will have toreconfigure itself each time it needs tocommunicate with a different slave.

  • 8/14/2019 Pic Project

    10/22

    Real-Time Clock (RTC)

    Block Diagram of DS1302 RTC

  • 8/14/2019 Pic Project

    11/22

    RTC

  • 8/14/2019 Pic Project

    12/22

    RTC

    Registers of DS1302

  • 8/14/2019 Pic Project

    13/22

    RTC

    Registers of DS1302

  • 8/14/2019 Pic Project

    14/22

    Temperature Sensor (TS)

    Block Diagram of TMP124

  • 8/14/2019 Pic Project

    15/22

    TS

    Timing Diagram of TMP124

  • 8/14/2019 Pic Project

    16/22

    TS

    Timing Diagram of TMP124

  • 8/14/2019 Pic Project

    17/22

    Light Dependent Resistor (LDR)

    Connection Diagram of a LDR

  • 8/14/2019 Pic Project

    18/22

    System Design

    Block Diagram of the Complete System

  • 8/14/2019 Pic Project

    19/22

    System Design

    The Controller has to read the ADC and the

    TS at a fixed pattern say per sec or per

    minute. The current time has to be read from the

    RTC and to be checked whether there is a

    change in the sec/min, if so the ADC andTS has to be read.

  • 8/14/2019 Pic Project

    20/22

    LCD Output

    Display Pattern on the LCD

  • 8/14/2019 Pic Project

    21/22

    Peripheral Board

    Board outline of the Peripheral Board

  • 8/14/2019 Pic Project

    22/22

    Thank you