CANoe DENoe - KEMT FEI TUKE
CANoe DENoe - KEMT FEI TUKE
CANoe DENoe - KEMT FEI TUKE
You also want an ePaper? Increase the reach of your titles
YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.
Unit 7: Create a CAPL program with which you can count the number of messages<br />
of the type EngineData (ID 64 hex) and output the counted number<br />
of messages to the Write window in response to a key press.<br />
First, switch <strong>CANoe</strong> back to Online mode. In the simulation setup the generator block<br />
which sends EngineData messages cyclically onto the bus should still be the data<br />
source.<br />
First you must decide where you wish to insert your CAPL program in the data flow<br />
plan. In principle, any hotspot in the measurement setup or in the simulation setup is<br />
available to you. However, since this program is solely for analysis purposes and<br />
does not generate any messages itself, but only counts them, it is advisable to insert<br />
the program on the right side of the measurement setup, perhaps before the Statistics<br />
block. In the hotspot's popup menu choose the function Insert CAPL node. A<br />
function block with the program symbol P now appears at the selected point in the<br />
measurement setup. You can also access the node's configuration dialog via the<br />
popup menu. First, select a program name, e.g. COUNTER.CAN, and then start the<br />
CAPL Browser either from the configuration dialog's [Edit...] button or directly by<br />
double clicking the program block in the measurement setup.<br />
CAPL is an event-based programming language. Each CAPL program consists of<br />
event procedures, with which you can react to external events (e.g. occurrence of<br />
specific messages on the CAN bus or activation of keys on the PC keyboard). The<br />
CAPL Browser is described in detail in the online help. With its sub-windows<br />
("Panes") it allows you to create and edit CAPL programs quickly and easily.<br />
In principle, you can also use your own text editor to create CAPL programs. CAPL<br />
programs are normal ASCII files with the default name extension *.CAN, which must<br />
be compiled before the start of measurement using the compiler provided with the<br />
<strong>CANoe</strong> product.<br />
For your program you will first need an integer variable which counts the messages.<br />
For example, you could name it counter. Go to the upper right Browser pane and<br />
enter this name in the variables block. The following should now appear in this pane:<br />
variables {<br />
}<br />
int counter;<br />
Like all global variables, this variable is automatically initialized to zero at the measurement<br />
start.<br />
In the next step, this variable should be incremented whenever an EngineData message<br />
is registered. Therefore, you must expand the CAPL program to include an event<br />
procedure of the type on message ("React to message event"). To do this, click<br />
the event type CAN Messages in the Browser tree using the right mouse button and<br />
insert a new event procedure of this type using the command New from the popup<br />
menu.<br />
Now a procedure template appears in the Procedures Text Editor. First replace the<br />
text by the symbolic name EngineData, which you could also assume<br />
directly from the database via the popup menu item CANdb Message. During<br />
© Vector Informatik GmbH <strong>CANoe</strong>/<strong>DENoe</strong> Manual Version 4.1.1<br />
25