Shop OBEX P1 Docs P2 Docs Learn Events
Ds1307 — Parallax Forums

Ds1307

NewzedNewzed Posts: 2,503
edited 2004-11-11 05:08 in BASIC Stamp
My program for the DS1307 calls for the entering of the time/date parameters as decimals, then converting the decimals to BCD before I2COUT, and converting the BCD to decimals after I2CIN.

If I enter the time/date parameters in a HEX2 format, can I eliminate the decimal/BCD and the BCD/decimal conversion process?

Sid

Comments

  • Jon WilliamsJon Williams Posts: 6,491
    edited 2004-08-05 14:24
    Yes ... though the conversions are not difficult with PBASIC:

    · hexVal = (decVal / 10 << 4) + (decVal // 10)
    · decVal = (hexVal.NIB1 * 10) + hexVal.NIB0


    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Jon Williams
    Applications Engineer, Parallax
    Dallas Office
  • AlWilliamsAWCAlWilliamsAWC Posts: 135
    edited 2004-08-05 14:28
    Hi Sid,

    Did you look at this month's project of the month? http://www.awce.com/som.htm

    Al Williams
    AWC
  • NewzedNewzed Posts: 2,503
    edited 2004-08-05 14:29
    Jon Williams said...
    Yes ... though the conversions are not difficult with PBASIC:

    · hexVal = (decVal / 10 << 4) + (decVal // 10)
    · decVal = (hexVal.NIB1 * 10) + hexVal.NIB0


    Thanks, Jon.

    Sid
  • NewzedNewzed Posts: 2,503
    edited 2004-08-05 14:36
    Al Williams/AWC said...
    Hi Sid,

    Did you look at this month's project of the month? http://www.awce.com/som.htm

    Al Williams
    AWC
    I just did.· Thanks, Al
  • B WardB Ward Posts: 1
    edited 2004-11-11 02:48
    Where can I purchase a DS1307 ???

    thanks, bward
  • Bruce BatesBruce Bates Posts: 3,045
    edited 2004-11-11 05:08
    Mr. Ward -

    In the future you can answer your own question by using the resources of this handy search engine: http://www.findchips.com/ . Presently Mouser, Digikey, and a number of other supplier are showing stock. You can also purchase or ask for samples of, any of the Maxim/Dallas Semiconductor parts right from their web site: http://www.maxim-ic.com/ .
    They have always been quite generous with their sample policy.

    Regards,

    Bruce Bates
Sign In or Register to comment.