Canoe7           Creating a Second Panel Using the First Panel as a Template

Making a second panel using the first panel as a template is quite simple.

14) If the Panel Editor is still running, make sure all the changes have been saved to the first panel before the second panel is created. If not, start the Panel Editor application and open the first panel, "aaa.cnp".

15) Go to File Save As.

16) Again maintaining the extension .cnp and the path to the “new1” directory, name the file "bbb.cnp".
Click [Save].

17) Go to Options Window setting.... Change the panel name to "bbbPanel". Click [OK].

18) Double click on the rocker switch and change the environment variable name from "aaaSwitch_1A" to
"bbbSwitch_1B". Click [OK].

19) Double click on the pushbutton switch and change the environment variable name from "aaaSwitch_2A" to "bbbSwitch_2B". Click [OK].

20) Double click on the indicator and change the environment variable name from "aaaIndicator_A" to
"bbbIndicator_B". Click [OK].

21) Select and then double click on the "aaaSwitch_1A" text box and change the name in the Text section from "aaaSwitch_1A" to "bbbSwitch_1B". Click [OK].

22) Select and then double click on the "aaaSwitch_2A" text box and change the name in the Text section from "aaaSwitch_2A" to "bbbSwitch_2B". Click [OK].

23) Select and then double click on the "aaaIndicator_A" text box and change the name in the Text section from "aaaIndicator_A" to "bbbIndicator_B". Click [OK].

24) Now, save the panel by going to File Save.

25) Exit the Panel Editor.

4.7   Place the Panels into the CANoe Environment

Next, we move back into the CANoe application to get our new panels interconnected.

1)   In CANoe, select the menu command Configuration Panel Configuration.

2)   Click the [Add…] button.

3)   Locate the panel files aaa.cnp and bbb.cnp in the new directory. Using the <Shift> key, click both panels and open them.

4)   Expand the drop down list next to Window type for newly configured panels and select “Standard Window”. This will create a new window outside of CANoe for each panel. (“MDI Window” will display the panels inside the CANoe program environment.)

5)   Click [OK].

Both panels should now appear on the screen. (It is possible that they may be behind the main CANoe window.)

1)   If necessary, adjust the position of both panels and the main CANoe window to allow each window to be viewed.

2)   Using the main menu, select File Save Configuration.

Note: Panel files can be created in CANoe with either the Panel Designer or the Panel Editor, and both types of files (*.xvp and *.cnp) can be stored together in the same folder. Both can be opened with the Panel Configuration dialog, so that both may appear and be used at the same time. Panels should already have been added to the configuration if the blue meter with the ‘+’ was pressed in Panel Designer. In this tutorial, we will only use the panels created in Panel Designer.

 4.8   Create Node Behavior

Next, we use the CAPL programming language feature of CANoe to give behavior to our two nodes.

A CAPL program is usually developed in the CAPL Browser. The Browser window is subdivided into three distinctive areas, or panes. The left pane contains a tree view of all important elements for which a CAPL program can be written. The area on the upper right is where global variables will be placed for the CAPL program, and the area below it is where the actual source code for each event procedure is written

4.8.1   Programming Node AAA Behavior

We will begin by associating one of the panel switches on the “aaa panel to transmit a message onto the CAN

1)   In the Simulation Setup window of CANoe, click on the pencil icon located on the lower left corner of the “AAA” network node to open the CAPL Browser.

2)   An Open dialog window will appear, asking for the CAPL program to be given a name. Type in
“AAA.can” and save the file in the “new1” directory. Then, click on Open.

3)   In the upper right pane (Global Variable Definitions) of the CAPL Browser, enter the following code:

variables {
message aaaMsg aMsg; // this is the only line that needs to be to typed in

4)   In the tree view at the left, right click on "Environment" (Environment Variable) and select New. An empty procedure for the environment variable appears in the bottom right window.

5)   Right click on the highlighted “<newEnvVar>” and select Environment variable from CANdb....

6)   Select the variable "aaaSwitch_1A" from the list and click [OK].

7)   Enter the following code:
on envVar aaaSwitch_1A{

8)   On the toolbar, click the "Compile" icon (a single arrow pointing down onto a stack of papers) or select Compiler Compile. (If a compile error is shown, then double click on the listed error line to get to the line in the program causing the problem.)

9)   On the bottom window, make sure the last line says “Compiled …”. If not compiled successfully, make sure the code is entered exactly as shown in Steps 3 and 7.

10) On the upper menu, go to File Save to save the CAPL program. Then, close the CAPL Browser.

1 comment:

  1. Hi , I am Not able to see "environment" in tree list, I am using Canoe 16 demo version, can you help how to set environment in db file?