LCD CGRam question
agentile
Posts: 101
Hello,
· I am trying to create a custom character in a parallel 1x16 LCD display.··I have used one of the articles in StampWorks to get as far as I have.· So far, I have successfully created the degree symbol, which I wanted, but I cannot figure out where it is in CGram.· So, the following code·successfully·creates the character.
CX DATA $07, $05, $07, $00, $00, $00, $00, $00·· ' (degree symbol)
char = $40········ ····················· '·point to CGRAM
GOSUB LCD_Command················ ' prepare to write CG data
FOR index1 = CX TO (CX + 7)······ ' create degree symbol
READ index1, char····················· ' get byte from EEPROM
GOSUB LCD_Write······················ ' put into LCD CG RAM
NEXT
So, now I want to display it on the LCD, and so I write the following code
READ CX+k,char····· ' Read·EEPROM??·or CGRAm?··k is offset value·
GOSUB LCD_Write··· ' write degree symbol
So, for reasons I cannot explain, this code works, even though it appears I am simply reading from EEPROM and not CGRam.· The value of k·was found by trial and error.· The degree symbol shows up for any value of k from·3 to 15.· Why does this work?·· And what I am reading?
More specifically, my question is,·once I have written a character to CGRam, how do I access it?
thanks,
Andrew
·
· I am trying to create a custom character in a parallel 1x16 LCD display.··I have used one of the articles in StampWorks to get as far as I have.· So far, I have successfully created the degree symbol, which I wanted, but I cannot figure out where it is in CGram.· So, the following code·successfully·creates the character.
CX DATA $07, $05, $07, $00, $00, $00, $00, $00·· ' (degree symbol)
char = $40········ ····················· '·point to CGRAM
GOSUB LCD_Command················ ' prepare to write CG data
FOR index1 = CX TO (CX + 7)······ ' create degree symbol
READ index1, char····················· ' get byte from EEPROM
GOSUB LCD_Write······················ ' put into LCD CG RAM
NEXT
So, now I want to display it on the LCD, and so I write the following code
READ CX+k,char····· ' Read·EEPROM??·or CGRAm?··k is offset value·
GOSUB LCD_Write··· ' write degree symbol
So, for reasons I cannot explain, this code works, even though it appears I am simply reading from EEPROM and not CGRam.· The value of k·was found by trial and error.· The degree symbol shows up for any value of k from·3 to 15.· Why does this work?·· And what I am reading?
More specifically, my question is,·once I have written a character to CGRam, how do I access it?
thanks,
Andrew
·
Comments
(I had to search for this one...)
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Until our bytes cross again, may your chips never smoke, your bits never fall off, your parts bin never be empty and your jumpers never fall off.
KK
·
In the program, the character definition is copied from EEPROM to the CGRAM; you have to do this at the beginning of the program because the CGRAM is volitale and it will be lost of power-down.
Note that if you don't need custom characters you can write and read CGRAM and for use as temporary storage.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Jon Williams
Applications Engineer, Parallax
· Let me just make sure I understand.· Once I have written a single character to CGRam, it then becomes labeled as 0.· So, to access the character, I send the character 0 to the LCD·as a write command.· This will·access whatever is sitting in the first eight bytes of CGRam.· Is this correct?
thanks,
Andrew·
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Jon Williams
Applications Engineer, Parallax
It depends on where you saved your character data. When you save it to the LCD (as was pointed out, this is volatile, so it will no longer be there if you power the LCD off), you specify WHERE to save it. If you save it in the first 8 bytes, then "printing" a char 0 will display the character defined by what you saved starting at 0. "Printing" a char 1 will display the character defined by the 8 bytes starting at what you saved starting at byte 8.
Ouch...that was poorly worded, but I need more caffeine....
HTH
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Truly Understand the Fundamentals and the Path will be so much easier...