RTC Interfacing

download RTC Interfacing

of 18

Transcript of RTC Interfacing

  • 8/19/2019 RTC Interfacing

    1/18

    RTC interfacing

  • 8/19/2019 RTC Interfacing

    2/18

    • Real Time Clock (RTC) is widely useddevice that provides accurate time & datefor many applications. Eg:The !" #$% C

    come with such a chip on themother'oard.The RTC chip in the #$% Cprovides time components of hourminute& secondin addition to the datecalander

    components of year month & day.The RTCchip uses an internal 'attery which keepsthe time & date even when power is o*.

  • 8/19/2019 RTC Interfacing

    3/18

    +, -!!/ RTC Chip

  • 8/19/2019 RTC Interfacing

    4/18

    0CC

    in 1 provides eternal supplyvoltage to the chip

     The eternal voltage source is 2 3volt.

     4hen 0CC falls 'elow the 5 voltslevel the eternal source is switchedo* and the internal 6i 'atteryprovides power to the RTC

  • 8/19/2019 RTC Interfacing

    5/18

    78+: in - is ground

    9+;9+/: The multiple address datapins provides 'oth addresses and datato the chip. 9 simple way of connecting

    +,-!!/ to the !3- is shown in the

  • 8/19/2019 RTC Interfacing

    6/18

    +, -!!/ connection to!3-

  • 8/19/2019 RTC Interfacing

    7/18

    • 9, (96E) : 9,( address stro'e) is an ippin.The 9, pin is used for demultipleingthe address & data & is connected to the

    96E pin of the !3- chip• %=T: is an ip pin that allows the choice

    'etween motorola & intel microcontroller

    'us timing.That means when we connect+,-!!/ to the !3- %=T>78+

     

  • 8/19/2019 RTC Interfacing

    8/18

    • +,: +ata ,tro'e or RE9+ is an ippin.4hen %=+> 78+ for #nteltimingthe +, pin is called the R+signal& is connected to the R+ pin ofthe !3-

    • R4: is an ip pin.4hen %=+> 78+

    for #ntel timing the R4 pin is calledthe 4R signal& is connected to the4R pin of the !3-

  • 8/19/2019 RTC Interfacing

    9/18

      C,: is an ip pin & active lowsignal.C, only works when theeternal 0cc is connected.4hen 0ccfalls 'elow 1.3v the chip select ipis internally forced to an inactivelevel.This is called write;protected

    state. 4hen chip is in write;protectedstate all ips are ignored

  • 8/19/2019 RTC Interfacing

    10/18

    • #R?: #nterrupt Re@uest is an op pin &active low signal.To use #R?the interruptena'le 'its in register$ must 'e set high

    • ,?4: ,@uare 4ave is an op pin. Thefre@uency of the s@uare wave is set 'yprogramming register 9

    • RE,ET: #8 -! is an reset pin. #t is an inputand is active low pin. #n most applicationsthe reset pin is connected to the 0cc.

  • 8/19/2019 RTC Interfacing

    11/18

    •  The +, -!!/ has total of -! 'ytes of R9%space with addresses ;/AB.

    •  The

  • 8/19/2019 RTC Interfacing

    12/18

    9ddress map

  • 8/19/2019 RTC Interfacing

    13/18

     Turning on the oscillator for the

  • 8/19/2019 RTC Interfacing

    14/18

    Codes to 9ccess the+,-!!/

    • 9C966 +E69DmsF RTC needsms after

    power;up

      %=0 RG-F R>9B register 9address

      %=0 9GBF - in +";+1 to turn onoscillator

      %=0H IR 9F send it to Register 9 of+,-!!/

  • 8/19/2019 RTC Interfacing

    15/18

    ,etting the time

    • 4hen we initialiJe time or date weneed to set the +/ of register $ > -.this will prevent any update at the

    middle of the initialiJation. aftersetting the time and date we need tomake +/> to make sure that the

    clock and time are updated. Theupdate occurs once per second.

    •  The format of register $ ;

  • 8/19/2019 RTC Interfacing

    16/18

     

    Th f ll i d i iti li th l k t -" 3! 33 i th $C+

  • 8/19/2019 RTC Interfacing

    17/18

    •  The following code initialiJe the clock at -":3!:33 using the $C+mode and the 1 hour clock mode with day light saving time

  • 8/19/2019 RTC Interfacing

    18/18

    ,etting the date• 4hen we initialiJe time or date we need to set +/ of register $ to -

    =cto'er -th 1