An and 1 112 Canoe Tutorial

April 2, 2018 | Author: Shaddai Sg | Category: Button (Computing), Icon (Computing), Computer File, Double Click, Databases


Comments



Description

CANoe TutorialVersion 2.0 2008-07-25 Application Note AN-AND-1-112 Restrictions Abstract Public Document This is a step-by-step tutorial to introduce the basic process of developing a simple CANoe application. Used as a guide, the beginning user will get up the curve quickly. In addition to the tutorial, a short set of helpful CANoe topics is also presented. Table of Contents 1.0 Overview ..........................................................................................................................................................2 2.0 First CANalyzer, Then CANoe.........................................................................................................................2 3.0 Creating a CANoe Application .........................................................................................................................2 3.1 Create a New Directory .................................................................................................................................2 4.0 CANoe Development – Six Step Process........................................................................................................2 4.1 Create a Database ........................................................................................................................................2 4.1.1 Create the Database File............................................................................................................................2 4.1.2 Define the Network .....................................................................................................................................3 4.2 Create the Database Nodes..........................................................................................................................3 4.3 Creating Database Messages.......................................................................................................................3 4.3.1 Creating Database Message Content.........................................................................................................3 4.3.1.1 Create an Input Switch – aaaMsg (switch_1A) ........................................................................................3 4.3.1.2 Create another Input Switch – aaaMsg (switch_2A)................................................................................4 4.3.1.3 Create an Output Indicator – aaaMsg (Indicator_A) ................................................................................5 4.3.1.4 Create Another Message – By Duplication ..............................................................................................6 4.3.1.5 Create Database Environment Variables for Node AAA .........................................................................7 4.3.1.6 Create Database Variables for Node BBB...............................................................................................9 4.4 Associate the Database ..............................................................................................................................10 4.5 Add Nodes to the Network ..........................................................................................................................10 4.6 Create Panels..............................................................................................................................................11 4.6.1 Creating a New Panel...............................................................................................................................11 4.6.1.1 Panel Designer.......................................................................................................................................11 4.6.1.1.1 Adding a Panel Switch, Push Button, and Indicator Switch ..............................................................12 4.6.1.1.2 Creating a Second Panel Using the First Panel as a Template........................................................15 4.6.1.2 Panel Editor............................................................................................................................................16 4.6.1.2.1 Adding a Panel Switch ......................................................................................................................16 4.6.1.2.2 Adding a Push Button Switch to the Panel .......................................................................................16 4.6.1.2.3 Adding an Output Indicator ...............................................................................................................17 4.6.1.2.4 Creating a Second Panel Using the First Panel as a Template........................................................18 4.7 Place the Panels into the CANoe Environment ..........................................................................................19 4.8 Create Node Behavior.................................................................................................................................19 4.8.1 Programming Node AAA Behavior ...........................................................................................................20 4.8.2 Creating an Empty Function For Node BBB.............................................................................................21 4.8.3 Programming Node BBB Behavior ...........................................................................................................23 5.0 Conclusion .....................................................................................................................................................24 6.0 Overview of Interrelated CANoe Files ...........................................................................................................24 7.0 Compatibility with Other Source Code Editors ..............................................................................................25 8.0 Additional Resources .....................................................................................................................................25 9.0 Contacts .........................................................................................................................................................25 1 Copyright © 2008 - Vector CANtech, Inc.CANtech, Inc. Contact Information: www.vector-cantech.com or ++1-248-449-9290 CANoe Tutorial 1.0 Overview This application note is a step-by-step tutorial to introduce the basic process of developing a simple CANoe application. Used as a guide, the focus is to help the beginning user get up the curve quickly. In addition to the tutorial, a short set of helpful CANoe topics is also presented. 2.0 First CANalyzer, Then CANoe Since CANalyzer is used as a portion of the foundation for CANoe, it is quite beneficial to learn the basic features and operation of CANalyzer first before learning CANoe. The Vector Application Note “Quick Introduction to CANalyzer” (see Section 8, "Additional Resources") is a helpful guide for those also beginning with CANalyzer. 3.0 Creating a CANoe Application In this step-by-step tutorial, we will develop a simple application to primarily teach the CANoe development process. 3.1 Create a New Directory 1) Before starting up CANoe, create a new directory called "new1" to contain the new configuration. Consider locating this directory close to the CANoe application directory. 2) Start CANoe and use the main menu to go to File → New Configuration. A prompt appears to select a template. Choose the one that fits the situation, or if you are not sure, select the default template. 3) Go to File → Save Configuration As. Name the file "new1.cfg" using a path to the new directory name. Then click [OK]. 4.0 CANoe Development – Six Step Process The creation of a new CANoe application involves six key steps. 1) Create a Database 2) Create Nodes 3) Associate the Database 4) Create Panels 5) Place the Panels into the CANoe Environment 6) Create Node Behavior 4.1 Create a Database 4.1.1 Create the Database File 1) On the CANoe toolbar, click the CANdb++ Editor button (the one with 4 interconnected red nodes) to launch the integrated database tool. 2) In CANdb++ Editor, go to File → Create Database. A prompt appears to select a template. Choose the one that fits the situation, or if you are not sure, select the empty template. For this tutorial, we will select the empty template. 3) Save the file as a DBC file called "new1.dbc" in the directory just created. Application Note AN-AND-1-112 2 CANoe Tutorial 4. 4) Set the DLC (Data Length Code) to 2. Right-click on it and select New. Right click on it and select New. switch to the Messages tab and click the [Add] button. for 2 bytes of data in the message. Right-click on it and select New. follow these steps to define the network properties (the properties list is different in each template): 1) Select 'Networks' from the tree view at the left. enter "switch_1A". However. For Byte Order. 4.1. Name the second node "BBB". right-click on it. 4. no additional network definitions need to be defined. click [OK]. proceed as follows: 1 2 3 4 5 6 7 In the CANdb++ Editor. 2) Name the first message "aaaMsg". 1) Select View → Value Tables. point at 'Network Nodes' in the tree view at the left. To do this.2 Define the Network If the empty template is selected. To do this. Now. we want our Boolean 0 and 1 to represent the switch being either "on" or "off". Then. select “Signals" in the tree view on the left. Name the first node "AAA". Next. and select New.2 Create the Database Nodes 1) Select "Network Nodes" from the tree view on the left.. Make sure to set "Minimum" to 0 and "Maximum" to 1. Application Note AN-AND-1-112 3 . 3) On the Attributes tab.1.3. 2) Again.. set the attribute values for this network. Our input switch signal will indicate whether it is on or off in our first message.. click [OK]. if one of the other templates is selected. Enter "1" for Length (bit) of the message. Now we need to put signals in our message.1 4. Select our message (the only one there) and click [OK]. For the signal Name. 2) Right-click anywhere on the empty page and select New. 4. Select the network node "AAA" and then click [OK].1 Creating Database Message Content Create an Input Switch – aaaMsg (switch_1A) Signals are variables that occupy the data field space of a message. Click [OK] to exit the dialog. 3) Select CAN Standard (11 bit) in the Type: drop down menu and insert "1AA" as the message Identifier. 2) Right-click on ‘new1’ and select Edit Network. 5) Select the Transmitters tab and click [Add] to add a transmitter to send our message.3. Then. 3) Save the database via File → Save. select either "Intel" or "Motorola".3 Creating Database Messages 1) Select "Messages" in the tree view on the left. (Depends on the micro being used) Select "unsigned" for the Value Type. expand the Value Table drop down list and select Switch_Positions. Then. Replace it with the word "Off". right-click on "switch_1A" and select Edit signal. e. click on "Description for the value '0x0'". 1) Select "switch_1A" in the tree view at the left or right. Then. hit [Enter]. hit [Enter]. Our signal should now look like this in the CANdb++ Editor: Figure 1 – Signal "switch_1" in the CANdb++ Editor 4. 10) On the Definition tab. 6) Click the [Add] button again.3. The value table "Switch_Positions" now appears in the window.. 7) Click [OK] to exit the dialog. right-click on it. 4) A dialog box for switch_1A_Copy_1 opens. 3) The signal switch_1A_Copy_1 appears in the tree view at the left and in the right window under "switch_1A". (The name cannot contain spaces!) 4) Switch to the Value Descriptions tab and click the [Add] button. "Switch_Positions". This time replace "Description for the value '0x1'" with the word "On". 11) Click [Apply]. and select Copy. 2) Right-click in the right window and select Paste. On the right side. Selecting a value table here associates the values so that "0" is "Off" and "1" is "On". Double-click on it.1.g. 9) Select the “Signals”.2 Create another Input Switch – aaaMsg (switch_2A) Making a second switch using the first switch as a template is quite easy. then [OK] to finish.CANoe Tutorial 3) Name the value table. 8) Go back to the Overall View window. Application Note AN-AND-1-112 4 . 5) For the value "0x0" which appears. and select Edit Message. 6) Go to the Messages tab and click the [Add] button to add the 'aaaMsg (0x1AA)' message. 8) Go to the Signals tab and click [Add]. 7) Select "aaaMsg (0x1AA)" from the tree view at the left... 1) Select Signals in the tree view at the left.3 Create an Output Indicator – aaaMsg (Indicator_A) Now.1. 6) Click [Apply]. and select New. select the signal "Indicator_A" in the right window. 3) Click [Apply]. then click [OK] to finish. right-click on it. We will now change where the signal starts in the message.3. then [OK] to finish. change "switch_1A_Copy_1" to "switch_2A". we are ready to create another type of signal in our message. then [OK] to finish. right-click on it.. enter "Indicator_A". 9) Select our new "Indicator_A" signal and click [OK]. Our message "aaaMsg" should now look like this in the Overall View: Application Note AN-AND-1-112 5 .CANoe Tutorial 5) In the Name box. 4) Select "unsigned" for the Value Type.. 4. Right-click on the blue line and select Edit mapped Signal. 5) Expand the Value Table drop-down menu and select Switch_Positions. change the value from "2" to "8". then [OK] to finish. 2) For Startbit (bit). 10) Click [Apply]. 3) Enter “1” for the Length (bit) of the signal. 1) While the message is still selected in the tree view. 7) Click [Apply]. The start bit will now be "8" in the blue line for this signal. 2) For the signal Name... 4 Create Another Message – By Duplication Creating a second message using the first message as a template is quite easy. 2) Select (highlight) Signals. 2) Select Messages in the tree view. 5) Change the message Identifier from "0x1AA" to "0x2BB". select the transmitter "BBB". 7) In the window that pops up. Click [Yes]. 3) Double-click on the message "aaaMsg_Copy_1".3. 1) Right click on “Indicator_A” and select Copy. we will create unique signals for this message by duplicating the three signals we have previously made. right-click on it. right-click on it. 9) Click on [Apply] and click [OK]. Application Note AN-AND-1-112 6 . Next.1. 10) The question: "Shall Node BBB remain as sender of the message?" will appear. Note: Unique signals are used to easily define signals associated to a message. 1) Select the message "aaaMsg" either in the tree view at the left or right. right click and select Paste. and select Paste. 8) Select the Signals tab and remove each signal associated to it by selecting the signal and click [Remove…]. 4) Change the message name from "aaaMsg" to "bbbMsg".CANoe Tutorial Figure 2 – Message "aaaMsg" in the Database Editor 4. 6) Select the Transmitter tab and click [Add]. and select Copy. Application Note AN-AND-1-112 7 . Right click on “bbbMsg” and select Edit Message…. 4) Rename the signal to “Indicator_B” and click [Ok]. Double click on it.1. 5) Change Maximum value to "0x1". We now have two unique messages defined (shown in Figure 3) that use the same internal message data structure. 4) Expand the Value Table drop-down list and select Switch_Positions. Add the new signals. 3) Expand the Access drop-down list and select Read for read-only access to the variable.CANoe Tutorial 3) The signal Indicator_A_Copy_1 appears under the Signals list in the tree view at the left. 6) Assign theses signals to the message “bbbMessage”. 10) Change the start bit of “switch_1B” to “0”.3. right-click on it. “switch_2B” to “1”. 8) Click Apply and OK.5 Create Database Environment Variables for Node AAA 1) Select "Environment variables" in the tree view at the left. 7) Select the Signals tab and click [Add…]. and select New. Figure 3 – Messages "aaaMsg" and "bbbMsg" in the Database Editor 4. 5) Repeat steps 1-4 to make “switch_1B” and “switch_2B”. 2) Name the environment variable "aaaSwitch_1A". 9) Select “bbbMessage” in the tree view at the left. and “Indicator_B” to “8”. 4) Since we are essentially making a copy of the first variable. 3) Change the variable name to "aaaSwitch_2A". Click [OK]. right click on it. and select Edit Environment Variable. right click on Environment Variables and select Paste. 5) Change the Access from Read to Write. expand "AAA". right-click on it. right-click on it. 3) Select “aaaSwitch_1A_Copy_1”.CANoe Tutorial 6) Go to the Control units tab and click [Add]. Application Note AN-AND-1-112 8 . 4) Change the variable name from "aaaSwitch_1A_Copy_1" to "aaaIndicator_A". select "aaaSwitch_1A". 1) Expand "Environment Variables" in the tree view at the left. all of the other values remain the same and are automatically correct. Figure 4 – Environment Variable "aaaSwitch_1" Listed in the Database Editor To add a second environment variable. 2) Right-click on Environment Variables and select Paste. and select Copy. 8) Click [Apply] and then click [OK] to finish. and select Copy. To see all the entries. expand "ECUs" in the tree view at the left. right-click on "Environment variables and select List. and select Edit Environment Variable. repeat the first two steps above: 1) Again. Then. To add the next environment variable. The new environment variable now appears in the Overall View. Select the "aaaSwitch_1A" variable. right click on it. 7) Select control unit "AAA" and click [OK]. 2) Select "aaaSwitch_1A_Copy_1". Application Note AN-AND-1-112 9 . save the database by going to File Save. will appear under the three original variables. 8) Click [Apply]. 4) Right click in the white space below and select Paste. 2) Click on each one while holding down the <Shift> key to select all three. 4.1.3. select AAA. 7) Click [Add] and select the ECU BBB. The three new variables will be seen. Copies of the three environment variables. associated with ECU BBB. Click [OK]. and click [Remove]. then [OK] to finish. 9) Now.CANoe Tutorial 6) The other values remain the same. Now. Figure 5 – The Six Environment Variables Now expand "BBB" under "ECUs" in the tree view at the left and then expand "Environment variables". 3) Right click in the highlighted area and select Copy.6 Create Database Variables for Node BBB 1) Select Environment Variables in the tree view at the left to display them on the right. double-click each copy and follow the steps below: 5) Delete the "_Copy_1" ending and change each variable name from its "aaa" prefix to "bbb" and its “A” to “B” 6) Go to the Control Units tab. each ending in "_Copy_1". 3) Associate the “new1. The Simulation Setup window should now look like it does in Figure 7: Application Note AN-AND-1-112 10 .4 Associate the Database 1) Go to CANoe and select the menu command Window → Simulation Setup to make sure the Simulation Setup window can be seen.CANoe Tutorial Figure 6 – Three Environment Variables For Node BBB 4. Right-click on it and select Insert network node. 2) Right-click on this new node and select Configuration…. 4. The node name should change from “ECU 1” to “AAA”. A new node will appear on the network with the default name "ECU 1". Click [Ok].5 Add Nodes to the Network 1) In the left half of the window. Add the second node “BBB” in the same manner. 3) Expand the CANdb Name drop down list and select the node name "new1::AAA". The new node will appear in the tree list to the right. if necessary.dbc” database file. click on the connection lines to the left of the PC Board called "Bus CAN". Right-click on it and select Add. 2) Expand the tree list to the right and select Databases. 6. Each tool may be used as a separate application program. however.CANoe Tutorial Figure 7 – CANoe Simulation Setup with Two New Nodes We have now created two new nodes with assigned file names.0 of CANoe. or simply go to the File menu. We will focus only on environment variables in this tutorial. 4.6. it is recommended to open them from CANoe so that the database definitions carry over.2.0 or later is not available. click on the icon with a blue meter on the main toolbar of CANoe. or the Panel Editor is preferred. CANoe Version 7. Overlapping control and display elements can all be placed anywhere on the panel.xvp or . Application Note AN-AND-1-112 11 .1. Signal values can also be changed since Version 5.0 or later is required to use the Panel Designer. These panels can be a data source or sink for system-level or node-level I/O.1 Panel Designer 1) To open the Panel Designer.6.1 Creating a New Panel There are two tools available to create graphic control panels.cnp) and can then be loaded in the simulation system. Panel Designer and Panel Editor. 4. but without any software inside them. If CANoe Version 7. Each panel control element must have an environment variable or signal from the database assigned to it. skip to Section 4. The values of discrete and continuous environment variables can be changed interactively on these panels during the simulation. Panels are saved in CANoe panel file format (default extension .6 Create Panels Designing nodes that use graphic control panels is a major feature of CANoe. 4.1. Push Button. the following image will be used: Application Note AN-AND-1-112 12 . 3) Using the extension . A box with a dashed border should appear in the middle gray box. click on the button to the right of “Choose Image…” and select the image to use. name the file "aaa. select File → Save Panel As.1 Adding a Panel Switch. “aaa” will be the title of the Panel when displayed in CANoe. Next. Click [Save]. Under the Settings section. 3) To select an image to use for this switch. the properties of this switch should be displayed in the Properties section. push button and indicator switch. 1) On the top-right side. Scroll down the list of Vector Standard Controls and double click on “Switch”. there should be a Toolbox section. Figure 8 – The CANoe Panel Designer 4. and Indicator Switch To add a panel switch. In our example.xvp and the path to the new directory.1.xvp". 2) On the bottom right side. the steps are exactly the same for each switch.6. scroll down the Properties section.CANoe Tutorial 2) On the menu bar of Panel Designer. The following steps show how to add a panel switch.1. click on (highlight) Image. Figure 10 – Push Button and Indicator Switch Image For the push button switch. 2) Assign the environment variable “aaaSwitch_2A” to the switch. In the Symbol Explorer. For the indicator switch. the above steps will be followed except for a few minor changes to go along with the tutorial. 4) Still in the Properties section. click on Symbol. scroll upwards from Settings. the width should be the size of one switch state. 5) Set the State Count to 2 and the Switch Values to ‘0’ for State 1 and ‘1’ for State 2. and then click on the button to the right of the white box. because the picture of our multi-stage switch isn’t in the Toolbox. When adding the pushbutton and indicator switch. 6) Under the Symbol section. The illustration below shows the three states of the pushbutton and of the indicator switch used in this case. 9) Under the text box’s properties. however. and select “aaaSwitch_1A”. Expand the “Environment variables” list.CANoe Tutorial Figure 9 – Rocker Switch Image Note: Only one switch is placed on the panel. dragging and dropping doesn’t work. Note: The environment variable can also be assigned by dragging it from the Symbol Explorer on the left to the switch box. If the above picture is used. in this case (a switch). provides the user with a greater selection variety of images. then click [OK]. 3) Add a static text and replace “Description” with “aaaSwitch_2A”. expand the drop down list under Filtered by: and select “Environment Variables”. Move the text box to the side of the newly created switch. A box with the word “Description” should appear in the middle gray box. Next. The above method. Application Note AN-AND-1-112 13 . double-click on “Description” found under Font with “aaaSwitch_1A”. set the width and height of the image. set the width to 31 and height to 27. For example. This figure only illustrates that there are three switch states. 1) Under Layout Size. Text and replace it Note: Standard controls may also be added to a panel by dragging them from the Toolbox and dropping them onto the panel. Expand the Environment variable list. Otherwise. scroll down and set the symbol filter to Environment Variable. 8) Under the Toolbox section (upper right). Under Layout Size. 7) A window should appear with the list of environment variables. click and drag “aaaSwitch_1A” into the switch. if the above image is used. The list of environment variables should now be displayed on the left. then set the width to 35 and height to 50. scroll down the list and select “Static Text”. white sizing boxes should appear at the right and bottom. Point the cursor at the bottom-right corner white box.CANoe Tutorial 4) Under Layout 5) Under Settings Size. The cursor should change into a line with two arrowheads Click and drag the corner to make the panel bigger or smaller. Display Only. set the width to 75 and height to 23. change it to “True”. 3) On the Panel Designer main toolbar. 2) Then. 1) Click the gray box. 7) Add a static text and replace “Description” with “aaaIndicator_A”. save the newly created panel by going to File Save Panel…. click on the icon with the blue meter and the ‘+’ sign. if the above image is used. 6) Assign the environment variable “aaaIndicator_A” to the switch. Now finally. This will add the panel to the configuration file opened in CANoe. Application Note AN-AND-1-112 14 . 2 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.CANoe Tutorial In CANoe.xvp" in the “new1” directory. This should assign the environment variable to the push button. "aaa. 3) Save the panel as "bbb. This should assign the environment variable to the rocker switch. If not.1. click and drag “bbbSwitch_1B” into the rocker switch. Expand the drop down list under Filtered by: and select “Environment Variables”. 1) If the Panel Designer is still running. Symbol Explorer should be open. the panel should have appeared with the window title of “aaa”. This should assign the environment variable to the indicator button. start the Panel Designer application and open the first panel.1. 9) Click and drag “bbbIndicator_B” into the indicator button. 8) Change the static text from “aaaSwitch_2A” to “bbbSwitch_2B”. 2) Go to File → Save Panel As. 7) Click and drag “bbbSwitch_2B” into the push button. save the panel by going to File → Save Panel. 4) On the left side. 13) Exit the Panel Designer. 10) Change the static text from “aaaIndicator_A” to “bbbIndicator_B”. 5) Expand the “Environment variables” list. This will add the panel to the configuration file opened in CANoe. 6) Change the static text from “aaaSwitch_1A” to “bbbSwitch_1B”. 11) Now. again click on the icon with the blue meter and the ‘+’ sign. It should look like this: Figure 11 – "aaa" Panel 4. make sure all the changes have been saved to the first panel before the second panel is created. Click [Save].xvp". Application Note AN-AND-1-112 15 . The list of environment variables should now be displayed on the left. 12) On the main toolbar.6. replace “Static Text” with “aaaSwitch_2A”. colors. 8) Right-click on the text box and select Configure.1.2. name the file "aaa.2 Panel Editor Open Panel Editor. As the pointer enters the panel design area (within the white box) it changes to a rectangle with a cross at the upper left corner. name. 3) Give the element any name. 4) In the Symbol section of the Configure Switch window.cnp". replace “Static Text” with “aaaSwitch_1A”. which opens the Window size. Then. Give the element any name desired.cnp and the path to the “new1” directory. As the pointer enters the panel design area it changes to a rectangle with a cross at the upper left corner.CANoe Tutorial 4. Give the element any name desired. expand the drop down list and select “EnvVar”. For the panel name. 4. In the Text section.1. 4) In the Text section of the dialog. scroll through the list of environment variables and select "aaaSwitch_1A" to establish a link between the graphic element and the environment variable in the associated database. 3) Give the element any name. or select the menu item Elements → Push button. Click anywhere within the panel design area to place the push button and move the push button so that it is under the first switch.1 Adding a Panel Switch 1) Click the switch icon on the toolbars (looks like a light switch with a red dot at the bottom of the switch) or select the menu item Elements → Switch. and fonts dialog. Click [OK]. All we will do here for now is to give the panel a name. Then. scroll through the list of environment variables and select "aaaSwitch_2A" to establish a link between the graphic element and the environment variable in the associated database. 2) Right click on the push button and select Configure. 6) Right-click on the text box and select Configure. Move the text box to the right of the switch. Click [OK]. expand the drop down list and select “EnvVar”. 5) In the Symbol section of the Configure Switch window. Application Note AN-AND-1-112 16 .. 4. 1) To open the Panel Editor. 7) Click anywhere within the panel design area to place the text box. 9) Stretch the text box by clicking on any of the side lines of the box and dragging it to an appropriately large size so all of the text is visible. 7) Stretch the text box by clicking on any of the side lines of the box and dragging it to an appropriately large size so all of the text is visible. In the Text section. Click [OK].2 Adding a Push Button Switch to the Panel 1) Click the push button icon on the toolbar (an elevated gray square). replace "Button" with "Sw2". 3) On the menu bar. Click [OK]. select File → Save As. 2) Right click on the switch and select Configure. Click [OK].2.1.6. Click anywhere in the panel design area to place the switch. 5) Click the text icon on the toolbar – a white square with a capital T in it – and click anywhere within the panel design area to place a text box.. 6) Click the text icon on the toolbar – a square with a capital T in it – and move the mouse over the panel design area. use "aaaPanel".6. Click [OK]. go to Options → Window setting. select File 2) On the menu bar of the Panel Editor. Move the text box to the right of the push button. Using the extension .6. we have finished our panel design using Panel Editor. 2) Click anywhere within the panel design area to place the indicator. Move this element under the push button. Move the text box to the right of the push button. At this point. 8) Click anywhere within the panel design area to place the text box. as shown below in Figure 12.2. or select the menu item Elements → Bitmap Switch/Indicator. Finally. expand the drop down list and select “EnvVar”. I. II vertically on its right side). Application Note AN-AND-1-112 17 . 6) Under the Symbol section. Click [OK]. Click and drag the corner to make the panel bigger or smaller. 4) Give the element any name. 3) Right click on the indicator and select Configure. 9) Right click on the text box and select Configure. save the newly created panel by going to File Save…. scroll through the list of environment variables and select “aaaIndicator_A” to establish a link between the graphic element and the environment variable in the associated database. replace “Static Text” with “aaaIndicator_A”. 2) Then. Then. 10) Stretch the text box by clicking on any of the side lines of the box and dragging it to an appropriately large size so all of the text is visible. 5) Under the State Processing section. Click [OK]. select 2 states and set the Switch Value to ‘1’.CANoe Tutorial 4. 7) Click the text box icon on the toolbar – a white square with a capital T in it – and move the mouse over the panel design area. The cursor should change into a line with two arrowheads. As the pointer enters the panel design area it changes to a rectangle with a cross at the upper left corner. In the Text section.1. 1) Point the cursor at the bottom right corner of the black line. Give the element any name desired.3 Adding an Output Indicator 1) Click the bitmap switch icon on the toolbar (has 0.6. If not. Click [OK]. Click [OK].4 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.6. 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". 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". 15) Go to File → Save As.. 19) Double click on the pushbutton switch and change the environment variable name from "aaaSwitch_2A" to "bbbSwitch_2B". Click [OK]. start the Panel Editor application and open the first panel. Click [OK]. Click [Save]. "aaa. 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]. 14) If the Panel Editor is still running. 17) Go to Options → Window setting. make sure all the changes have been saved to the first panel before the second panel is created.1.2.cnp". 16) Again maintaining the extension .cnp and the path to the “new1” directory.cnp". name the file "bbb. 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". 20) Double click on the indicator and change the environment variable name from "aaaIndicator_A" to "bbbIndicator_B".CANoe Tutorial Figure 12 – The Designed Panel 4. Application Note AN-AND-1-112 18 . CANoe Tutorial 24) Now.cnp and bbb.) 1) If necessary.7 Place the Panels into the CANoe Environment Next. 4. select File → Save Configuration. Using the <Shift> key. 2) Click the [Add…] button. save the panel by going to File → Save. (“MDI Window” will display the panels inside the CANoe program environment.xvp and *. so that both may appear and be used at the same time. The left pane contains a tree view of all important elements for which a CAPL program can be written. 4) Expand the drop down list next to Window type for newly configured panels and select “Standard Window”. 3) Locate the panel files aaa.cnp in the new directory. 2) Using the main menu. Panels should already have been added to the configuration if the blue meter with the ‘+’ was pressed in Panel Designer. Both panels should now appear on the screen. 1) In CANoe. The area on the upper right is where global variables will be placed for the CAPL program.cnp) can be stored together in the same folder. (It is possible that they may be behind the main CANoe window. we use the CAPL programming language feature of CANoe to give behavior to our two nodes. click both panels and open them. we will only use the panels created in Panel Designer. This will create a new window outside of CANoe for each panel. The Browser window is subdivided into three distinctive areas. Application Note AN-AND-1-112 19 . 4. we move back into the CANoe application to get our new panels interconnected. and the area below it is where the actual source code for each event procedure is written. A CAPL program is usually developed in the CAPL Browser.) 5) Click [OK]. Note: Panel files can be created in CANoe with either the Panel Designer or the Panel Editor. In this tutorial.8 Create Node Behavior Next. select the menu command Configuration → Panel Configuration. adjust the position of both panels and the main CANoe window to allow each window to be viewed. Both can be opened with the Panel Configuration dialog. or panes. 25) Exit the Panel Editor. and both types of files (*. can” and save the file in the “new1” directory.. 2) An Open dialog window will appear. 7) Enter the following code: Application Note AN-AND-1-112 20 . An empty procedure for the environment variable appears in the bottom right window. right click on "Environment" (Environment Variable) and select New.8.. Type in “AAA. 5) Right click on the highlighted “<newEnvVar>” and select Environment variable from CANdb. asking for the CAPL program to be given a name. // this is the only line that needs to be to typed in } 4) In the tree view at the left.. 3) In the upper right pane (Global Variable Definitions) of the CAPL Browser.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 network. Then. 6) Select the variable "aaaSwitch_1A" from the list and click [OK]. click on the pencil icon located on the lower left corner of the “AAA” network node to open the CAPL Browser.CANoe Tutorial Figure 13 – The CAPL Browser 4. click on Open. enter the following code: variables { message aaaMsg aMsg. 1) In the Simulation Setup window of CANoe. Then.) 9) On the bottom window. aaaMsg. go to Window → Simulation Setup. let's test what we have done so far. 5) To stop the simulation. } 8) On the toolbar. } Application Note AN-AND-1-112 21 . Type in “BBB. Then. 4.switch_1A = getValue(this). Now. go to File → Save to save the CAPL program. change the program source code to read as follows: on envVar aaaSwitch_1A { aMsg. let's move the switch press information into the message. Then. 2) An Open dialog window will appear asking for the CAPL program to be given a name. right. click on the pencil icon located on the lower left corner of the “BBB” network node to open the CAPL Browser. output(aMsg). We will make an empty program for Node BBB. Click the pencil icon of node “AAA” to edit the CAPL program. 1) In the main CANoe application. (If a compile error is shown.can” and save the file in the “new1” directory. make sure the code is entered exactly as shown in Steps 3 and 7. 3) In the lower right window. go to File → Save to save the empty CAPL program. If not compiled successfully.or left-click on the rocker switch ("aaaSwitch_1A"). make sure the last line says “Compiled …”. The simulation must be in the stopped state before any changes to the setup can be made. make sure the panels are open. every node must have a program associated with it. 1) Using the menu. 1) In the Simulation Setup window of CANoe.2 Creating an Empty Function For Node BBB In order for CANoe to be able to simulate the network. click the "Compile" icon (a single arrow pointing down onto a stack of papers) or select Compiler → Compile. 2) Make sure the Trace Window can be seen (menu command Window → Trace). 3) Select Compiler → Compile 4) On the upper menu. Next. where the code is. which indicates that the CAN message. then double click on the listed error line to get to the line in the program causing the problem. close the CAPL Browser. is being transmitted onto the CAN bus.8. click on the [Stop] button (the “stop sign” icon) on the CANoe toolbar. Click on the [Start] button (the "lightning bolt" icon) on the CANoe toolbar. close the CAPL Browser. 4) A message with a new time stamp is displayed in the Trace Window every time the switch is clicked.CANoe Tutorial on envVar aaaSwitch_1A{ output(aMsg). 3) On the “aaa” Panel window. click on Open. 10) On the upper menu. 2) Expand "Environment" in the tree view at the left and select "aaaSwitch_1A". ID.CANoe Tutorial 4) On the toolbar. make sure the code is entered exactly as shown in Steps 3 and 7. (If a compile error is shown. 3) The time stamp of the message can be seen in the Trace Window. The last column shows the actual data. let's check the result. message name. which is 2 bytes of data. 4) Click on the plus sign (+) to the left to expand the message and see its signals on the next three rows.) 5) On the bottom window. right. The next two columns are Dir TX (Direction: transmit) and DLC (Data Length Code). Click on the [Start] button (the “lightning bolt” icon). followed by columns for the channel. 1) In the main CANoe application. 2) In the “aaa” Panel window. Then. The Trace Window should now look like this: Application Note AN-AND-1-112 22 . go to File → Save to save the CAPL program. make sure the last line says “Compiled …”. If not compiled successfully. close the CAPL Browser. 6) On the upper menu.or left-click on the rocker switch ("aaaSwitch_1"). and the time stamp can also be seen each time when this is done. then double click on the listed error line to get to the line in the program causing the problem. Our compiled and finished program should now look like this in the CAPL Browser: Figure 6 – Adding Node Behavior with CAPL Now. make sure the Trace Window can be seen. 5) Click the switch on the panel several times. The "switch_1" signal will change from "On" to "Off" and "On" again. click the "Compile" icon (a single arrow pointing down onto a stack of papers) or select Compiler → Compile. make sure the code is entered exactly as shown in Steps 3 and 7. (If a compile error is shown. bMsg. go to File → Save to save the CAPL program. this. then double-click on the listed error line to get to the line in the program causing the problem. output (bMsg). } 7) On the toolbar. make sure the last line says “Compiled …”.Indicator_B = this.3 Programming Node BBB Behavior We will now read the message transmitted by the AAA node and move the switch press of Node AAA into the indicator on Node BBB. close the CAPL Browser. go to Window → Simulation Setup. } 4) Right click on "CAN Messages" in the tree view at the left and select New. 2) In the Simulation Setup window of CANoe. click the "Compile" icon (a single arrow pointing down onto a stack of papers) or select Compiler → Compile.8. Application Note AN-AND-1-112 23 .) 8) On the bottom window. replace the string "<newMessage>" with "aaaMsg" so it reads "on message aaaMsg" (meaning "on receiving message "aaaMsg" we will do the following:") 6) Enter the following code: on message aaaMsg { putValue (bbbIndicator_B. Then. 5) In the code window at the lower right.CANoe Tutorial Figure 7 – Trace Window with "aaaMsg" Message 4.switch_1A). If not compiled successfully. 9) On the upper menu. click on the pencil icon located on the lower left corner of the “BBB” network node to open the CAPL Browser. 3) In the Global Variables section (upper right) enter the following: variables { message bbbMsg bMsg.switch_1A. 1) In CANoe. the Trace window will display two messages – each transmitted by a node. For each user-defined node a Program File is used. CANoe File Type Configuration File Database File Program File (CAPL) Panel File Suffix . For each CANoe configuration there is a single Configuration File typically associated with a single Database File. In CANoe.xvp Text Format Yes Yes Yes Yes Number of Files 1 Typically 1 1 for each user-defined node 1 for each user-defined panel Table 1 – Primary CANoe File Types Application Note AN-AND-1-112 24 . Continue to work on this network if desired by adding new behavior.dbc . Experiment with other types of controls in the Panel Editor (radio buttons. run the simulation again. as can be seen in Table 1.0 Overview of Interrelated CANoe Files CANoe uses a collection of interrelated files for each user configuration.0 Conclusion We now have a working model of a network with two nodes. This time.can .CANoe Tutorial Let's check the behavior of both network nodes. edit fields.cfg . track bars. such as: • • • Use bbbSwitch_1A of the bbb panel to toggle the indicator on the aaa panel. Figure 8 – Trace Window with Both Messages 5. etc. Using the example demo files that have been included with CANoe also helps the user learn more about CANoe. and for every panel there is a Panel File. 6.) Add and disable nodes in the Simulation Setup window. Higashi-shinagawa. There may be an advantage in using a suitable text editor on occasion.0 Compatibility with Other Source Code Editors CANoe files that are text-based may be modified using any suitable text editor.: +49 711-80670-0 Fax: +49 711-80670-111 Email: info@vector-informatik. Japan Tel:+81 03(5769)7800 Fax: +81 03(5769)6975 Email: info@vector-japan. Guro-gu Seoul. 8.0 Additional Resources The following material may provide further useful information. 152-790 Republic of Korea Tel. 508 182-4 Guro-dong. 39500 Orchard Hill Pl.com Vector France SAS 168 Boulevard Camélinat 92240 Malakoff France Tel: +33 (0)1 42 31 40 00 Fax: +33 (0)1 42 31 40 09 Email: information@vector-france. VECTOR APPLICATION NOTES AN-AND-1-110 Quick Introduction to CANalyzer AN-AND-1-113 AN-AND-1-117 A Quick Introduction to CAPL CANoe/CANalyzer as a COM Server 9. 18F 2-3-12.CANoe Tutorial 7. the Database File. Inc.co. Seafort Square Center Bld. as long as the basic file structure and the file’s special formatting characters are not changed.: +82-2-2028-0600 Fax: +82-2-2028-0604 Email: [email protected] Vector Korea IT Inc. Ste 550 Novi.de Vector CANtech.fr Vector Japan Co. globally changing a variable name in the Configuration File. and all associated CAPL Program Files is much quicker using an editor which features “search and replace” on multiple files.com Application Note AN-AND-1-112 25 .. MI 48375 Tel: (248) 449-9290 Fax: (248) 449-9704 Email: [email protected] VecScan AB Theres Svenssons Gata 9 41755 Göteborg Sweden Tel: +46 (0) 31 764 76 00 Fax: +46 (0) 31 764 76 19 Email: info@vecscan. Shinagawa-ku Tokyo 140-0002.0 Contacts Vector Informatik GmbH Ingersheimer Straße 24 70499 Stuttgart Germany Tel. Ltd. For example. Daerung Post Tower III.
Copyright © 2024 DOKUMEN.SITE Inc.