PDA

View Full Version : LCD output "smoothing"



DynamoBen
- 17th September 2005, 02:50
I am receiving values serially and displaying them on an LCD. Unfortunately, I'm receiving them quicker than the LCD can display them. I'm currently receiving the data via interrupts.

What is a good method of "smoothing" out the values so they are readable?
I have considered removing the interrupt but thought I would post prior to going that route. Thoughts?

mister_e
- 17th September 2005, 19:25
if you mean you receive many different data in a really short delay but you want to display them all... it will be hard/impossible.

Is Reduce the transmitter refresh time an option???

Sending to LCD a data on Xn receive

Average them

and i can be totally off... once again!

A delay of few millisecondes between each display is suitable... let's say 100 mSec and up.

Ron Marcus
- 18th September 2005, 20:09
"What is a good method of "smoothing" out the values so they are readable? "

Is it a single variable that changes quickly, or a number of different variables that must be displayed?

DynamoBen
- 18th September 2005, 21:52
Single variable that is changing quickly.

modifyit
- 19th September 2005, 03:32
You could always delay how often you are displaying to the lcd. Create a counter so you only send commands to the LCD every 10th time through your program loop instead of everytime. You won't display everything you are recieving serially this way, but it may not matter.

Ron Marcus
- 19th September 2005, 04:29
There's a great bit of code on the Melabs site for using the hardware serial port and interrupts. It creates a ring buffer that automatically collects the incoming serial data. When your program is ready, it can average the data that is in the ring buffer and display it. If you need to display every little change of the variable, then you would display a "snapshot" of the last 10, 20, or 128 values that were captured. The ring buffer continually overwrites itself, so if there was a specific event, you can stop it, or just read values on the fly. Take a look at "serA452.bas". I tip my hat to whomever wrote it.

DynamoBen
- 19th September 2005, 05:14
Good tip. The information I'm displaying is RPM, which tends to fluctuate a fair amount.

Darrel Taylor
- 19th September 2005, 08:30
Hi again Ben,

Sounds like you just need a little averaging.

Averaging 16 bit values without using 32 bit math?
http://www.pbpgroup.com/modules/wfsection/article.php?articleid=7

Then once it's averaged, you can do something like this
IF Value <> LastValue then
LastValue = Value
LCDOUT $FE,$C0,DEC Value
ENDIFThat will reduce the number of LCD writes significantly.
<br>