Shop OBEX P1 Docs P2 Docs Learn Events
Invert Display font on Parallax 2x16 display? — Parallax Forums

Invert Display font on Parallax 2x16 display?

eagletalontimeagletalontim Posts: 1,399
edited 2012-12-16 20:09 in Propeller 1
Not sure if this is the correct word for this, but I would like to "invert" the font on the parallax 2x16 display just on one line. By invert, I mean to turn off the pixels that show the letter and turn on the pixels around it so instead of having black letters, the background would be black and the font would be "clear"?

Comments

  • MagIO2MagIO2 Posts: 2,243
    edited 2012-12-16 13:19
    Don't know the details of the parallax display, but normally text-displays can't invert the font. The font is part of the displays ROM. There are only a few characters that can be uploaded (4 or 8 ... don't remember right now).

    What I do is enclosing the actual menu entry like this
    > Entry 1 <
  • eagletalontimeagletalontim Posts: 1,399
    edited 2012-12-16 13:24
    Some of my menu items are shortened to fit in the 16 character limit so I am limited in that aspect :( I think I will try to just use the lcd.cursor(2) option unless there is an underline option.
  • JonnyMacJonnyMac Posts: 9,192
    edited 2012-12-16 13:54
    You cannot do that with a standard character-based LCD. You would need a bitmapped LCD and then write appropriate an appropriate graphic driver for it.

    I did a menu-based program using a character LCD last year where I used a custom character (big arrow) to indicate the active item in the display. For values that could change I also turned on the underline cursor and put it under the least-significant digit of the value to change.
  • eagletalontimeagletalontim Posts: 1,399
    edited 2012-12-16 14:00
    I am trying to figure out how to make an arrow that fits in one character spot right now. I think I can squeeze one character into the menu lines. So far, the menu seems to be working pretty good. May not be the best way to do it, but it works.
  • davejamesdavejames Posts: 4,047
    edited 2012-12-16 14:04
    eagle,

    Starting on page 7 of the LCD doc:
    http://www.parallax.com/Portals/0/Downloads/docs/prod/audiovis/27976-7-9-ParallaxSerialLCD-v3.0.pdf

    you'll find the list of commands supported. Unfortunately, inverted characters are not included as Mr. McPhalen has related. I really wish they were as I could seriously use them in a project.
  • JonnyMacJonnyMac Posts: 9,192
    edited 2012-12-16 17:39
    Have you seen this? I do a lot of LCD work and wrote this simple little app when I worked for Parallax. It makes it easy to create custom characters. When you get what you like just copy-and-paste the data bytes into your program.

    -- http://www.parallax.com/ProductInfo/Microcontrollers/BASICStampSoftware/LCDCharacterCreator/tabid/482/Default.aspx

    I just used this the other day to create three characters that run in sequence while a device is waiting on a GPS receiver to lock. Here's what my code looks like:
    dat
    
    Char0                   byte    $00, $00, $00, $00, $00, $00, $00, $00
    Char1                   byte    $00, $00, $00, $04, $00, $00, $00, $00
    Char2                   byte    $00, $00, $04, $0E, $04, $00, $00, $00
    Char3                   byte    $0E, $11, $04, $0E, $04, $11, $0E, $00
    

    display.start(LCD, 19_200, 2)                                 ' start lcd
      display.custom(0, @Char0)                                     ' load custom charactersw    
      display.custom(1, @Char1)
      display.custom(2, @Char2)
      display.custom(3, @Char3) 
      display.backlight(true)                                       ' activate backlight
    


    I have my own serial LCD object which is based on the one I wrote back in 2006 while at Parallax. It's attached in case you want it.
  • JonnyMacJonnyMac Posts: 9,192
    edited 2012-12-16 17:51
    Unfortunately, inverted characters are not included as Mr. McPhalen has related. I really wish they were as I could seriously use them in a project.

    Well, you can have up to eight inverted characters in a display. What you can also do it update a custom character on the fly. When you do this, the display will automatically update to the new definition. I did an odometer demo a long time ago that could display a rolling digit in the 10ths value of the display. The code worked by using a single character and updating it's definitions based on the 1/100ths value to create the roll position.
  • davejamesdavejames Posts: 4,047
    edited 2012-12-16 19:08
    JonnyMac wrote: »
    Well, you can have up to eight inverted characters in a display.

    ...well, gee - that makes sense! Roll my own? It never occured to me. Slow thinking, I am.

    And, I wasn't aware the characters could be updated on-the-fly. Thanks much for that tidbit!
  • JonnyMacJonnyMac Posts: 9,192
    edited 2012-12-16 20:09
    And, I wasn't aware the characters could be updated on-the-fly.


    It's a very useful trick to know. On a project I'm working on this evening I do a little animation while waiting on GPS:
    t := cnt                                                      ' sync timer
      repeat timeout from 1 to 120                                  ' allow up to 2 mins
        repeat idx from 0 to 3                                      ' four chars in animation
          display.goto_xy(0, 1)                                     ' second line, 1st char
          display.tx(idx)                                           ' animation
          waitcnt(t += constant(250 * MS_001))                      ' wait 1/4 second
         
        if (gps.n_gpsfix)                                           ' if found                         
          quit                                                      '   break out of search loop
    


    In this case I'm using custom characters 0..3 for the animation. If I didn't have four available characters, I could and would do this:
    display.goto_xy(0, 1)                                         ' second line, 1st char
      display.tx(0)                                                 ' write animated character
    
      t := cnt                                                      ' sync timer
      repeat timeout from 1 to 120                                  ' allow up to 2 mins
        repeat idx from 0 to 3                                      ' four chars in animation
          display.custom(0, @Char0 + idx << 3)                      ' update definition 
          waitcnt(t += constant(250 * MS_001))                      ' wait 1/4 second
         
        if (gps.n_gpsfix)                                           ' if found                         
          quit                                                      '   break out of search loop
    
Sign In or Register to comment.