MicroC Code Generator : Code Options : Setting the Time Scale : Working with Multiple Counters

Working with Multiple Counters

Each time expression calculation is based on a counter, which operates at a fixed tick rate, for example, 1 ms per tick. The units of the expression are translated into ticks according to the Time Expression Scale.

Rational Statemate MicroC lets you work with multiple counters simultaneously, where each counter can run at a different tick rate.

The default counter used by the model is defined in the code generator's profile (Options > Settings... > OS Tab > Primary Software Counter),

You can use a different counter with each of the operators using “Time Expression”:

1.
For tm(), the 3rd (optional) parameter can specify the counter to be used with this operation – “Primary Software Counter” is used if 3rd parameter is omitted.
2.
3.
For dly(), the “Primary Software Counter” is used, so the user cannot select the counter this operation will use. If such definition is required, use tm() instead. (if the dly() operation is used on a transition exiting from State “S1”, then: dly(10) is similar to tm(en(S1),10) )