Shop OBEX P1 Docs P2 Docs Learn Events
Custom character on LCD — Parallax Forums

Custom character on LCD

SabaiSabai Posts: 27
edited 2009-10-27 19:03 in BASIC Stamp
I am trying to make a custom character but I can not get it to work.

I creat the character:
Char12 DATA %01000
      DATA %10100
      DATA %01000
      DATA %00000
      DATA %00000
      DATA %00000
      DATA %00000

Char13 DATA %01000
      DATA %10100
      DATA %01000
      DATA %00000
      DATA %00000
      DATA %00000
      DATA %00000



And save it to the LCD
Download_Chars:                                 ' download custom chars
 char = LcdCGRam                               ' point to CG RAM
  GOSUB LCD_Cmd
   FOR idx = Char12 TO (Char13 + 7)                              ' prepare to write CG data
               ' build 4 custom chars
    READ idx, char                             ' get byte from EEPROM
    GOSUB LCD_Out                               ' put into LCD CG RAM
   NEXT



But how do I use it?

Comments

  • MoskogMoskog Posts: 554
    edited 2009-10-25 18:19
    Try this way to create an Arrow up·custom char: (BS2 and Parallax LCD)
    ' {$STAMP BS2}
    ' {$PBASIC 2.5}
    LCD             PIN     1               ' serial output to LCD
    LcdBaud         CON     32              ' 19,2K baud
    LcdLine1        CON     $94             ' move to line 1, column 0
    LcdCC4          CON     $FC             ' define custom char arrow up
    tall            VAR     Word            ' Global word, used in several routines
    index           VAR     Nib             ' Loop Counter   (max 0-15)
     
    CC4             DATA    LcdCC4, $04, $0E, $15, $04, $04, $04, $04, $00    'arrow up sign
     
    Download_Chars:
    FOR index = 0 TO 8                      ' Download Custom Character arrow up
        READ CC4 + index, tall              ' Read EEPROM Data
        SEROUT LCD, LcdBaud, [noparse][[/noparse]tall]         ' Send To LCD CGRAM
      NEXT
    
    'Output to LCD:
    SEROUT LCD, LcdBaud, [noparse][[/noparse]LcdLine1, 4," Arrow up"]
    
    
  • SabaiSabai Posts: 27
    edited 2009-10-25 18:28
    Thanks for your replay but I am using a parallel LCD
  • PJAllenPJAllen Banned Posts: 5,065
    edited 2009-10-25 18:39
    Assuming that you're writing to the CGRAM ($00 .. $0F, which is decimal 00 .. 15)·then you use that font code.

    $41 is the font code for an·A, so you send $41 to get that letter.

    You're storing character data for codes $12 and $13 (??) so you'd send a $12 or $13 as nec.
  • SabaiSabai Posts: 27
    edited 2009-10-25 18:53
    PJ Allen said...
    Assuming that you're writing to the CGRAM ($00 .. $0F, which is decimal 00 .. 15) then you use that font code.

    $41 is the font code for an A, so you send $41 to get that letter.

    You're storing character data for codes $12 and $13 (??) so you'd send a $12 or $13 as nec.

    Sorry I do not understand this!
  • PJAllenPJAllen Banned Posts: 5,065
    edited 2009-10-25 19:50
    Oh, wow!
  • SabaiSabai Posts: 27
    edited 2009-10-27 16:31
    Anybody know how to do this???
  • JDJD Posts: 570
    edited 2009-10-27 17:55
    Sabai,

    We have a book that I think would serve you well; it's Smart Sensors & Applications. It covers how to use a LCD display from general commands, to creating custom characters and the explanation behind it all. Here is a link for your convenience. There is a PDF and sample code that you can use.

    Smart Sensors & Applications:
    http://www.parallax.com/Store/Books/EducationalTexts/tabid/181/CategoryID/66/List/0/Level/a/ProductID/420/Default.aspx?SortField=ProductName%2cProductName

    I hope this helps,

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Respectfully,


    Joshua Donelson
    www.parallax.com
  • SabaiSabai Posts: 27
    edited 2009-10-27 18:10
    Jepp it covers serial LCD but I am still using a paralell. From the example 12 do they have this code to call the stored characters.

    Animation:
    FOR idx1 = 0 TO 15 ' cover 16 characters
    READ (Msg2 + idx1), newChar ' get new char from Msg2
    FOR idx2 = 0 TO 4 ' 5 characters in cycle
    char = LcdLine2 + idx1 ' set new DDRAM address
    GOSUB LCD_Cmd ' move cursor position
    LOOKUP idx2, [noparse][[/noparse]0, 1, 2, 1, newChar], char ' get animation "frame"
    GOSUB LCD_Out ' write "frame"
    PAUSE 100 ' animation delay
    NEXT
    NEXT
    PAUSE 2000

    But I do not understand how the character are called I can see them but not how to call them.
  • JDJD Posts: 570
    edited 2009-10-27 18:21
    Sabai,

    Sorry about that, didn't even catch it was a parallel LCD; However, there is another book that I would suggest reading up on. It's called the StampWorks Manual,·it covers using the Parallel LCD with the BASIC Stamp 2 module; there is sample code and PDF (LCD control starts on pg 73)·like the previous book.

    StampWorks Manual:
    http://www.parallax.com/Store/Books/BASICStamp/tabid/168/CategoryID/42/List/0/Level/a/ProductID/144/Default.aspx?SortField=ProductName%2cProductName

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Respectfully,


    Joshua Donelson
    www.parallax.com
  • SabaiSabai Posts: 27
    edited 2009-10-27 18:50
    Got that book but I can not say that it covers the subject very well the code I mention in my last post is from that book.
  • JDJD Posts: 570
    edited 2009-10-27 19:03
    Sabai,

    The custom characters are being called with the LOOKUP command. As the program cycles from 0 - 15 (for a 2x16 display) the pac-man looking character goes through 3 different steps each time; 0,1,2,1 to simulate "eating" of characters that are already shown.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Respectfully,


    Joshua Donelson
    www.parallax.com
Sign In or Register to comment.