Shop OBEX P1 Docs P2 Docs Learn Events
can someone help me with this, i cant get continuously updating text to clear t — Parallax Forums

can someone help me with this, i cant get continuously updating text to clear t

laser-vectorlaser-vector Posts: 118
edited 2010-07-30 03:51 in Propeller 1
so heres the code continuously

PUB menu4
  dira[noparse][[/noparse]3..0]~                                            {sets pins 3..0 to inputs}
  print($100)                                           {clears the screen from the last menu}
  print($110)                                           {changes the color of the font}
  repeat                                                  {repeat forever}                                          
    print_string(string("BINARY ="))
    print_string(num.tostr(changeme, num#bin))
    print_string(string(" ... HEX ="))
    print_string(num.tostr(changeme, num#hex))
    print_string(string(" ... DEC="))
    print_string(num.tostr(changeme, num#dec))
    changeme := ina[noparse][[/noparse]3..0]                       {sends pin states to the "changeme" variable}
    print($101)                                         {prints the "Home Character" to send the cursor to the home position}




what im trying to do is just have one simple line of text in the top left corner of my vga display the state of pins 3..0, but lets say i had some large numbers displaying:

BINARY = 1111 ... HEX = F ... DEC = 15

and then i want to display a much shorter set of numbers

BINARY = 0 ... HEX = 0 ... DEC = 0

the actual resault will look something like this:

BINARY = 0 ... HEX = 0 ... DEC = 0= 15

now i have tried inserting a "clear screen" command at the end of the loop but it makes the text flicker really bad.

any suggestions?????

Post Edited (laser-vector) : 7/30/2010 3:18:36 AM GMT

Comments

  • Dr_AculaDr_Acula Posts: 5,484
    edited 2010-07-30 03:23
    Could you print 20 spaces (ascii $20 or 32 decimal) at the end of the line? (will work but ? the cursor ends up not at the end of the line. If you have a cursor that is).
    Or print 40 spaces first, then print your line?
    Or just print something like this:
    print_string(string("                                                  "))
    
    

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    www.smarthome.viviti.com/propeller
  • Duane DegnDuane Degn Posts: 10,588
    edited 2010-07-30 03:29
    One option is to add some extra spaces after your·new data.
    repeat 6
      print(32)
     
    ' or
     
    print_string(string("        "))
    

    You might also be able to backspace over the old data before writing the new.· I don't remember the ASCII code for backspace; I alway have the ASCII Wikipedia page open when I'm use unfamilar ASCII code.

    Note: I just saw Dr_Acula's post as I was previewing mine.

    Duane
  • laser-vectorlaser-vector Posts: 118
    edited 2010-07-30 03:51
    thanks dr_acula

    printing blank spaces to the right did in fact work pretty well but it was easy.. too easy lol!

    Sorry to bother you guys with such a trivial problem, but its getting late and i needed to get something working for tomorrow and kind of hit a wall for a second, but i went back and read the propeller manual some more and i actually figured something out that works, it only runs the loop if the value of Changeme updates:

    PUB menu4 | update
      update := -1
      dira[noparse][[/noparse]0..3]~                                           {sets pins 0..3 to inputs}
      print($100)                                           {clears the screen from the last menu}
      print($110)                                           {changes the color of the font}
      repeat                                                {continusily update changeme}
       changeme := ina[noparse][[/noparse]3..0]                                {changeme now = the value of pins 3..0}
        repeat while not update == changeme                 {loop only executes if changeme is updated/changes}                                         
          print($100)
          print_string(string("BINARY ="))
          print_string(num.tostr(changeme, num#bin))
          print_string(string(" ... HEX ="))
          print_string(num.tostr(changeme, num#hex))
          print_string(string(" ... DEC="))
          print_string(num.tostr(changeme, num#dec))
          update := changeme                                {update is set to the value of changeme so the loop waits untill their values differ}
    
    



    works pretty well and i can still clear the screen without any jitter

    Post Edited (laser-vector) : 7/30/2010 4:04:16 AM GMT
Sign In or Register to comment.