When creating a global variable, especially when the variable will be used in an ISR (Interrupt Service Routine), this global variable may be eliminated by the compiler (optimized out). To force this variable to be used and not optimized out, declare the variable with its type and 'static volatile' and then the variable.
Example:
type static volatile variable = value;
int static volatile InchesOfHg = 0;
Comments and Additional Information
Have some code to share? Or additional information? Respond here:
You need to be logged in to save a response on this page. The response must be constructive, helpful, supplimentary or to correct the existing video, code or narrative content.