I'm trying to do a animation on a LCD using custom characters.
The problem is if I set the delay to under a second then the animation runs fine for a few frames and then the entire LCD gets gibberish spewed all over it.
The faster the refresh, the worse the gibberish.
I'm sending all the data from my computer so the Arduino only needs to do light processing and then send the data to the LCD.
The serial is set at 19200 baud which also should be fine.
Does anyone know if its a limitation of the LCD or would it be something in my code?
I couldnt find any mention of it in the datasheet. Adding a 20ms delay in after setting a custom character doesnt help either.
Are you polling the BUSY flag (or its equivalent) before sending the next command to the LCD?
To save I/O pins, most of my projects connect via a write-only '595 shift register. Since I can't read the BUSY flag, I have to add delays after each character to ensure I don't overrun the slow LCD controller.
I dont have many explicit delays but there is enough code to have the same effect.
I might have found my bug. It seems that sleep in PHP only works off whole numbers.
So sleep(0.5) was actually sleep(0).
Doing some more testing seems to indicate that the serial buffer was being filled hence unpredictable values being executing.
A delay of 100ms seems to be fine. I'll run it for a hour to be sure the buffer isnt slowly filling.
The only reason why it would fill is if its taking longer to send the data to the LCD than the delay from the sending program.