real time clock


Results 1 to 40 of 45

Thread: real time clock

Threaded View

  1. #28
    Join Date
    Jan 2006
    Location
    Istanbul
    Posts
    1,185


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by jessey
    ....
    for am 12 hr mode
    writehour = 00100011 = $C4
    readhour = 10100011 = $A3

    for pm 12 hr mode
    readhour = 10101011 = $AB
    writehour = 00101011 = $D4
    hi jessey,

    When reading or writing you change the register address command.

    Reading: $85
    Writing : $84

    If you want to "Write Hour" to the chip, then you first send $84 command and prepare the chip to accept the incoming data for "hour". Then right after that you send your byte variable consisting your "hour data".

    If sending 12Hr AM mode then the Bit7 of your byte should be "0" indicating 12Hr mode, and Bit5 should be "1 " indicating "AM".

    Sending $85 command to the chip will be for "read hour" command and incoming data byte will consist of "hour data". Thus for reading, you do not set a byte to write to the chip; just read the incoming data.

    In this case, I need to correct your arrangement as below.

    12AM hr mode
    writehour = 00100011
    Bit7=0 12hr mode.
    Bit5=1 AM mode.
    Correct

    readhour = 10100011
    No need.
    Just send $85 and read the incoming data.


    12PM hr mode
    writehour = 00101011
    Bit7=0 12hr mode.
    bit5=1 AM mode.
    incorrect

    The correct byte arrangement:
    writehour = 00001011
    Bit7=0 12Hr mode.
    bit5=0 PM mode.


    readhour = 10101011
    No need.
    Just send $85 and read the incoming data.



    Quote Originally Posted by jessey
    I have another question for you if you understand Melanie's ConvertBCD: subroutine above, what does the DIG 1 & DIG 0 do?

    In a byte or word, the digits counts from right to left (just like Arabic).

    Say we have a byte and it is set to Decimal 245.

    ex:
    Test VAR BYTE
    Apple VAR BYTE

    Test = 245

    In this case, from right to left,
    Test Dig 0 is 5
    Test Dig 1 is 4
    Test Dig 2 is 2

    to extract any of these numbers and use in somewhere else, we use;

    Apple = Test Dig 1

    Apple is now 4.



    How is it now ?
    ---------------------
    Last edited by sayzer; - 1st September 2006 at 17:13.
    "If the Earth were a single state, Istanbul would be its capital." Napoleon Bonaparte

Similar Threads

  1. Real Time Clock
    By in forum mel PIC BASIC Pro
    Replies: 7
    Last Post: - 2nd June 2012, 05:52
  2. real time clock - PCF8583
    By maria in forum mel PIC BASIC Pro
    Replies: 14
    Last Post: - 15th April 2010, 16:41
  3. Real time clock ICs
    By Eng4444 in forum mel PIC BASIC Pro
    Replies: 66
    Last Post: - 20th October 2008, 17:05
  4. Real Time Clock
    By savnik in forum mel PIC BASIC Pro
    Replies: 5
    Last Post: - 8th December 2006, 03:02
  5. Real time clock... what a headache!
    By Eng4444 in forum mel PIC BASIC
    Replies: 2
    Last Post: - 8th June 2006, 22:56

Members who have read this thread : 4

You do not have permission to view the list of names.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts