Transcription

CAPL Scripting QuickstartCAPL (Communication Access Programming Language) For CANalyzer and CANoeV1.01 2015-12-03

Agendau2Important information before getting started3Visual Sequencer (GUI based programming (Subset of CAPL))7Brief Introduction to CAPL11Notes on Panel creation and use24Where to find additional information28Contact Information30

Important information before getting startedCANalyzer versus CANoeCANalyzer is wholly contained within isEthernetMOSTFlexRayLINCANCANoe offers significant additional capability beyond CANalyzer to: Stimulate the network(s) with Interaction Layer knowledge Run automated tests and generate test reports Implement automated diagnostic tests3

Important information before getting startedCANoe and the added value of the Interaction Layeruuu4The CANoe Interaction Layer (in short CANoeIL): Provides a signal-oriented means of accessing the bus Map signals to their appropriate send messages Controls the sending of these messages as a function of the (OEM) Send ModelTransmission of messages and signals is described based on attributes in the databaseCANoeIL models the transmission behavior at run-time using those attributes

Important information before getting startedOverview of CANalyzer variantsCAPL is available in CANalyzer PRO and all versions of CANoeCANalyzer is available in three different variants:uPRO: Professional variant: full functionalityuEXP: Expert variant: supports all applications up tocomplex analysis of heterogeneous systems; doesnot support CAPL programsuFUN: Fundamental variant: simple applications, does notsupport CAPL, diagnostic tester and panelsDetailed information about the variants of CANalyzer is available at ourwebsite: http://www.vector.com/vi canalyzer variants en.html5

Agendau6Important information before getting started3Visual Sequencer (GUI based programming (Subset of CAPL))7Brief Introduction to CAPL11Notes on Panel creation and use24Where to find additional information28Contact Information30

Visual Sequencer (GUI based programming (Subset of CAPL))GeneralAvailable in both CANalyzer PRO and EXP Intended to allow some automation within the EXP variantThe Visual Sequencer allows you to create automated command sequenceswith the purpose of Stimulating the networkControlling applicationsIn order to structure the individual steps, loops and conditional commandblocks can be used, such as if, else if, end ifEach sequence is shown in a separate window, and can be edited at anytime, even while a measurement is running.7

Visual Sequencer (GUI based programming (Subset of CAPL))Features8uSend messages (cyclically)uSet signals/variablesuIf, else, else if andrepeat commandsuWait commandsuStart/stop replayuWrite text or valuesto write window or fileuGraphical debuguAuto complete for names

Visual Sequencer (GUI based programming (Subset of CAPL))See the CANsystemdemo.cfg included with your installation9

Agendau10Important information before getting started3Visual Sequencer (GUI based programming (Subset of CAPL))7Brief Introduction to CAPL11Notes on Panel creation and use24Where to find additional information28Contact Information30

Brief Introduction to CAPLGeneralFunctional blocks based on CAPL (Communication Access ProgrammingLanguage) can be created to programu Network node modulesu Special evaluation programs for individual applicationsSome CAPL characteristics:u C-like programming languageu Event based, not interrupt drivenu CAPL programs are created using an integrated developmentenvironment called the CAPL Browseru Direct access to signals, system variables and diagnostic parametersu Able to link user created DLLs11

Brief Introduction to CAPLField of Application CANoeuCreating and extending simulationsuImplementing functions for analysis in the measurement setupSimulation Setup12Measurement Setup

Brief Introduction to CAPLField of Application CANalyzeruCreating simulations or reactive scriptsuImplementing functions for analysis in the measurement setupSend Loop of the Measurement Setup13Analysis Branches

Brief Introduction to CAPLCAPL Browser14

Brief Introduction to CAPLCompilinguIn order to generate an executable program file from a CAPL program,the program must be compiled with the CAPL ndow:When you double-click the error description, the cursor in the TextEditor automatically jumps to the point in the source code, where theerror originated.15

Brief Introduction to CAPLExamining a CAPL programAdditional CAPL files that contain generic codethat can be reused in other programsVariables defined here are accessiblethroughout the CAPL programMultiple pre-defined event handlers exist foryour use within CAPL. The code in this handlerwill only be executed when the event occurs.You can create your own functions (specialhandler) that contain related code to beexecuted frequently16

Brief Introduction to CAPLAdding an Event HandlerCAPL is a procedural language in which the execution of program blocks iscontrolled by events. These program blocks are referred to as eventprocedures.17

Brief Introduction to CAPLImportant Event Handlersuu18Start of measurementon Start{write ("Start of CANoe");}Message receivedon message 0x123{write ("CAN Message 123");}uSignal changeuTime eventuKey presson signal sigTemp{write ("Signal Temperature");}on timer tmrCycle{write ("within cycle");}on key 'a'{write ("Key a pressed");}

Brief Introduction to CAPLOn Key Procedures19on key 'a'// React to press of ‘a’ keyon key ' '// React to press of spacebaron key 0x20// React to press of spacebaron key F1// React to press of F1 keyon key ctrlF12// React to press of Ctrl-F12on key PageUp// React to press of Page Up keyon key Home// React to press of Home keyon key *// React to any key press except

Brief Introduction to CAPLData types for 8163264Floating pointfloatdouble6464Single charactercharIntegersSignedUnsigned20NotePer IEEEPer IEEE8Message variablefor CANmessagefor CAN messagesTime variablesfor secondsfor millisecondstimermstimerfor Timer in sfor Timer in ms

Brief Introduction to CAPLVariables in CAPLuCAPL 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 numberwrite ("Hundred as decimal number: %d", i);write ("Hundred as hexadecimal number: %x", i);write ("Pi as floating point number: %f", pi);write ("The decimal ASCII code of %c is %d", ch, ch);write ("The value of x is %f", x);u21Results:

Brief Introduction to CAPLOperatorsOperatorDescriptionExample -Addition, subtraction-*/Multiplication, division- --Increment or decrement by 1a ;Modulo division (returns integerremainder of a division)a 4 % 3;%// a is 1 Less than; less than or equal toreturns TRUE or FALSE Greater than; greater than or equal toreturns TRUE or FALSE ! Compare for equality or inequalityreturns TRUE or FALSE&&Logic ANDreturns TRUE or FALSE Logic ORreturns TRUE or FALSE!Logic NOTchanges TRUE to FALSE and vice versa&Bitwise AND1 & 7// yields 1 (0001 & 0111 0001) Bitwise OR1 7// yields 7 (0001 0111 0111) Bitwise complement 1// yields 14 (0001 1110) Bitwise exclusive OR (XOR)01 11 // ergibt 10Bit shift to right or left1 3 // yields 8 (0001 1000) 22// increments a by 1

Agendau23Important information before getting started3Visual Sequencer (GUI based programming (Subset of CAPL))7Brief Introduction to CAPL11Notes on Panel creation and use24Where to find additional information28Contact Information30

Notes on Panel creation and useCreating a PanelA signal is mapped to each display or control:Drag & Drop24

Notes on Panel creation and useCreating a System Variable for use with in a configurationSignals can be automatically or user created, saved, exported, andimported via the Configuration Systems Variables dialog:25

Agendau26Important information before getting started3Visual Sequencer (GUI based programming (Subset of CAPL))7Brief Introduction to CAPL11Notes on Panel creation and use24Where to find additional information28Contact Information30

Agendau27Important information before getting started3Visual Sequencer (GUI based programming (Subset of CAPL))7Brief Introduction to CAPL11Notes on Panel creation and use24Where to find additional information28Contact Information30

Where to find additional informationOnline Help file: Use Index CAPL Introduction28

Agendau29Important information before getting started3Visual Sequencer (GUI based programming (Subset of CAPL))7Brief Introduction to CAPL11Notes on Panel creation and use24Where to find additional information28Contact Information30

Contact InformationLooking for more information?Visit our website: http://www.vector.comSign in for a Vector training class: http://www.vector.com/vi training en.htmlNeed help with Vector tools?Contact our support team: 30(248) 449 – 9290 Option [email protected]

4 CANoe and the added value of the Interaction Layer Important information before getting started u The CANoe Interaction Layer (in short CANoeIL): Provides a signal-oriented means of accessing the bus Map signals to their appropriate send messages Controls the sending of these messages as a function