PDA

View Full Version : Displaying Custom Characters on LCD.



wdmagic
- 20th March 2013, 09:24
Darrel and anyone else out there thats messed with custom characters, Ive seen the generator that DT has, and its fine I generated up a couple, but cant seem to get them to display.
from what I understood your supposed to store them in a CG area in the display ram and then call them when needed. this is what I would like to do but I cant even get them on the screen. here is some sample code, what am I getting wrong.


DEFINE LCD_DREG PORTD ' LCD Data bits on PORTD
DEFINE LCD_DBIT 0 ' PORTD starting address
DEFINE LCD_RSREG PORTD ' LCD RS bit on PORTD
DEFINE LCD_RSBIT 5 ' LCD RS bit address
DEFINE LCD_EREG PORTD ' LCD E bit on PORTD
DEFINE LCD_EBIT 4 ' LCD E bit address
DEFINE LCD_BITS 4 ' LCD in 4-bit mode
DEFINE LCD_LINES 4 ' LCD has 4 rows
LCDOUT $FE, 1 ' Clear LCD
PAUSE 500 ' Wait 0.5sec for LCD to initialize
AGAIN:
LCDOUT $FE, 2
LCDOUT $FE,$40,$0E,$1F,$11,$11,$11,$1F,$1F,$1F
pause 1000
GOTO AGAIN ' Repeat
END
My display is supposed to hold 4 CG's I think. I wrote my own generator up into a exe file so I could run it offline. DT's is good too.
but I'm unsure cause right now nothing shows up on screen.
I need a battery symbol so this is the one I designed.
If I cant store the character in lcd ram, can I store it in a variable or string or something (NOT EEPROM)

mackrackit
- 20th March 2013, 12:23
I am not sure that you doing it correctly. See this.
http://www.picbasic.co.uk/forum/showthread.php?t=242&p=46027#post46027

Write the character to the LCD after the LCD has been initialized, do this once.
Then in the body of you code when you want to display the character, call it by address.

spcw1234
- 20th March 2013, 12:26
You are writing the character over and over to ram, but never calling it!

Try this:



DEFINE LCD_DREG PORTD ' LCD Data bits on PORTD
DEFINE LCD_DBIT 0 ' PORTD starting address
DEFINE LCD_RSREG PORTD ' LCD RS bit on PORTD
DEFINE LCD_RSBIT 5 ' LCD RS bit address
DEFINE LCD_EREG PORTD ' LCD E bit on PORTD
DEFINE LCD_EBIT 4 ' LCD E bit address
DEFINE LCD_BITS 4 ' LCD in 4-bit mode
DEFINE LCD_LINES 4 ' LCD has 4 rows
LCDOUT $FE, 1 ' Clear LCD
PAUSE 500 ' Wait 0.5sec for LCD to initialize
LCDOUT $FE,$40,$0E,$1F,$11,$11,$11,$1F,$1F,$1F
pause 500

LCDOUT $FE,$80,0 'Write character on screen
pause 1000

END


EDIT: Too slow :)

wdmagic
- 20th March 2013, 18:21
Ok thanks both of you, I got it now, I checked that link out and saw darrels code and figured it out.

Yea haha writing to ram over and over, dont you just love making mistakes. I get such a laugh outta myself sometimes.

Thank you both.