"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?
"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?
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.
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.
Good tip. The information I'm displaying is RPM, which tends to fluctuate a fair amount.
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/wfse...hp?articleid=7
Then once it's averaged, you can do something like thisThat will reduce the number of LCD writes significantly.Code:IF Value <> LastValue then LastValue = Value LCDOUT $FE,$C0,DEC Value ENDIF
<br>
DT
Bookmarks