I am using RL78 Compiler CC-RL. I use a normal function to reference variables whose values are set by an interrupt function, but the values are not reflected.
data = 0;
while(data == 0); /* After data is set to 1 by an interrupt function, exit the loop. */
If the volatile qualifier is not added in the variable definition, a code on which the value is not reflected might be output depending on the optimization settings.
When the variable value changes due to interruption, add the volatile qualifier in the variable definition.
volatile int data;
|CS+ (formerly CubeSuite+)|
|C Compiler Package for RL78 Family|