Skip to main content
Renesas Electronics America - Knowledgebase

Reference to variables set by interruption (CC-RL)

Last Updated:05/10/2017


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.


int data;
void func(void)
  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;

Suitable Products
e² studio
CS+ (formerly CubeSuite+)
C Compiler Package for RL78 Family
  • Was this article helpful?