When a statechart is created, a
StateInfo
data type is defined and a few variables of that type are declared.For the previous example, the
StateInfo
data type would be namedStateInfo_All_CTRLcntl
, and would be defined as an unsigned type of 8, 16, or 32 bits (e.g.,typedef int8
StateInfo_A11_CTRLcnt1
)The StateInfo variables will be
currentState
,nextState
, andstaySame
:The
currentState
andnextState
variables will always be allocated. ThestaySame
variable will be allocated only if the entering or exiting reaction function is required.
currentState
is allocated as a global variable, whilenextState
andstaySame
are allocated as local, automatic variables to the statechart function cgDo_....