Professional Documents
Culture Documents
use of CAPL
CAPL is a programming language available in the software tools CANoe and
CANalyzer. In three consecutive articles, CAPL fundamentals will be discussed
as well as tips for all levels of user knowledge.
performs one of the ba- signals it contains are condi- Lines 7 to 9 show a has been just transmit-
sic tasks of a bus monitor- tioned for display on a pan- minimal form of a message ted. Only received messag-
ing tool: it listens to traffic on el, and they are routed to the event procedure. This func- es should be considered in
the bus and prepares a cou- panel for graphic display.
tion is called whenever this this program (value RX), be-
ple of events on the bus for message has been transmit- cause a message sent by the
observation/monitoring by Description of ted on the bus. In reference node itself would also trig-
the user. This is a shortened, the program to CAN, this means that the ger an event procedure (val-
sample CANoe program: precise time point is the TX or ue TX). In this case, an error
“Display.can” from the sam- T
he line numbers are not RX interrupt of the CAN con- message would be output in
ple “Easy.cfg”. In the follow- part of the CAPL program troller, i.e. immediately after line 15.
ing, first the overall function- and are only inserted here correct transmission of the Since conditioning of the
ality is briefly summarized, to make it easier to refer- message. The message that signal for display on the user
and then the individual sec- ence individual lines or sec- triggers the call of the partic- interface (a panel on which
tions are described in more tions. To achieve the most ular function is referenced by different states are shown by
detail. compact representation pos- “this” syntax. different bitmaps) is some-
sible, opening brackets were In line 8, the value of what more complex, its im-
Task description not placed on a separate the “EngineSpeed” signal is plementation is outsourced to
line. I
n a CAPL program, it is read out from the received a separate function: In line 13,
The task is to observe a CAN possible to define global vari- message (“this”) and is as- “SetLightDsp” is called with
network whose elements ables and constants. This is signed to a system variable the two message signals
– e.g. bus nodes, messag- done in the “variables” sec- with a conversion (/1000.0). that are needed as param-
es and transported signals tion (lines 1 to 5). These Lines 11 to 17 show a mes- eters. Finally, lines 19 to
– are described in a data- constants and variables are sage event procedure for the 28 define a separate function,
base. When the “EngineS- globally defined for this pro- “LightState” message, which which writes different values
tate” message is received, gram: they can be used any- transmits the information for to the system variable “Light-
then the Engine-Speed sig- where in the program, but not a turn signal flasher. Its pro- Display” in the “Lights” name
nal it contains is conditioned in other programs within the cessing is similar to that of space according to the value
for display on a display pan- same CANoe application. the “EngineState” message of the transmitted signal. In
el, and it is routed to the pan- The other sections define re- with the following unique as- this demo configuration, this
el. When the “LightState” actions to events (lines 7 to pects: In line 12, the direc- variable then selects the ap-
message is received, the 17) and an auxiliary function tion flag (.dir) is now checked propriate bitmap on a display
“HeadLight” and “FlashLight” (lines 19 to 28). in the message (“this”) that panel.