The function displaySensor is repeatedly called from another function called from an infinite loop in main(). Basically main calls goSensor() which collects the data from the ADC and then goSensor() calls displaySensor to display the value on the LCD. sensVal is reinitialed and then reset in goSensor().
If i call goSensor() once, (outside of the main loop) it works fine. However, when i call it repeated i get some junk on the screen after the first call. So it seems to me like i need to reinitialize something.
itoa is a C18 function which converts the integer, sensVal, to a string, tmpString, and returns a pointer to this data. putsXLCD() then displays the buffer at this pointer location. I think this pointer location is getting messed up or something.
Can you guys think of a better way to do this or a way to tidy it up to avoid data corruption?