PIC16f777 Global Variable Not Updating
I have written some code for a thermometer that uses an LCD screen and a small matrix keypad. I am not using any libraries. My issue is that my global variable, calData, is not staying changed after calibrate() changes its value. Thermometer() still sees calData as it was initially assigned. Here is my relevant code.
unsigned char calData=190;
//prototypes, functions etc.
static char digit1,digit2;
//get user input from keypad and turn into numbers...
//print out what was entered and new calData value
//lcd stuff and formatting...
//get and scale adc value then some math...
temperature=temperature*(-0.12)+calData; //temperature is now in degrees C
//more math...parse and print
When I print the value of calData inside of Calibrate, the value is the new user-inputted value. However,
When I call thermometer(), calData is still 190, and not what calibrate() changed it to. I have tried using pointers instead of manipulating calData directly, but the issue persists. I have also tried making calData volatile, and every other keyword with no avail. Please Help!