The bar graphs are adjusted by ADC.Reads on channels 0-2 on a 18F4550. Right now they are just hooked up to some 10k pots, but will eventually be pulling information from the sensors in my car. And since I couldnt get the setimage function to work with octals t6963c library (my fault, not his, its a great driver) I used a LOT of line commands to draw everything.
The thing I'm having trouble with is, that when the rectangles adjust to the different values, the old images are left behind. I am unaware of how to remove this ghosting effect without refreshing the entire screen (which blinks badly due to the time needed to draw the background images again). Does anyone have any advice on how I could accomplish this?
Here is my main program loop...
Code: Select all
//Main program loop
While(true)
Y1Value = 0
Y2Value = 0
XValue = 0
fuel = ADC.Read(0)
temp = ADC.Read(1)
boost = ADC.Read(2)
psi = getpsi(boost)
psinum = getpsivalue(psi)
Y1Value = GetY1Value(fuel)
Y2Value = GetY2Value(temp)
XValue =GetXValue(boost)
//Draw rectangles based on ADC results
//Fuel gauge rectangle
Rectangle(6,57,12,Y1Value)
//Temperature Gauge rectangle
Rectangle(115,57,121,Y2Value)
//Boost Gauge rectangle
Rectangle(37,56,XValue,50)
//psi value
glcd.writeat(64, 36, psinum)