Shop OBEX P1 Docs P2 Docs Learn Events
DS1302 Seconds Register Tech Support helped me with this Thank YOU ( reslo — Parallax Forums

DS1302 Seconds Register Tech Support helped me with this Thank YOU ( reslo

sam_sam_samsam_sam_sam Posts: 2,286
edited 2009-06-05 01:12 in General Discussion
What Do I need to just read the Seconds Register··as far as· VAR··· and··· CON··· ·?

·I do not want to read it in the BURST MODE

I just want to use the Second Only

Is there a way to do this and how would I do this is there· a DEMO CODE out there on the Forum that·I could·use

·

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
··Thanks for any·idea.gif·that you may have and all of your time finding them smile.gif

·
·
·
·
Sam

Post Edited (sam_sam_sam) : 6/5/2009 12:22:57 AM GMT

Comments

  • InSilicoInSilico Posts: 52
    edited 2009-05-31 22:27
    The datasheet says that you can initiate single-byte reads or multi-byte reads (the so-called "burst" mode). The seconds register is only a single byte, so you can read that one register only.

    Simply send the hex command value $81 and the chip will read the seconds register and you can clock it into your microcontroller.

    Page 9 tells you the addresses of all the time registers and their contents:·http://www.maxim-ic.com.cn/pdfserv/en/ds/DS1302.pdf


    Post Edited (InSilico) : 5/31/2009 10:34:36 PM GMT
  • sam_sam_samsam_sam_sam Posts: 2,286
    edited 2009-06-02 00:16
    InSilico

    Thank You for your Reply

    I try ed this but this only works if you have cap on the DS1302 Chip

    When I do this with NO·Cap I only get (80) ·for out put

    This is why I ask What VAR and CON

    What else·is need to make this work



    HIGH CS_1302

    SHIFTIN Dio,Clk,LSBPRE,[noparse][[/noparse]secs]

    LOW CS_1302

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    ··Thanks for any·idea.gif·that you may have and all of your time finding them smile.gif

    ·
    ·
    ·
    ·
    Sam

    Post Edited (sam_sam_sam) : 6/2/2009 12:23:00 AM GMT
  • TimmooreTimmoore Posts: 1,031
    edited 2009-06-02 01:05
    The second register reading 80 hex (I assume) means hte clock isn't running.If you dont have any battery backup on the clock it will stop when you remove power. You need to write the time to the clock and then set the most significant bit of the seconds register to 0 to start the clock
  • sam_sam_samsam_sam_sam Posts: 2,286
    edited 2009-06-02 01:41
    Here is the routine in case some one else dose not understand how to read only·the second register· you can also do the hours and minutes and so on

    Set_Secs:······················································ ·' DS1302 Write Seconds
    · HIGH CS1302················································ ·' Select DS1302
    · SHIFTOUT DataIO, Clock, LSBFIRST, [noparse][[/noparse]WrSecs]
    · SHIFTOUT DataIO, Clock, LSBFIRST, [noparse][[/noparse]secs]
    · LOW CS1302················································ ·' Deselect DS1302
    · RETURN

    Get_secs:······················································ ·' DS1302 Read Seconds
    · HIGH CS1302················································ ·' Select DS1302
    · SHIFTOUT DataIO, Clock, LSBFIRST, [noparse][[/noparse]RdSecs]
    · SHIFTIN DataIO, Clock, LSBPRE, [noparse][[/noparse]secs]
    · LOW CS1302················································· ·' Deselect DS1302
    · RETURN



    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    ··Thanks for any·idea.gif·that you may have and all of your time finding them smile.gif

    ·
    ·
    ·
    ·
    Sam

    Post Edited (sam_sam_sam) : 6/5/2009 1:13:45 AM GMT
  • sam_sam_samsam_sam_sam Posts: 2,286
    edited 2009-06-05 01:12
    UpDate




    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    ··Thanks for any·idea.gif·that you may have and all of your time finding them smile.gif

    ·
    ·
    ·
    ·
    Sam

    Post Edited (sam_sam_sam) : 6/5/2009 1:19:25 AM GMT
Sign In or Register to comment.