CLS for 4X20 LCD?
electromanj
Posts: 270
Hello all.
I am having a little trouble getting the screen to clear on my 4 x 20 LCD. I've tryed a few things but no luck. Thanks for any help!
CON
· _clkmode = xtal1 + pll16x···························· ' use crystal x 16
· _xinfreq = 5_000_000································· ' 5 MHz cyrstal (sys clock = 80 MHz)
· TX_PIN······· = 24
· BAUD········· = 19_200
· cr = 13
···················
OBJ
· LCD·········· : "FullDuplexSerialplus.spin"
PUB Main
· LCD.start(TX_PIN, TX_PIN, %1000, 19_200)
· waitcnt(clkfreq / 100 + cnt)··············· ' Pause for FullDuplexSerial.spin to initialize
··LCD.str(string("Hello, this text will wrap.",16))
I am having a little trouble getting the screen to clear on my 4 x 20 LCD. I've tryed a few things but no luck. Thanks for any help!
CON
· _clkmode = xtal1 + pll16x···························· ' use crystal x 16
· _xinfreq = 5_000_000································· ' 5 MHz cyrstal (sys clock = 80 MHz)
· TX_PIN······· = 24
· BAUD········· = 19_200
· cr = 13
···················
OBJ
· LCD·········· : "FullDuplexSerialplus.spin"
PUB Main
· LCD.start(TX_PIN, TX_PIN, %1000, 19_200)
· waitcnt(clkfreq / 100 + cnt)··············· ' Pause for FullDuplexSerial.spin to initialize
··LCD.str(string("Hello, this text will wrap.",16))
Comments
what is the exact type of your display?
can you provide a datasheet?
The display is a 4x20 backlit from parallax.
I tried to add a ,16 after the text. If I add a ,13 after the text i do get a carrige return.
Thanks
Thanks!
CON
· _clkmode = xtal1 + pll16x···························· ' use crystal x 16
· _xinfreq = 5_000_000································· ' 5 MHz cyrstal (sys clock = 80 MHz)
· TX_PIN······· = 24
· BAUD········· = 19_200
· cr = 13
···················
OBJ
· LCD·········· : "FullDuplexSerialplus.spin"
PUB Main
· LCD.start(TX_PIN, TX_PIN, %1000, 19_200)
· waitcnt(clkfreq / 100 + cnt)··············· ' Pause for FullDuplexSerial.spin to initialize
·
· lcd.str(string(12))·····························'Clear screen return to top
· waitcnt(clkfreq*1+cnt)
· lcd.str(string(17))···························· 'turn on backlight
· waitcnt(clkfreq*1+cnt)
· lcd.str(string(168))·····························'go to row·3 column 1
· LCD.str(string("Hello, this text will wrap."))
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Jon McPhalen
Hollywood, CA
Just one more word about your code ...
Instead of lcd.str( string(168) ) for sending single bytes, you should use the tx function:
lcd.tx( 168 )
It's just a small difference, but if you use this a lot ...
string() occupies one byte for the byte you want to send plus one byte for the string-end byte, which is a $00.
And it will be slightly slower, as lcd.str will run a loop to copy the string to the transfer-buffer. Even if it's only one iteration when sending one byte I'd guess that it takes double time until it returns to the caller.