AXE033 LCD via i2C : Ideas to speed it up ?

Jeremy Leach

Senior Member
Hi

I've been working on the code for my user-interface PicAxe and the button/menu system. It's looking good, (thanks to the Lookup command) but the display updates pretty slowly.

I'm thinking of any ways to improve the speed, even slightly. I'm thinking about the way data is written to the LCd using :

Writei2C 0,(DataByte,255)
Pause 10

My understanding (from the manual etc) is that the display buffer is at address 0, it can store 20 bytes. I'm guessing that the 255 value is a special value that tells the display that the buffer is ready to be displayed.

At present I'm writing each character, followed by Pause 10. I'm thinking that perhaps I can fill the buffer first without pauses , then write a 255 value to trigger the display, followed by a pause. Would this work? Would I need to write to address 0, 1,2, etc ? Not sure. Any ideas welcome.

The Pause 10's aren't really a great amount, so I'm not sure that they are the slow factor anyway. I've noticed that writing blank characters is very fast compared to writing anything else. Which leads me onto another question :

When using writei2C is there some form of handshaking with the target device? ie, does program execution have to wait while the handshaking is taking place, and that for some data types the wait is longer than others??
 

Technical

Technical Support
Staff member
You are correct about buffer and 255 'start' character. There is some handshaking but this is negligable compared to the 10ms write time.
 

Jeremy Leach

Senior Member
Thanks. But can I fill the buffer first with separate Writei2c commands for each byte, then issue the 255 start instruction?

For instance, instead of :
1. TEXTBOOK EXAMPLE
Writei2c 0,("Hello",255)
Pause 10

Do this:
2. POSSIBLE EXAMPLE ?
Writei2c 0,("H")
Writei2c 1,("e")
Writei2c 2,("l")
Writei2c 3,("l")
Writei2c 4,("o")
Writei2c 5,(255)
Pause 10

The reason I want to send individual characters is because I want to use a generic routine to write strings to the LCD and the only way I can see of writing a variable string is writing each byte.

It would be good if I could fill the buffer first as at present I'm doing this for each character, which is a bit slow :

3. CURRENT EXAMPLE:
Writei2C 0,(CharToSend,255)
Pause 10


I've actually tried the 'possible' example above and it doesn't work - but why not ?
 

Technical

Technical Support
Staff member
Address 0 is an i2c 'virtual' buffer - you do not actually write to address, 0, 1, 2 etc. Therefore all your writes need to be to address 0.
 
Top