Transcription of CAPL Scripting Quickstart - Vector Informatik
1 | 2019-04-17 CAPL (CommunciationAccess Programming Language)For canalyzer and CANoeCAPL Scripting QuickstartuBefore Getting StartedVisual Sequencer (GUI Based Programming)Brief Introduction to CAPLP anel Creation and CAPLA dditional InformationContact InformationAgenda2 EthernetMOSTFlexRayLINCANS imulationTestAnalysisDiagnosticsCANoeDif ference between canalyzer and CANoeBefore Getting StarteduCANoe 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 testsCANalyzer3uThe canoe Interaction Layer (in short CANoeIL).
2 >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 ModeluTransmission of messages and signals is described based on attributes in the databaseuCANoeILmodels the transmission behavior at run-time using those attributesCANoe Interaction LayerBefore Getting Started4 CAPL 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.
3 Does not support CAPL programsuFUN: Fundamental variant: simple applications, does notsupport CAPL, diagnostic tester and panelsDetailed information about the variants of canalyzer is available at our website: SupportBefore Getting Started5 Before Getting StarteduVisual Sequencer (GUI Based Programming)Brief Introduction to CAPLP anel Creation and CAPLA dditional InformationContact InformationAgenda6uAvailable in both canalyzer PRO and EXP as well as canoe >Intended to allow some automation within the EXP variantuThe Visual Sequencer allows you to create automated command sequenceswith the purpose of>Stimulating the network>Controlling applicationsuIn order to structurethe individual steps, loops and conditional command blocks can be used, such as >if, else if, end ifuEach sequence is shown in a separate window, and can be edited at any time.
4 Even while a measurement is Sequencer (GUI Based Programming)7uSend messages (cyclically)uSet signals/variablesuIf, else, else if and repeat commandsuWait commandsuStart/stop replayuWrite text or valuesto write window or fileuGraphical debuguAuto complete for namesFeaturesVisual Sequencer (GUI Based Programming)8 See Sample Configuration: CAN System Demo ( )Visual Sequencer (GUI Based Programming)9 Before Getting StartedVisual Sequencer (GUI Based Programming)uBrief Introduction to CAPLP anel Creation and CAPLA dditional InformationContact InformationAgenda10 Functional blocks based on CAPL (Communication Access Programming Language) can be created to programuNetwork node modulesuSpecial evaluation programs for individual applicationsSome CAPL characteristics.
5 UC-like programming languageuEvent based, not interrupt driven uCAPL programs are created using an integrated development environment called the CAPL BrowseruDirect access to signals, system variables and diagnostic parametersuAble to link user created DLLsGeneralBrief Introduction to CAPL11uCreatingandextendingsimulationsuI mplementingfunctionsforanalysisinthemeas urementsetupCANoeBrief Introduction to CAPLS imulation SetupMeasurement Setup12uCreatingsimulationsorreactivescr iptsuImplementingfunctionsforanalysisint hemeasurementsetupCANalyzerBrief Introduction to CAPLSend Loop of the Measurement SetupAnalysis Branches13 CAPL BrowserBrief Introduction to CAPLC ompiler MessagesBrowser Tree(List of Events)
6 Symbols andFunctionsEditor14uInordertogeneratean executableprogramfilefromaCAPL program,theprogrammustbecompiledwiththeC APL compiler:uError messages are shown in the lower Message Window:When you double-click the error description, the cursor in the Text Editor automatically jumps to the point in the source code, where the error Introduction to CAPL15uAdditional CAPL files that contain generic code that can be reused in other programsuVariables defined here are accessible throughout the CAPL programuMultiple pre-defined event handlers exist for your use within CAPL. The code in this handler will only be executed when the event can create your own functions (special handler) that contain related code to be executed frequentlyExamining a CAPL ProgramBrief Introduction to CAPL16 CAPL is a procedural language in which the execution of program blocks is controlled by events.
7 These program blocks are referred to as event procedures. Adding Event HandlersBrief Introduction to CAPL17 Important Event Handlers (CAN)Brief Introduction to CAPLuStartofmeasurementuMessagereceivedu SignalchangeuTimeeventuKeypresson Start{write ("Start of canoe ");}on signal sigTemp{write ("Signal Temperature");}on timer tmrCycle{write ("within cycle");}on key 'a'{write ("Key >a< pressed");}on message 0x123{write ("CAN Message 123");}18on 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 Key ProceduresBrief Introduction to CAPL19 Data Types for CANB rief Introduction to CAPLTypeNameBitNoteIntegersSignedUnsigne dintlongint64byteworddwordqword163264816 3264 Floating pointfloatdouble6464 Per IEEEPer IEEES ingle characterchar8 Message
8 Variablefor CANmessagefor CAN messagesTime variablesfor secondsfor millisecondstimermstimerfor Timer in sfor Timer in ms20 Variables in CAPLB rief Introduction to CAPLuCAPL code:int i= 100;// Declaration and initialization of an integer STATIC VARIABLES!!char ch= 'a';// Declaration and initialization of a characterfloat x;// 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).
9 UResults:21 String Format SpecifiersBrief Introduction to CAPLS pecifierDescription"%ld","%d"decimal display"%lx","%x"hexadecimal display"%lX","%X"hexadecimal display (upper case)"%lu","%u"unsigned display"%lo","%o"octal display"%s"display a string"%g","%f"floating point display. % means, 5 digits in total (decimal point inclusive) and 3 digits after the decimal point. 5 is the minimum of digits in this case."%c"display a character"%%"display %-character"%I64d","%lld"decimal display of a 64 bit value"%I64x","%llx hexadecimal display of a 64 bit value"%I64X","%llX"hexadecimal display of a 64 bit value (upper case)"%I64u","%llu"unsigned display of a 64 bit value"%I64o","%llo"octal display of a 64 bit value22 OperatorsBrief Introduction to CAPLO peratorDescriptionExample+ -Addition, subtraction-* /Multiplication, division-++ --Increment or decrement by 1a++; // increments a by 1%Modulo division (returns integer remainder of a division)a = 4 % 3.
10 // a is 1< <=Lessthan; lessthanorequaltoreturns 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)^BitwiseexclusiveOR (XOR)01^11 // ergibt 10>> <<Bit shift to right or left1 << 3 // yields8 (0001 1000)23 Before Getting StartedVisual Sequencer (GUI Based Programming)