Shop OBEX P1 Docs P2 Docs Learn Events
DS1307 Output to TV or VGA? — Parallax Forums

DS1307 Output to TV or VGA?

BenjBenj Posts: 66
edited 2008-10-27 23:25 in Propeller 1
I would like to connect to my DS1307 and output the time to either a TV or VGA, does anyone have the code? Object Exchange only seems to have the output go to LCD, which I do not have.

Comments

  • Oldbitcollector (Jeff)Oldbitcollector (Jeff) Posts: 8,091
    edited 2008-10-27 13:50
    I did that a while back, but can't lay my hands on my code..

    Post a link to the object you are looking at and I'll do it again..

    It's not tough. Most of the .out and .str commands are directly
    compatible with the text object. IIRC, I converted them nearly
    straight across and removed the LCD specific stuff.

    OBC

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    New to the Propeller?

    Getting started with a Propeller Protoboard?
    Check out: Introduction to the Proboard & Propeller Cookbook 1.4
    Updates to the Cookbook are now posted to: Propeller.warrantyvoid.us
    Got an SD card connected? - PropDOS
  • BenjBenj Posts: 66
    edited 2008-10-27 14:05
    http://obex.parallax.com/objects/217/

    I am trying to do this on my Prop Demo Board and have the 1307 SCL connected to P5 and SDA connected to P6.
  • Oldbitcollector (Jeff)Oldbitcollector (Jeff) Posts: 8,091
    edited 2008-10-27 14:21
    I *think* this code conversion is correct. (Not near my prop)

    It will either work perfectly or get you in the ballpark.. [noparse]:)[/noparse]

    I've added a text : "tv_text" to the CON, and move the LCD to an unused pin.
    Complete file is attached.

    [b]PRI[/b] DS1307_demo | secs
      ' DEMO the DS1307 Real Time Clock (RTC)
      secs := ds1307object.gettime
      [b]if[/b] secs == 80
        ' the clock has not been initialised so lets set it
        ' this will demonstrate hour & day roleover. 
        ds1307object.settime(23,59,45)  ' 23:59:45
        ds1307object.setdate(1,1,5,06)  ' 1/5/2006 - day 1  
    
      ' run for approx 30 secs
      [b]repeat[/b] 30
        ' get and display the TIME
        text.out(0)
        text.[b]str[/b]([b]string[/b]("TIME: "))    
        'lcdObject.positionlcd(1,7)
        ds1307object.gettime
        text.dec (ds1307object.getHours)
        text.[b]str[/b]([b]string[/b](":"))
        text.dec (ds1307object.getMinutes)
        text.[b]str[/b]([b]string[/b](":"))                                       
        text.dec (ds1307object.getSeconds)
    
        ' get and display the DATE
        'lcdObject.clearline(2)
        text.[b]str[/b]([b]string[/b](13,"DATE: "))    
        'lcdObject.positionlcd(2,7)
        ds1307object.getdate
        text.dec (ds1307object.getDays)
        text.[b]str[/b]([b]string[/b]("/"))
        text.dec (ds1307object.getMonths)
        text.[b]str[/b]([b]string[/b]("/"))                                       
        text.dec (ds1307object.getYears)
    
        ' wait a tick or two
        [b]waitcnt[/b](60_000_000+[b]cnt[/b])
    
    
    

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    New to the Propeller?

    Getting started with a Propeller Protoboard?
    Check out: Introduction to the Proboard & Propeller Cookbook 1.4
    Updates to the Cookbook are now posted to: Propeller.warrantyvoid.us
    Got an SD card connected? - PropDOS
  • BenjBenj Posts: 66
    edited 2008-10-27 15:51
    I seem to be running into a problem when I:

    DS1307Object.init(DS1307_Addr, i2cSDA, i2cSCL,false)
    



    or

    i2cScan
    



    it just freezes and none of the remaining code runs. If I comment out both lines it "runs" but obviously without the DS1307
  • Oldbitcollector (Jeff)Oldbitcollector (Jeff) Posts: 8,091
    edited 2008-10-27 17:15
    Ok, you've got me stumped..

    Double check the SDA, SCL connections.. Make sure we match your actual connection.

    OBC

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    New to the Propeller?

    Getting started with a Propeller Protoboard?
    Check out: Introduction to the Proboard & Propeller Cookbook 1.4
    Updates to the Cookbook are now posted to: Propeller.warrantyvoid.us
    Got an SD card connected? - PropDOS
  • BenjBenj Posts: 66
    edited 2008-10-27 18:26
    I have figured out what the problem is.... I'm a moron. To put it more politely, "A technical problem existed between the keyboard and chair". I looked at the wiring diagram again to discover that I did not connect any pull-up resistors to the SCL and SDA lines. All seems to be functioning properly now. Thank you for all of your help.
  • RaymanRayman Posts: 14,826
    edited 2008-10-27 23:25
    In case you want a more functional time code, check out my Unix time code for the DS1307:

    http://forums.parallax.com/showthread.php?p=691564


    Also, you might consider next time just using the existing I2C bus on pins 28&29 (that connect to the EEPROM).
    That way you don't use any extra pins and there's already the pullups you need...
Sign In or Register to comment.