Shop OBEX P1 Docs P2 Docs Learn Events
Why doesn't this code work? — Parallax Forums

Why doesn't this code work?

mike_smike_s Posts: 42
edited 2005-12-27 23:11 in BASIC Stamp
Update_display:
··· OUTH = 132
··· LOW rs
··· PULSOUT e, 1
··· OUTH = char
··· HIGH rs
··· PULSOUT e, 1

132· = the 5th pos from home in display which works
However it will only print a literal value in quotes (eg "1" will update as 1)
Why won't it accept a variable which holds a value from 1-9
and print that number

Comments

  • Chris SavageChris Savage Parallax Engineering Posts: 14,406
    edited 2005-12-27 20:58
    Is this the entire code?· It's not clear since you have no declarations for the constants being used what this even goes to.· But OUTH won't affect the outputs unless the direction registers are first set to outputs (Inputs by default).· That's my best guess based on the little information available.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Chris Savage
    Parallax Tech Support
    csavage@parallax.com
  • mike_smike_s Posts: 42
    edited 2005-12-27 21:23
    rs = pin 4 register select
    e = pin 6 enable
    char = character to be sent

    if I look up the character for 1 in binary it would be %00110001 but that won't work in this case because I want to print each update to a counter in decimal.
    I want to be able to send the value in decimal to print like in a string eg "A" or "1" literally
  • Chris SavageChris Savage Parallax Engineering Posts: 14,406
    edited 2005-12-27 21:54
    There's still not enough information here.· If I had to guess I would say you're trying to talk to an LCD Display, but that's only a guess.· Where's the rest of your code?· It's anybody's guess what the problem even is.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Chris Savage
    Parallax Tech Support
    csavage@parallax.com
  • mike_smike_s Posts: 42
    edited 2005-12-27 22:50
    Sorry, yes its an lcd.
    Looks like the lcd controller only understands either binary or strings as asc11 characters.
    What I want to do is update the lcd by a counter.
    At least looking at the character chart for it 0-9 do follow eachother in the lsb
    but they start at 0011 in the msb.
    eg 0 = 00110000
    1 = 00110001
    2 = 00110010 etc
    I think I might have just realised what is needed.
    If I add 48 to the binary value then it should print the value I'm after?
  • mike_smike_s Posts: 42
    edited 2005-12-27 22:53
    It's ok. How stupid of me. Even though I've learnt binary and hex long ago it still trips me up sometimes.
  • mike_smike_s Posts: 42
    edited 2005-12-27 23:05
    Ok this is what I was doing. Code attached.

    While not an atomic clock it might do as a token timer for an app where precision isn't too important.

    I monitored for a few minutes and its pretty close. But for precise timing I imagine either a 555 timer or ds1307(which I've seen mentioned here would prolly do it.

    Could someone point me in the right direction with 555 timers and basic stamp time keeping?
    I have plenty off 555 and 556's but don't have a ds1307 which I've found to be much more expensive anyaway.
  • mike_smike_s Posts: 42
    edited 2005-12-27 23:11
    Code is still in progress but the source supplied is pretty accurate to 10 minutes. (after which you will get funny symbols instead of advancing the ten minute display)
    Just have to finish the rest of it now.
    will post it if anyone interested when I'm done
Sign In or Register to comment.