Shop OBEX P1 Docs P2 Docs Learn Events
DS1307 Demo — Parallax Forums

DS1307 Demo

Jon WilliamsJon Williams Posts: 6,491
edited 2008-03-08 03:28 in General Discussion
If you've got a PDB and have been wanting to connect to that DS1307 that's next to the SX28, this program will probably save you a bit of time.

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Jon Williams
Applications Engineer, Parallax

Post Edited (Jon Williams (Parallax)) : 10/26/2005 11:19:51 PM GMT
861 x 574 - 121K

Comments

  • Jon WilliamsJon Williams Posts: 6,491
    edited 2005-10-27 02:42
    Just a note: I have my terminal program set to add LF (line feed) when it gets a CR (carriage return).· You can do that with your terminal, or add this definiton to the program

    CRLF:
    · DATA 13, 10, 0

    ... and then change:

    · TX_BYTE CR

    ... to:

    · TX_STR CRLF

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Jon Williams
    Applications Engineer, Parallax
  • Mike CookMike Cook Posts: 829
    edited 2005-11-19 14:37
    More DS1307 Examples:

    Since I'm learning SX/B, I thought I would post these as examples for converting a BS2p program to SX/B.

    I can't remember if the original BS2p program was a Nut's and Volts article, one of Chris's, or Jon's examples.

    The SX/B programs demonstrate how to use ANSI codes to mimic the BS2p's Debug statement, and allows the user to set the clock's time and date for battery backed operation of the DS1307.

    Attached is the original BS2p program. The program converted to SX/B running on a SX28 on the PDB. And a version for the SX48/52 Proto Board. The SX/B examples use a MAX232 RS-232 driver for serial output.

    Note: In the SX-Key Editor, I have TABs set to 4, change this setting to have the comments in the SX/B listings "line up"·

    Professional Development Board Connections:
    
     
    X13 PIN 4 TO RA0
    X13 PIN 2 TO RA1
     
    X14 PIN 3 TO RA2
    X14 PIN 2 TO RA3
    X14 PIN 1 TO X17 PIN 15 (LED)
    


    Schematics of the PDB I2C and RS-232 Attached

    Mike
    ·

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    "OEM NMEA GPS Module" Now available on ebay for only $17.49

    Product web site: http://www.allsurplus.net/Axiom/

    Post Edited (Mike Cook) : 2/2/2006 11:22:29 PM GMT
    772 x 421 - 26K
    982 x 550 - 45K
  • Chris SavageChris Savage Parallax Engineering Posts: 14,406
    edited 2005-11-20 05:24
    Mike,

    ·· I think the original was Jon's...I tend to lean toward the DS1302.· Nice work, BTW!

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Chris Savage
    Parallax Tech Support
    csavage@parallax.com
  • nick bernardnick bernard Posts: 329
    edited 2006-02-02 20:13
    *An Corp*

    Jon, how is this intended to be interfaced to a PC?
    is a ttl ->232 conversion necessary? or can the baud become "N9600"

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    engineer, fireman, bowler, father, WoW addict [noparse];)[/noparse]
  • Jon WilliamsJon Williams Posts: 6,491
    edited 2006-02-02 20:41
    I used a USB2SER in my case, but with a short connection I'm sure you could useN9600. If you decide to go direct for SERIN, put a 22K resitor inline with your serial input pin on the SX.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Jon Williams
    Applications Engineer, Parallax
  • nick bernardnick bernard Posts: 329
    edited 2006-02-02 21:54
    hrm,
    i was getting ??:??:?? in the terminal, switched out the xtal & caps(for the ds1307) and now i'm getting 00:00:00 in the terminal
    i'm prototyping on an sx48 protoboard with an smt ds1307

    any advice?

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    engineer, fireman, bowler, father, WoW addict [noparse];)[/noparse]
  • Mike CookMike Cook Posts: 829
    edited 2006-02-02 22:27
    Did you pull up the I2C lines?

    attachment.php?attachmentid=40322

    Mike




    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    "OEM NMEA GPS Module" Now available on ebay for only $17.49

    Product web site: http://www.allsurplus.net/Axiom/

    Post Edited (Mike Cook) : 2/2/2006 10:41:27 PM GMT
    772 x 421 - 26K
  • nick bernardnick bernard Posts: 329
    edited 2006-02-02 22:47
    yes, and sqw, and grounded vbatt.
    i tried with 12pf smts and 25pf through hole.
    i noticed +2v on x0 so i'm making another prototype w/ 10k pullups, like the prodevboard.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    engineer, fireman, bowler, father, WoW addict [noparse];)[/noparse]
  • Mike CookMike Cook Posts: 829
    edited 2006-02-02 22:57
    Might be something with the xtal, have you tried writing a byte to one of the other memory locations and then reading it back?

    I've got the PDB board and a proto board that has the DS1307, did not use caps on the Proto board, used xtals from here:

    http://www.mouser.com/index.cfm?&handler=data.listcategory&D=*695cfs206327kbb*&terms=695-cfs206-327kbb&Ntt=*695cfs206327kbb*&Dk=1&Ns=SField&N=0&crc=true

    They are 6pf, have not noticed any problems.

    ·attachment.php?attachmentid=40323

    Mike


    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    "OEM NMEA GPS Module" Now available on ebay for only $17.49

    Product web site: http://www.allsurplus.net/Axiom/

    Post Edited (Mike Cook) : 2/2/2006 11:04:13 PM GMT
    581 x 539 - 118K
  • nick bernardnick bernard Posts: 329
    edited 2006-02-07 19:48
    i got it working today w/o the 12 pF caps on the xtal.
    thx guys
    nickb

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    engineer, fireman, bowler, father, WoW addict [noparse];)[/noparse]
  • John CoutureJohn Couture Posts: 370
    edited 2008-02-16 21:42
    In preparing a lesson plan for my students, I stumbled upon Jon Williams' code above.· Every time I read one of his programs I learn something new (in this case the PUT command on the Array, very slick).· Anyway, I adapted it so that I could demonstrate both the DS1307 and a 20x4 LCD panel on the Professional Development Board.

    Other features (borrowed, of course, from several of Jon's programs!) include:

    -- LCD Panel is·set to 4 bit mode

    -- the ability to position the cursor anywhere on the panel (LCDPos)

    --·a little different BCD display routine

    --·use of arrays

    I did not use Jon's TX_MON_LONG routine that takes a number and displays the full name of the month because·I was trying to be brief in my lesson plan but I highly recommend you all look at that routine.· It is Brilliant!

    .. program updated with more comments.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    John J. Couture

    San Diego Miramar College

    Post Edited (John Couture) : 2/17/2008 12:28:02 AM GMT
  • JonnyMacJonnyMac Posts: 9,108
    edited 2008-02-17 01:13
    Thanks for the kind words, John.

    I looked over that program -- it's a golden oldie, and in serious need of an update. While waiting on a friend to arrive, that's exactly what I did. The version that's attached lives up to 1.51.03 standards and is expanded in that it allows the user to select display style from the terminal when the program first starts.
  • John CoutureJohn Couture Posts: 370
    edited 2008-03-07 18:10
    Jon,

    In the last couple of classes we have been having trouble with some PDB's and·getting the SX to recognize keyboard input.· Our setup is as follows:

    Using your program unmodified and the Prof Dev Board we connect:

    RA.0 to the TX pin of the RS-232 DCE (PDB schematic, pg 6 connextor X13, #2)

    RA.1 to connector X13, #4

    RA.2 to SDA (and a 4.7K resistor from there to +5V)

    RA.3 to SCL (and a 4.7K resistor from there to +5V)

    took the plastic tab out of the battery on the DS1307.

    USB for programming, another USB->Serial to connect to the DB9 on the PDB (near the X13 connector)

    =========================================

    What Happens:

    Load·your program (4mhz).

    Start up HyperTerminal, set to 38400, 8n1,·· Flow Control None.

    Prompt comes up and it displays the "Menu" and then ">>"

    But then it does not respond to any keypress.· We tried "s" and "S".

    Now sometimes it works if you just hold the key down.

    =========================================

    QUESTION:

    Do we need to trigger CTS or RTS in order to get that crazy thing to work smoothly?·

    Is Hyperterminal not the most ideal program to use for this application?

    When the MCU is off trying to read the clock it seems that a keypress would also not work.· As always, it is something simple that I am missing.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    John J. Couture

    San Diego Miramar College
  • JonnyMacJonnyMac Posts: 9,108
    edited 2008-03-08 03:28
    John,

    I only ever connect RX and TX, and HyperTerminal is all I ever use for general purpose testing. I'm sure it is something simple, but at the moment I can't think of anything.

    Update: I just connected everything again and it runs fine. What I don't have is the additional pull-ups (they're on the PDB). I don't see why this should make a difference, but you might want to remove them just to give yourself a chance to review the connections.

    Post Edited (JonnyMac) : 3/8/2008 3:37:15 AM GMT
Sign In or Register to comment.