Creating a Traffic Light in MicroC : Exercise 6 - MicroC Code Generation

Exercise 6 - MicroC Code Generation

This exercise builds a MicroC Code generation profile and generates code for the traffic light system.

1.
Click Statemate MicroC Code Generation tool from the main Rational Statemate window.
2.
If no profiles currently exist, the New Compilation Profile window automatically opens. If other profiles exist, select File > New Profile. The New Compilation Profile window opens.
3.
Type the name TRAFFIC_LIGHT_UC in the Profile Name: field.
MicroC Profile
4.
Click Create New SW Module and name the module TRAFFICLIGHT_MOD in the Create Module window.
5.
Click on the module and then click Add Selected Chart with Descendents to Profile. This opens a Chart Tree View of your current design. See the figure.
Chart Tree View
6.
Select the chart called TRAFFIC_LIGHT_SS from the Chart Tree View then click OK.
7.
Click Add Selected Panel to Profile from the MicroC profile window. The Add Panels to Profile window opens.
8.
Select the TRAFFIC_LIGHT_PNL that was created earlier in the exercise.
9.
10.
Select the Options > Set Target Configuration from the MicroC Profile window.
11.
Select the MAINLOOP_SC_NT configuration. See the figure.
12.
Set Target Configuration
13.
Select File > Save from the MicroC Profile window.
14.
Select Generate Code for Current Profile in the MicroC Profile Window. This opens the Output directory for the generated code.
15.
Click OK in the Output Directory window to accept the location for the generated code.
16.
Click Dismiss in the generated Code window.
17.
Select Compile Generated Code in the MicroC Profile window to compile the generated code. This opens the Selected Makefile window.
18.
Select Open to begin compilation of the code.

The resulting compilation output is sent to a “Command Prompt Window.” Once compilation is completed, exit out of the command prompt window.
19.
The GBA Server allows you to open charts for animation. Select Tools > Open GBA from the MicroC Profile window. The GBA Server window opens. See the figure.
GBA Server
20.
Click Execute Compiled Code from the MicroC Profile window and then select the Open option from the Run Command window to start the code execution.
Note:
21.
Click CHANGE multiple times. Different light indicators illuminate with their respective colors. See the figure.
Panel Execution