Shop OBEX P1 Docs P2 Docs Learn Events
LCD/DEBUG Screen and DS1302 — Parallax Forums

LCD/DEBUG Screen and DS1302

hmlittle59hmlittle59 Posts: 404
edited 2007-10-22 17:13 in BASIC Stamp
Hello Everyone,

I'm trying to learn how and why the two screens are showing ASCII Char. but the routines only have HEX commands in them? I've read some info. on the forum, but know clear cut meaning as to why.

Thanks for any help


hmlittle59

Comments

  • Chris SavageChris Savage Parallax Engineering Posts: 14,406
    edited 2007-10-17 15:08
    Hello,

    The DS1302 doesn’t have any formatting commands in it. Are you referring to a specific piece of code or a routine?

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Chris Savage
    Parallax Tech Support
  • hmlittle59hmlittle59 Posts: 404
    edited 2007-10-17 23:18
    Thanks Chris,

    Yes, I put a count up/down routine in the DS1302 clock demo: work = year: (work = work + 1 //20):year = work. But when I'm incrementing up/down & re-display the 'year' value, its in true HEX(ABCDEF)...What gives. Do I need to convert it back for screen display.


    Thanks for any help
    hmlittle59
  • Chris SavageChris Savage Parallax Engineering Posts: 14,406
    edited 2007-10-18 14:59
    I’m still not clear on which code you’re using, but any code that deals with the DS1302 has to be able to handle BCD. The HEX2 formatter is the closest you’re going to come. It appears in the snippet you posted you’re just trying to increment the value in decimal. That won’t work since you’ll have many values which are not valid in BCD. If you’re going to work in decimal you’ll need to convert the BCD (HEX) data to Decimal and then back after manipulation. I posted routines for doing this on the forums. Take care.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Chris Savage
    Parallax Tech Support
  • hmlittle59hmlittle59 Posts: 404
    edited 2007-10-20 20:47
    Got it Chris,

    I got it working, I did find a routine on the forum that did the conversion. All of my code seems to be working now.

    1) Detect if DS1302 is running or not
    2) Use defaults if not running
    3) Adjust time/date/year/day of week/ w/push button(s), rolling back to 0 or 1
    4) Set Clock with a third switch
    5) Set and monitor for alarm
    6) Bunch of other routines and 5% space left...not bad

    thanks for all the help and support
    hmlittle59

    ps. I want to move this to a proto. board any recommendations?
  • Chris SavageChris Savage Parallax Engineering Posts: 14,406
    edited 2007-10-22 17:13
    Great, glad to hear it. If you want, when you’re done you could share your code so that others could see what you have done and how you did it. Take care.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Chris Savage
    Parallax Tech Support
Sign In or Register to comment.