The implementation of AndState compresses a few otherwise different StateInfo variables into a single one, thus using potentially less RAM. However, in order to relate to each of the different parallel state hierarchies, some ROM is required to implement bit-masking. As a general rule, it is preferable (from a code size perspective) to use AndState when having few independent very small statecharts. The difference in the generated code will be that instead of few control activities, each having related
cgDo_
… functions as is the case with a few Statecharts, here only one such control activity is required with one relatedcgDo_
… function. This code for such a function will only appear once. The function’s code frame would resemble the following:}. MicroC 65… The rest of the Statechart logicOn the other hand, the test for being in leaf-state will be done using the inState test and not inLeafState test. The inState test requires one more integer comparison then the inLeafState test. Thus, it is recommend for each particular case that the developer test both options and compare the results to choose the optimum implementation.