Structuring Language: Activity Chart Implementation : TASK/ISR Run Modes : Single Step Example

Single Step Example

If you select Single Step mode, the code generated for the Task will not include the do..while structure— this creates a single-step Task. In this case, there is no need for the NeedAnotherStep bit named BITSUPERSTEP_<TASK-NAME> to be allocated, so all references to it are removed.

There are references to BITSUPERSTEP_<TASK-NAME> in:

The do...while of a Task.
In the non-Inline of NeedAnotherStep mode— at the end of the cgDo_ function, there is a check if any nextStep is different than the currentStep. If it is, the BITSUPERSTEP is set.
When using an SCH in a generic, the BITSUPERSTEP of its task is passed via its structure. In this case, these references should not exist.

Consider the original code:

void TASK_SINGLE_STEP(void)
{
do
{
cgGlobalFlags &=~BITSUPERSTEP_TASK_SINGLE_STEP;
cgActivity_SINGLE_STEP_CTRL();. MicroC 45
Single Step Example
if(cgDoubleBufferNew_TASK_SINGLE_STEP.cg_Events)
cgGlobalFlags |= BITSUPERSTEP_TASK_SINGLE_STEP;
cgDoubleBufferOld_TASK_SINGLE_STEP =
cgDoubleBufferNew_TASK_SINGLE_STEP;
cgDoubleBufferNew_TASK_SINGLE_STEP.cg_Events = 0;
} while ((cgGlobalFlags &
BITSUPERSTEP_TASK_SINGLE_STEP) != 0);
}
 
 

The resultant code is as follows:

void TASK_SINGLE_STEP(void)
{
cgActivity_SINGLE_STEP_CTRL();
cgDoubleBufferOld_TASK_SINGLE_STEP =
cgDoubleBufferNew_TASK_SINGLE_STEP;
cgDoubleBufferNew_TASK_SINGLE_STEP.cg_Events = 0;
}