CAPL Scripting Qickstart CAPL (Commnication Access Programming Langage) For CANalyzer and CANoe V1.01 2015-12-03
Agenda Important information before getting started 3 Visal Seqencer (GUI based programming (Sbset of CAPL)) 7 Brief Introdction to CAPL 11 Notes on Panel creation and se 24 Where to find additional information 28 Contact Information 30 2
Important information before getting started CANalyzer verss CANoe CANalyzer is wholly contained within CANoe CANoe Simlation Test Diagnostics CANalyzer Analysis Ethernet MOST FlexRay LIN CAN CANoe offers significant additional capability beyond CANalyzer to: > Stimlate the network(s) with Interaction Layer knowledge > Rn atomated tests and generate test reports > Implement atomated diagnostic tests 3
Important information before getting started CANoe and the added vale of the Interaction Layer The CANoe Interaction Layer (in short CANoeIL): > Provides a signal-oriented means of accessing the bs > Map signals to their appropriate send messages > Controls the sending of these messages as a fnction of the (OEM) Send Model Transmission of messages and signals is described based on attribtes in the database CANoeIL models the transmission behavior at rn-time sing those attribtes 4
Important information before getting started Overview of CANalyzer variants CAPL is available in CANalyzer PRO and all versions of CANoe CANalyzer is available in three different variants: PRO: Professional variant: fll fnctionality EXP: Expert variant: spports all applications p to complex analysis of heterogeneos systems; does not spport CAPL programs FUN: Fndamental variant: simple applications, does not spport CAPL, diagnostic tester and panels Detailed information abot the variants of CANalyzer is available at or website: http://www.vector.com/vi_canalyzer_variants_en.html 5
Agenda Important information before getting started 3 Visal Seqencer (GUI based programming (Sbset of CAPL)) 7 Brief Introdction to CAPL 11 Notes on Panel creation and se 24 Where to find additional information 28 Contact Information 30 6
Visal Seqencer (GUI based programming (Sbset of CAPL)) General Available in both CANalyzer PRO and EXP > Intended to allow some atomation within the EXP variant The Visal Seqencer allows yo to create atomated command seqences with the prpose of > Stimlating the network > Controlling applications In order to strctre the individal steps, loops and conditional command blocks can be sed, sch as > if, else if, end if Each seqence is shown in a separate window, and can be edited at any time, even while a measrement is rnning. 7
Visal Seqencer (GUI based programming (Sbset of CAPL)) Featres Send messages (cyclically) Set signals/variables If, else, else if and repeat commands Wait commands Start/stop replay Write text or vales to write window or file Graphical debg Ato complete for names 8
Visal Seqencer (GUI based programming (Sbset of CAPL)) See the CANsystemdemo.cfg inclded with yor installation 9
Agenda Important information before getting started 3 Visal Seqencer (GUI based programming (Sbset of CAPL)) 7 Brief Introdction to CAPL 11 Notes on Panel creation and se 24 Where to find additional information 28 Contact Information 30 10
Brief Introdction to CAPL General Fnctional blocks based on CAPL (Commnication Access Programming Langage) can be created to program Network node modles Special evalation programs for individal applications Some CAPL characteristics: C-like programming langage Event based, not interrpt driven CAPL programs are created sing an integrated development environment called the CAPL Browser Direct access to signals, system variables and diagnostic parameters Able to link ser created DLLs 11
Brief Introdction to CAPL Field of Application CANoe Creating and extending simlations Implementing fnctions for analysis in the measrement setp Simlation Setp Measrement Setp 12
Brief Introdction to CAPL Field of Application CANalyzer Creating simlations or reactive scripts Implementing fnctions for analysis in the measrement setp Send Loop of the Measrement Setp Analysis Branches 13
Brief Introdction to CAPL CAPL Browser 14
Brief Introdction to CAPL Compiling In order to generate an exectable program file from a CAPL program, the program mst be compiled with the CAPL compiler: Error messages are shown in the lower Message Window: When yo doble-click the error description, the crsor in the Text Editor atomatically jmps to the point in the sorce code, where the error originated. 15
Brief Introdction to CAPL Examining a CAPL program Additional CAPL files that contain generic code that can be resed in other programs Variables defined here are accessible throghot the CAPL program Mltiple pre-defined event handlers exist for yor se within CAPL. The code in this handler will only be exected when the event occrs. Yo can create yor own fnctions (special handler) that contain related code to be exected freqently 16
Brief Introdction to CAPL Adding an Event Handler CAPL is a procedral langage in which the exection of program blocks is controlled by events. These program blocks are referred to as event procedres. 17
Brief Introdction to CAPL Important Event Handlers Start of measrement on Start { write ("Start of CANoe"); } Message received on message 0x123 { write ("CAN Message 123"); } Signal change on signal sigtemp { write ("Signal Temperatre"); } Time event on timer tmrcycle { write ("within cycle"); } Key press on key 'a' { write ("Key >a< pressed"); } 18
Brief Introdction to CAPL On Key Procedres on key 'a' on key ' ' on key 0x20 on key F1 on key ctrlf12 on key PageUp on key Home on key * // React to press of a key // React to press of spacebar // React to press of spacebar // React to press of F1 key // React to press of Ctrl-F12 // React to press of Page Up key // React to press of Home key // React to any key press except 19
Brief Introdction to CAPL Data types for CAN Type Name Bit Note Integers Signed Unsigned int long int64 byte word dword qword 16 32 64 8 16 32 64 Floating point float doble 64 64 Per IEEE Per IEEE Single character char 8 Message variable for CAN message for CAN messages Time variables for seconds timer for Timer in s for milliseconds mstimer for Timer in ms 20
Brief Introdction to CAPL Variables in CAPL CAPL code: int i = 100; char ch = 'a'; float x; // Declaration and initialization of an integer // Declaration and initialization of a character // Declaration of a floating point nmber write ("Hndred as decimal nmber: %d", i); write ("Hndred as hexadecimal nmber: %x", i); write ("Pi as floating point nmber: %f", pi); write ("The decimal ASCII code of %c is %d", ch, ch); write ("The vale of x is %f", x); Reslts: 21
Brief Introdction to CAPL Operators Operator Description Example + - Addition, sbtraction - * / Mltiplication, division - ++ -- Increment or decrement by 1 a++; // increments a by 1 % Modlo division (retrns integer remainder of a division) a = 4 % 3; // a is 1 < <= Less than; less than or eqal to retrns TRUE or FALSE > >= Greater than; greater than or eqal to retrns TRUE or FALSE ==!= Compare for eqality or ineqality retrns TRUE or FALSE && Logic AND retrns TRUE or FALSE Logic OR retrns TRUE or FALSE! Logic NOT changes TRUE to FALSE and vice versa & Bitwise AND 1 & 7 // yields 1 (0001 & 0111 0001) Bitwise OR 1 7 // yields 7 (0001 0111 0111) ~ Bitwise complement ~1 // yields 14 (0001 1110) ^ Bitwise exclsive OR (XOR) 01^11 // ergibt 10 >> << Bit shift to right or left 1 << 3 // yields 8 (0001 1000) 22
Agenda Important information before getting started 3 Visal Seqencer (GUI based programming (Sbset of CAPL)) 7 Brief Introdction to CAPL 11 Notes on Panel creation and se 24 Where to find additional information 28 Contact Information 30 23
Notes on Panel creation and se Creating a Panel A signal is mapped to each display or control: Drag & Drop 24
Notes on Panel creation and se Creating a System Variable for se with in a configration Signals can be atomatically or ser created, saved, exported, and imported via the Configration Systems Variables dialog: 25
Agenda Important information before getting started 3 Visal Seqencer (GUI based programming (Sbset of CAPL)) 7 Brief Introdction to CAPL 11 Notes on Panel creation and se 24 Where to find additional information 28 Contact Information 30 26
Agenda Important information before getting started 3 Visal Seqencer (GUI based programming (Sbset of CAPL)) 7 Brief Introdction to CAPL 11 Notes on Panel creation and se 24 Where to find additional information 28 Contact Information 30 27
Where to find additional information Online Help file: Use Index CAPL Introdction 28
Agenda Important information before getting started 3 Visal Seqencer (GUI based programming (Sbset of CAPL)) 7 Brief Introdction to CAPL 11 Notes on Panel creation and se 24 Where to find additional information 28 Contact Information 30 29
Contact Information Looking for more information? Visit or website: > http://www.vector.com Sign in for a Vector training class: > http://www.vector.com/vi_training_en.html Need help with Vector tools? Contact or spport team: > (248) 449 9290 Option 2 > spport@s.vector.com 30