CANoe QuickStartExport
CANoe QuickStartExport
This file is a PDF export of the Quick Start Guide of the CANoe help.
Version 16
CANoe Quick Start Guide (PDF Version) Table of Contents
Table of Contents
1 Overview 5
1.1 Operating Concept 5
1.2 Set Up CANoe 5
1.3 CAPL 5
2 Windows 6
2.1 Simulation Setup 6
2.2 Measurement Setup 7
2.3 Analysis Windows 7
3 Create a New Configuration 8
4 Set Up the Bus 9
4.1 Connect Channels on the Network Interface 9
4.2 Connect the Network Interface with Your Computer 9
4.3 Define the Bus Parameters 10
5 Transmit Data Without Database 12
5.1 Unit 1: Send a CAN Message 12
5.1.1 Insert a Visual Sequence 12
5.1.2 Save Your Configuration 14
5.1.3 Start the Measurement 14
5.1.4 Display In the Trace Window 14
5.2 Unit 2: Send a second CAN Message Cyclically 14
5.2.1 Insert a Second Visual Sequence 14
5.3 Further Data Sources 15
5.4 Analyze Data 16
5.4.1 Trace Window 16
5.4.2 Statistics Window 16
6 Work with Symbolic Data 18
6.1 Assign a Database 18
6.2 Display In the Trace Window 20
7 Analyze Signal Values in Data Window 21
7.1 Unit 3: Configure the Data Window 21
7.1.1 Add Signals In the Data Window 21
7.1.2 Display In the Data Window 22
8 Analyze Signal Responses in Graphics Window 24
8.1 Unit 4: Configure the Graphics Windows 24
1 Overview
If you start CANoe for the first time, and its functionality and controls are still completely new to you, the following
tour will help you to become familiar with its operating concept and its most important features.
For this tour you will first set up a very simple CAN bus where CANoe acts as both, sender and receiver.
2 Windows
3 Create a New Configuration
4 Set Up the Bus
In the first step CANoe is configured as a data source, i.e. as a transmitting station. You will then learn about
CANoe analysis options by studying the generated data in the analysis windows afterwards.
In complex real systems CANoe typically also acts as sender and receiver. You can utilize the program as a data
source to transmit data to other controllers, but you can simultaneously use it to observe, log and evaluate the
data traffic on the CAN bus.
5 Transmit Data Without Database
6 Work with Symbolic Data
7 Analyze Signal Values in Data Window
8 Analyze Signal Responses in Graphics Window
9 Log a Measurement
10 Evaluate a Logging File
1.3 CAPL
In the last part of the tour you will become familiar with the CAPL programming language and create two network
nodes of a distributed system to solve a simple simulation task in CANoe.
11 Create a CAPL Program
12 Simulate Distributed Systems in CANoe
2 Windows
If you open CANoe the first time a configuration with the desktops Trace, Configuration, and Analysis is
opened automatically.
CANoe has various analysis windows (Trace, Data, Graphics and Statistics Window) as well as a Measurement
Setup and a Simulation Setup that indicates the data flow and simultaneously allows to configure CANoe.
You can access all program windows via the ribbon.
In the Simulation Setup the overall system is shown graphically with the CAN bus and all network nodes. The
simulated bus is represented by a red horizontal line. The blue line above symbolizes the real bus. The two
buses are connected to one another via the network interface. To transmit data from CANoe on the bus, insert
transmit blocks in the Simulation Setup, which must be connected by the red line.
Figure 3: Bus symbol in Simulation Setup with context menu of the bus lines.
The data flow diagram of the CANoe Measurement Setup has a connection to the Simulation Setup on the left -
symbolized by the >> symbol - and various evaluation blocks on the right serving as data sinks. That is, the data
flow is from left to right. Connection lines and branches are drawn between the individual elements to clarify the
data flow.
In the data flow diagram you will also recognize small rectangles: . At these insertion points (hot spots) you
can insert additional function blocks for manipulating the data flow (filter, Replay Block or CAPL program blocks
with user-definable functions).
The information arriving at each evaluation block is displayed in the analysis window of the block. For example,
the Trace Window displays all information arriving at the Trace block, while the Graphics Window shows you
information arriving at the Graphics block.
The only exception is the Logging Block, which is not assigned to a window but rather a file in which the data
arriving at the block are logged.
Make sure that you begin this tour with a new configuration. Select the CAN_500kBaud_2ch.tcn template via
the File ribbon tab|New, and click on Create Configuration.
The wizard is not needed for this tour.
To start up CANoe use a test setup that is independent of existing CAN bus systems with only two network
nodes. The two CAN controllers of your network interface can serve as the network nodes. As network interface
you can use the two CAN Controller of your network interface.
First, connect channel 1 and 2 on the network interface (D-Sub 9 connectors). For a high-speed network
interface you need a connection cable (CANcable) with two bus termination resistors of 120 Ω each. For a low-
speed interface you will simply need a 3-conductor cable to interconnect the pins of the two controllers that are
assigned to the bus lines CAN high, CAN low and ground.
Consequently, the CAN bus that you use during this tour will consist of a short 2-conductor or 3-conductor cable
that connects the two CAN controllers of the CAN card to one another. This is necessary as a minimal
configuration, since the CAN protocol requires - in addition to a sender - at least one receiver that confirms the
correct receipt of messages with an acknowledge.
For external network interfaces, e.g. VN1630, use a USB cable to connect to the computer. Internal network
interfaces, e.g. VN1530, plug directly into your computer.
Up to this point we have not considered definitions of bus parameters (Transmission speed, sampling point, etc.)
which must be set for each of the two participating controllers.
2. Choose the context menu command Network Hardware… and open the Network
Hardware Configuration dialog.
3. Then select CAN1|Setup from the configuration dialog for the first controller and type in the
value for the baud rate 100 kBaud. This makes sense for both high-speed and low-speed
buses. CANoe recommends default values for the controller registers, which you accept
with [OK].
When you do this - besides the transmission speed of 100 kBaud - you also implicitly define
other controller parameters (Sampling point, BTL cycles, and synchronization jump width).
For the overall system to function properly, the same exact values must be set for the
second controller CAN 2 (click + and Setup). When you exit the dialog, accept the values
with [OK].
With the [Driver…] button you can open the Vector Hardware Config dialog. There you can assign the
application channels to the real channels.
Your current test setup still does not have a data source. So set up a data source which places information on the
bus cyclically.
Task
Configure CANoe so that – after the measurement start – a CAN message with identifier 64 (hex)
is sent on the bus every 100 milliseconds. In this case the message should contain exactly four
data bytes with the values D8 (hex), D6 (hex), 37 (hex) and 0.
You can solve this task by inserting a visual sequence which transmits the message on the bus.
Note
To execute this visual sequence it must be activated in this dialog. Since the
sequence has no contents yet, it is displayed as invalid .
After it is created, the visual sequence Message 1 will be opened in the Visual Sequencer
automatically.
Operator: =
Operand: D8 D6 37 00
Wait: 0
4. To send the message cyclically, you have to enter in the second row the following settings:
Command: Set CAN Cyclic Raw Frame (selection via list field)
Object:
Channel: CAN1
Identifier: 0x64
Selector: not available
Operator: cycle time (ms)
Operand: 100
Wait: 0
5. Activate with in the toolbar the replay of the sequence Message 1 until measurement
stop.
6. Activate with in the toolbar the automatic start of the sequence at the start of
measurement.
Cross Reference
You can find detailed information about the Automation Sequences or the Visual Sequencer in
the Help of CANoe.
Before you start the measurement you should save the configuration that you have prepared to this point via the
File ribbon tab|Save. You can then reload this configuration at any time and resume your work precisely at this
point.
Start the measurement with on the Home ribbon tab. CANoe immediately begins to cyclically transmit the
message you have configured in the sequence Message 1.
In the Trace Window (Trace desktop or Analysis ribbon tab|Trace) you can see that the message is transmitted
via channel 1 (Transmit attribute Tx [= Transmit]) and received by the second controller (Receive attribute Rx [=
Receive]).
The first column shows the transmit time relative to the measurement start. The next column shows you which of
the two CAN channels was used to transmit.
Task
Expand the configuration of the last task such that, additionally, a message with identifier 3FC
(hex) is transmitted every 500 milliseconds. The value of the first data byte of this message
should cyclically assume values from 1 to 5.
You can solve this task by inserting a second visual sequence Message 2 that transmits a new message on the
bus.
Stop the measurement with on the Home ribbon tab before entering the second sequence.
Sequence Message 2 must be defined as follows:
Activate with in the toolbar the periodic replay of the sequence Message 2 until measurement stop. Wait sets
the time between the execution of the single sequence steps.
Activate with in the toolbar the automatic start of the sequence at the start of measurement.
Besides the Visual Sequencer, CANoe offers additional block types as data sources.
With the Interactive Generator (IG) you can configure and send messages interactively while a
measurement is running. Additionally you can define Signal Generators.
With a Replay Block you can play back data on the bus that were logged with the CANoe logging function.
A program block allows you to integrate your own transmit functionalities – which may be quite complex –
into CANoe with the CAPL programming language.
Cross Reference
You can find detailed information about these block types in the help of CANoe.
Analysis windows are used to analyze data generated by the Message 1 and Message 2 sequences from Unit
1 and Unit 2.
You have already learned about the Trace Window. Data that reach the Trace block of the Measurement Setup
are displayed here as CAN messages in bus based format. Besides the time stamp, this includes the number of
the CAN controller, the identifier, an attribute for differentiating transmitted and received messages, and the data
bytes of the CAN message.
You can configure the Trace Window – like all other analysis windows – from the context menu that is accessed
by a right click on the window or on the appropriate block.
Furthermore, the different buttons in the toolbar can be used to configure the Trace Window. For example, with
you can toggle from stationary mode to the scroll mode, in which each message arriving at the Trace block is
written to a new line.
With you can toggle between absolute and relative time representation. In relative time representation, the
time difference between two successive messages ("transmit interval") is shown in the first column. Of course, in
this display format it is also easy to find the transmit interval that you entered previously in the Visual Sequencer:
100 milliseconds.
Another bus based window, the CAN Statistics Window (Analysis desktop or Analysis ribbon tab|Statistics),
provides an overview of bus data traffic. Displayed here are the total frequencies of data, remote and Error
Frames, bus loading and CAN controller status.
Since in our case Message 1 is sent every 100 ms and the Message 2 every 500 ms, the total frequency of all
messages is 12 frames per second. With an average data length of about 70 bits per frame, approx. 12 * 70 ≈ 840
bits are placed on the bus in one second. At a baud rate of 100 kbit/second the bus load in our example would be
on the order of magnitude of one percent.
Before we discuss the remaining windows in detail, let us have a look at the capabilities offered by CANoe for the
symbolic description of data. Of primary interest in the analysis of CAN systems – besides bus-related
information such as messages, Error Frames and message frequencies – is information on useful data, i.e.
signals such as RPM, temperature and engine load, which are provided by individual controllers, and are sent on
the bus with the help of CAN messages.
To describe this information symbolically, CANoe provides you with the database format DBC and a database
editor with which you can read, create and modify CAN databases.
Cross Reference
Please refer to the CANdb++ manual and the CANdb++ help included with the CANoe product
for further information on the CANdb++ Editor.
At this point we would like to assign a delivered database to the current CANoe configuration. This database will
be used to interpret the data bytes of the messages generated by the Visual Sequencer. You can find the
database POWERTRAIN.dbc in the directory CANoe Sample
Configurations\CAN\CANSystemDemo\CANdb.. The location of the directory depends on the installation.
In the Options dialog you can find the file location here:
File ribbon tab|Options|General|File Locations: Location of user data.
2. Select Databases in the System View and open the Open dialog with the context menu
command Add….
3. Select in this dialog the above mentioned database.
4. If you click on the [OK] button, the new database is accepted for the current bus and
displayed in the System View.
Now open the database using the symbol on the Tools ribbon tab. The CANdb++ Editor is opened, and the
contents of the database POWERTRAIN.dbc are shown in the Overall View Window of the CANdb++ Editor.
Double click the Messages object type in the area on the left side of the Overall View Window. The subordinate
structural level is then also shown in this area, and the area on the right shows the available messages with their
system parameters (e.g. symbolic name, identifier, etc.).
Note
The CANdb++ Editor validates inputs and displays potential errors or issues in the Overall View
Window. In this database the symbol to the left of the message indicates that this message has
no assigned receiver node.
First, toggle the numbering format from decimal to hexadecimal via the Options│Settings menu path. We can
deduce from the symbolic names of the messages that the system under consideration involves a description of
communications in a rudimentary engine area system.
Click the message EngineData in the left area of the Overall View Window. The system parameters of signals
transmitted in this message are shown in the area on the right side of the Overall View Window.
The temperature EngTemp, for example, is a 7 bit signal. To obtain the physical value in degrees Celsius, the bit
value must be multiplied by the factor 2, and the offset 50 must be subtracted from the result.
The idle switch signal Idle Running in the last bit of the third data byte is a binary signal (one bit), which can
assume the value 0 or 1.
Note
With the help of this symbolic information the data contents of messages can now be interpreted
in CANoe. Please note that this is only practical if the database information describes the system
that you are currently observing. So you have to ensure that the database associated to the
configuration matches the real network.
Now you can see in the Trace Window the identifier and the symbolic message name.
Please note that the message you generated in the first task has the identifier 64 (hex). This agrees with the
identifier of the message EngineData.
Besides the use of symbolic message names, the associated database can also be used to analyze signal
values. The purpose of the Data Window (Analysis desktop or Analysis ribbon tab|Data) is to assist in the study
of momentary signal values.
This explains why the Data Window is initially empty in a new configuration. The signal values to be displayed are
dependent inter alia upon information from the database. You as the user must decide which signal values
should be displayed.
Task
Configure the Data Window to display the signal values of the message EngineData (ID 64 hex)
that is generated in the Simulation Setup.
For the display of signal values in the Data Window, you have to add signals.
After the measurement start the sequence Message 1 begins to cyclically send the message EngineData with
data bytes D8, D6, 37 and 0 onto the bus. According to the message description in the database, the Data
Window in the Measurement Setup now interprets these byte values as engine speed, temperature and idle
switch and displays the appropriate signal values in the Data Window in physical units.
With the help of the conversion formula in the database, engine speed is shown in RPM, while temperature is
shown in degrees centigrade (Celsius). The values of all three signals remain constant over time, since the
message is constantly transmitted with the same data bytes D8, D6, 37 and 0.
While the Data Window displays momentary signal values, you can have the time sequences of signal values
displayed in the Graphics Window (Analysis desktop or Analysis ribbon tab|Graphics). After the end of
measurement the signal sequences are available for study by user-friendly analysis functions.
Example
Configure the Graphics Window so that signal values are displayed for message 3FC (hex) that
is generated in the Simulation Setup.
The second message generated in the Simulation Setup is also described in the associated database.
You can now observe the time sequences of these signals in the Graphics Window. After the measurement start
you observe that the signal Gear cyclically assumes values from 1 to 5, while the other two signals remain
constant over time.
For a useful display of the single gear values the Step connection type of the lines is suitable.
In the curve of the Gear signal you can see the five values that you entered in the sequence Message 2 as part of
unit 2. The values remain in the Graphics Window after the end of the measurement.
For this graphical display you have to select under the separate views of the Y-axes.
Cross Reference
The measurement functions that the window provides for post-analysis are described detailed in
the help of CANoe.
9 Log a Measurement
CANoe has extensive logging functions for data logging. In the Measurement Setup (Configuration desktop or
Analysis ribbon tab|Measurement Setup) the logging branch is shown at the very bottom of the screen.
You can easily recognize it by the file icon , that symbolizes the logging file. The logging file is filled with
CAN data during the measurement.
Task
Log – in ASCII format – all CAN data traffic that is generated in a short measurement (approx. 20
seconds.) by the sequences.
To log the data that arrives in CANoe Measurement Setup to a file, first stop the measurement and activate the
logging branch. Also remove the break that separates the Logging Block of a new configuration from the data
source. You can do this by double clicking the break symbol or with its context menu command Remove
Break.
With the context menu command Logging File Configuration… of the file icon located at the far right of the
logging branch, you can open the configuration dialog.
Here you can enter the file name for the measurement log as well as its format.
Select ASCII format (ASC) here.
Logs in binary format (BLF) take up less space on your hard drive, but they cannot be read in normal text editors.
The program offline mode offers you the same evaluation options for logs in both formats.
Besides the file icon, you can also specify trigger conditions for file logging in the Logging block. This is often
advisable, since frequently it is not the data traffic on the CAN bus over the entire measurement period that is of
interest, but rather only certain time intervals, e.g. when there are implausible signal values or when Error
Frames occur.
Open the Trigger Configuration dialog with the Logging Block context menu command Configuration….
To log the entire measurement the Entire measurement mode must be selected in the Trigger Configuration
dialog.
After the configuration of the logging file and the trigger condition start the measurement, which you stop again
after 20 seconds.
With the context menu command Open Logging File…of the file icon you can open the logged ASCII file.
Besides the logged messages you can see that statistical information was also logged. These lines correspond
exactly to the information that is displayed in the Statistics Window during a measurement.
Logging files in ASCII format can indeed be viewed with text editors, but often it is more sensible to utilize the
capabilities that CANoe provides for offline analysis of logging files.
Task
Play back the logging file recorded for the last task in offline mode, and observe the signal
response in the Graphics Window.
To solve this task, first switch CANoe to offline mode. For that select the Offline Mode on the Home ribbon tab,
or switch with a double click on the Online/Offline symbol in the Measurement Setup to offline mode. All
configuration settings are taken over to offline mode. In the Measurement Setup the bus symbol is displayed
deactivated and the data symbol is activated as data source.
Select the logging file of the last task via the Configuration… context menu command of the file icon at the left of
the Measurement Setup.
You have also to separate the Logging Block. You can do this by double clicking the hot spot symbol on the left of
the Logging Block or with the context menu of this hot spot.
You can now play back the measurement with the <F9> key or with on the Home ribbon tab. In contrast to
online mode, here CANoe also offers you the option of replaying the measurement in slow motion (Home ribbon
tab|Animate or <F8>) or in Single-Step mode (Home ribbon tab|Step or <F7>).
The same analysis functions are available to you in offline mode as in online mode. That is, the logged data are
displayed in bus based format in the Trace Window, while you can observe the log signal responses in the
Graphics Window. Of course, you can also insert filters or CAPL programs in the Measurement Setup to further
reduce the data or introduce additional user-defined analysis functions.
CAPL is an event based programming language. Each CAPL program consists of event procedures, with which
you can react to external events (e.g. occurrence of specific messages on the CAN bus or activation of keys on
the computer keyboard). The CAPL Browser is described in detail in the help of CANoe. With its sub windows
("Panes") it allows you to create and edit CAPL programs quickly and easily.
In principle, you can also use your own text editor to create CAPL programs. CAPL programs are normal ASCII
files with the default name extension *.can, which must be compiled before the start of measurement using the
compiler provided with the CANoe product.
Cross Reference
You will find a complete description of the programming language together with numerous
detailed examples in the help of CANoe.
Task
Create a CAPL program with which you can count the number of messages of the type
EngineData (ID 64 hex) and output the counted number of messages to the Write Window in
response to a key press.
11.1.1 Preparation
First you must decide where you wish to insert your CAPL program in the data flow plan. Because this program is
only for analysis purposes and does not generate any messages itself, but only counts them, it is advisable to
insert the program in the Measurement Setup, perhaps before the Trace Window. In the hot spot context menu
choose the function Insert Program Node. A function block with the program symbol P now appears at the
selected point in the Measurement Setup.
You can also access the node configuration dialog via the context menu Configuration…. First, select a
program name, e.g. COUNTER.can.
Start the CAPL Browser either from the configuration dialog [Edit...] button or directly by double clicking the
program block P in the Measurement Setup.
For your program you will first need an integer variable which counts the messages. For example, you could
name it counter. Go to the editor pane and enter this name in the variables block. The following should now
appear in this pane:
Example
variables
{
int counter;
}
Like all global variables, this variable is automatically initialized to zero at the start of measurement.
In the next step, this variable should be incremented whenever an EngineData message is registered. For this,
you must expand the CAPL program to include an event procedure of the type on message ("React to message
event"). To do this, click the CAN entry in the left tree view pressing the right mouse button. Open the submenu
New Event Handler. Then select the on message <new message> command.
Now a procedure template appears in the Procedures Text Editor. First replace the text <newMessage> by the
symbolic name EngineData, which you could also overtake directly from the database via the context menu
command Message from Database…. During compilation the CAPL compiler replaces the symbolic name by
the corresponding identifier 0x64.
Now you only need to define which actions should be performed when the event occurs. Since the program is to
count messages, the variable counter must be incremented whenever a message is registered. The complete
procedure appears as follows:
Example
on message EngineData
{
counter++;
output(this); // The EngineData value is displayed in the
// Trace Window
}
To display all other measurement values in the Trace Window, insert the following procedure:
Example
on message*
{
output(this);
}
Note
Without this procedure the CAPL program would have the effect of a filter because only the
message EngineData would be transmitted to the Trace Window in the Measurement Setup.
As a last step, the output to the Write Window must still be implemented. Finally, the program should not just
count messages, but also keep track of how many messages have been counted.
The output to the Write Window should occur when the <a> key is pressed. For this, you must define another
event procedure for the event Press key <a>.
Now insert a Keyboard event in the CAPL program. To do this, click the System entry in the left tree view
pressing the right mouse button. Open the menu path New Event Handler|on key <newKey>. A new
procedure template will appear in the Procedures Text Editor, which you fill out as follows:
Example
on key 'a'
{
write("%d EngineData messages counted ",counter);
}
The format entry %d refers to the integer variable counter, which is entered after the comma. For the most part,
this format string conforms to the C function printf().
That completes the program. Save it and then start the compiler either with the <F9> key, or the menu path
Compiler│Compile or by the button on the toolbar.
If you have made an error in creating the program, a message window will open showing you the error. Double
click this error notification to go to the location where the error occurred. After you have corrected it and saved the
program file again, recompile the program. Once the program has compiled without errors, the message
Compilation succeeded appears in the Output Window.
Now start the measurement. The sequence Message 1 begins to cyclically transmit messages of the type
EngineData, which are now counted by your program. Whenever you press the <a> key the text n EngineData
messages counted can be seen in the Write Window, where n represents the number of messages counted.
CANoe provides system variables to model the functional bus behavior of network nodes. These system
variables are described by events and states of the system environment (external pressure, temperature, switch
positions, etc.). You can observe and intentionally change these states - i.e. the values of the system variables -
on user-definable panels.
To work with system variables in CAPL you use the event procedure type on sysvar (React to change in
system variable). The CAPL functions SysGetVariableInt and SysSetVariableInt are used to read and
write system variables.
These language tools and symbolic access to the various variables defined in the database make it possible to
create simple prototypical network node models.
Task
Create a complete CANoe configuration with two network node models and associated
periphery, i.e. panels. This should only involve implementation of distributed functions: After the
user activates a switch pressing the left mouse button, the first node informs the second node of
this action. The second node then activates an indicator lamp in its periphery.
A model for distributed systems can be created efficiently in CANoe in three steps:
Create the database with messages, signals and environment variables
Create the network node periphery, i.e. the panels
Create the network node models in CAPL
To prepare this task, select the CAN_500kBaud_2ch.tcn template via the File ribbon tab|New and click on
Create Configuration.
The first step involves creating a database which describes a significant aspect of the system: The exchange of
information between the two network nodes via the communication medium, i.e. the CAN bus.
The database message and signal objects are available for describing the exchange of information over the CAN
bus. The simple functionality of the example can be handled by a 1-bit signal which describes the state of the
switch at the first node. This signal is packed in a CAN message and is only transmitted if the switch state
changes (spontaneous transmission).
Now create a new database with message Msg1 and signal bsSwitch.
1. Open with the symbol on the Tools ribbon tab the CANdb++ Editor.
2. Open the Template dialog via File|Create Database….
3. Select the CANoeTemplate.dbc template.
4. With [OK] you open the New Database File dialog.
Enter here the name of the new database (e.g. Database).
5. Close the dialog with [Save].
The new database is opened in the CANdb++ Editor.
Create a Message
Now create the message Msg1 with the identifier 100, which is to be transmitted by the first node.
1. Select Messages and open with the context menu command New… the configuration
dialog for the new message.
2. Enter the following values in the Definition page:
Name: Msg1
Typ: CAN Standard
ID: 0x100
DLC: 8
3. Close the dialog with [OK].
Create a Signal
Create the signal bsSwitch to describe the switch position and assign it to the message Msg1.
1. Select Signals and open with the context menu command New… the configuration dialog
for the new signal.
2. Enter the following values in the Definition page:
Name: bsSwitch
Length [Bit]: 1 (for the transmission of the states on=1 and out=0)
Byte Order: Intel
Value Type: Unsigned
Factor: 1
Offset: 0
Minimum: 0
Maximum: 1
3. Close the dialog with [OK].
You can assign the signal bsSwitch to the message Msg1 via drag and drop.
In the Simulation Setup you can add the database. If you move the mouse pointer to Databases in the tree view
of the current configuration and press the right mouse button, you can run the context menu command Add.
With the second step you have to describe the I/O interface between the nodes and their peripheries. For this
CANoe provides system variables. Each peripheral element (Switch, indicator lamp, slider, etc.) is wired to a
system variable, i.e. it is connected to the CAPL program for the network node.
In this example there are exactly two peripheral elements: A switch at the first node and an indicator lamp at the
second node. For this, two system variables must be created in the database, e.g. svLight and svSwitch.
5. Open the New System Variable dialog via again and define the second system variable
svSwitch. Enter the following values:
Namespace: MyNamespace
Name: svSwitch
Data type: Integer
6. Close the dialog with [OK].
Now you can see that both system variables are assigned to the namespace
MyNamespace.
7. Close the dialog with [OK].
Cross Reference
You can find detailed information about system variables in the help of CANoe.
A separate application, the Panel Designer, is provided with CANoe for creating the node periphery. In the
current configuration, one separate panel must be created for each of the two nodes.
Cross Reference
Please refer to the help of CANoe for a detailed introduction into the Panel Designer.
Before creating the network node models, you should save the configuration you just created with on the
Home ribbon tab of CANoe.
You create the network node models in the Simulation Setup. At the least, the model for the first node must
send a message when the switch is activated, and therefore it may not be inserted in the Measurement Setup.
In this example you need two network nodes in the Simulation Setup: The first node supplies the switch
position, and the second reacts to this by activating or deactivating a small lamp.
In the Simulation Setup click the bus lines to insert new network node models.
You open the configuration dialog of the nodes with the context menu command Configuration…. Enter here
the node name (e.g. ECU 1 or ECU 2).
Open with [File…] the Open dialog. Enter here the name of the CAPL program that simulates the functionality of
the network node (e.g. ECU1.can or ECU2.can).
Double click on each node to open the CAPL Browser for the particular CAPL program. The first CAPL program
belongs to a node at whose periphery there is a switch. When the switch position changes, the program acquires
the new switch value and immediately outputs it on the bus:
Example
// Reaction to change of system variable svSwitch
on sysvar sysvar::MyNamespace::svSwitch {
// Declare a CAN message to be transmitted
message Msg1 msg;
// Read out the value of the light switch,
// Assign to the bus signal bsSwitch
msg.bsSwitch = SysGetVariableInt(sysvar::MyNamespace::svSwitch);
// Output message on bus (spontaneous transmission)
output(msg);
}
The second network node reacts to this message. The CAPL program reads the value of the bus signal for the
switch position and then activates or deactivates the indicator lamp at its periphery. Please note that the switch
value is only acquired via the signal value on the bus. The value of the environment variable svSwitch is not
known to this CAPL program. That is, the communication between the two nodes occurs via the bus:
Example
// Reaction to receipt of the CAN message M1
on message Msg1 {
// Read out a bus signal and
// set the system variable
SysSetVariableInt(sysvar::MyNamespace::svLight, this.bsSwitch);
}
Now start the measurement in CANoe. Whenever you activate the switch on Panel 1 the indicator lamp
illuminates. Whenever you turn the switch off, the indicator lamp goes off. The Trace Window shows you both the
bus communication (Spontaneous transmission of message Msg1 when the switch position changes) and the
values of system variables svSwitch and svLight.