capl programming for canalyzer PDF

Title capl programming for canalyzer
Author Piero Spinelli
Course Automotive control systems
Institution Politecnico di Torino
Pages 216
File Size 9.3 MB
File Type PDF
Total Downloads 1
Total Views 152

Summary

capl programming for canalyzer that is a vector sw for automotive...


Description

Programming with CAPL

CAN alyzer CAN oe

the art of engineering

Programming With CAPL

December 14, 2004 First printing

Vector CANtech, Inc. Suite 550 39500 Orchard Hill Place Novi, MI 48375 USA http://www.vector-cantech.com

II

© 2004, 2005 Vector CANtech, Inc Novi, Michigan 48375 USA The authors and publishers have used their best efforts in preparing this book. These efforts include development, research, and testing of the theories, principles, and programming sample code so as to determine their effectiveness. The authors and/or publishers make no warranty, expressed or implied, with regard to the sample code or to any other documentation contained in this book. The authors and/or publishers shall not be liable in any event for incidental or consequential damages in connection with, or arising out of, the furnishing, performance, or use of the sample code or any of the contents of this book. All rights reserved. No part of this book may be reproduced, in any form or by any means, without express permission in writing from Vector CANtech, Inc.

Table of Contents

III

Preface..............................................................................................................................................................................IX About This Book ............................................................................................................................................................IX Organization ..................................................................................................................................................................IX Acknowledgments .........................................................................................................................................................IX Tell Us What You Think!.................................................................................................................................................X 1 Introduction to CAPL................................................................................................................................................... 1 1.1 Evaluation Capability ........................................................................................................................................... 1 1.2 Simulation Capability ........................................................................................................................................... 1 1.3 Prerequisites for Using CAPL.............................................................................................................................. 2 1.4 Learning Steps .................................................................................................................................................... 2 1.5 CAPL – Event-Driven Software ........................................................................................................................... 3 1.6 CAPL Program Organization ............................................................................................................................... 3 1.7 Using the CAPL Browser for Program Development .......................................................................................... 3 1.8 Program Development Uses the Database Tool – CANdb++............................................................................. 3 1.9 CAPL Programming Knowledge.......................................................................................................................... 4 1.10 CAN Communication Knowledge .................................................................................................................... 4 1.11 THE WARNING – Welcome to the Jungle....................................................................................................... 4 1.12 Responsibility................................................................................................................................................... 5 2 CANalyzer and CANoe ............................................................................................................................................... 6 2.1 One Key Difference – Level of Node Control ...................................................................................................... 6 2.2 Graphic Panels – The Other Major Difference .................................................................................................... 7 3 A Brief Introduction to CANalyzer............................................................................................................................... 9 3.1 Value of the Downloadable Demo....................................................................................................................... 9 3.2 First-Time Considerations ................................................................................................................................... 9 3.3 How to Start and Stop CANalyzer ..................................................................................................................... 10 3.4 The Architecture of CANalyzer.......................................................................................................................... 10 3.5 Measurement Setup Window ............................................................................................................................ 12 3.5.1 Trace Window ............................................................................................................................................ 12 3.5.2 Statistics Window ....................................................................................................................................... 12 3.5.3 Bus Statistics Window ................................................................................................................................ 13 3.5.4 Data Window .............................................................................................................................................. 13 3.5.5 Graphics Window ....................................................................................................................................... 13 3.5.6 Write Window ............................................................................................................................................. 13 3.6 Duplicating Analysis Blocks............................................................................................................................... 13 3.7 Controlling Data Flow ........................................................................................................................................ 13 3.8 Function Blocks ................................................................................................................................................. 13 3.8.1 Filtering Blocks ........................................................................................................................................... 14 3.8.2 Message Blocks ......................................................................................................................................... 15 3.9 Using CAPL Program Blocks in CANalyzer ...................................................................................................... 17 3.9.1 CANalyzer Program Blocks for Transmission............................................................................................ 18 3.9.2 Program Blocks for Analysis ...................................................................................................................... 19 3.10 CANalyzer – CAPL Programming Environment ............................................................................................ 20 4 A Brief Introduction to CANoe .................................................................................................................................. 21 4.1 Value of the Downloadable Demo..................................................................................................................... 21 4.2 First-Time Considerations ................................................................................................................................. 21 4.3 Learning from the Demo.................................................................................................................................... 22 4.4 Tool Architecture of CANoe............................................................................................................................... 23 4.5 Using CAPL Program Blocks in CANoe ............................................................................................................ 24 4.5.1 CANoe Program Blocks for Simulation ...................................................................................................... 24 4.5.2 CANoe Program Blocks for Analysis.......................................................................................................... 25 4.6 CANoe – CAPL Programming Environment ..................................................................................................... 25 5 Using Databases with CAPL .................................................................................................................................... 26 5.1 Why Use a Database with CAPL?..................................................................................................................... 26 5.1.1 Additional Uses of the Database................................................................................................................ 26 5.2 Database Association with CAPL...................................................................................................................... 26 5.3 Database Objects Accessible by CAPL ............................................................................................................ 27 5.3.1 Attributes .................................................................................................................................................... 28 5.3.2 Value Tables .............................................................................................................................................. 28 5.3.3 Network Nodes........................................................................................................................................... 28 5.3.4 Messages ................................................................................................................................................... 28

IV

6 7

8

9

5.3.5 Signals........................................................................................................................................................28 5.3.6 Environment Variables ...............................................................................................................................28 Using Panels with CAPL (CANoe only) ....................................................................................................................29 The CAPL Browser ...................................................................................................................................................30 7.1 Starting the CAPL Browser................................................................................................................................30 7.2 Browser Organization ........................................................................................................................................31 7.3 Using the Right Mouse Button...........................................................................................................................32 7.4 The Events Window...........................................................................................................................................32 7.4.1 Creating an Event Procedure .....................................................................................................................32 7.5 The Global Variables Window ...........................................................................................................................32 7.6 The Event Procedure Window...........................................................................................................................33 7.7 Colorized CAPL Syntax .....................................................................................................................................33 7.8 Compiling Code .................................................................................................................................................33 7.9 Fixing Compilation Errors ..................................................................................................................................34 7.10 Debugging Run-Time Errors ..........................................................................................................................34 7.11 Using Other Text Editors................................................................................................................................35 7.12 CAPL Source File Format ..............................................................................................................................35 CAPL Syntax and Semantics....................................................................................................................................37 8.1 Major CAPL Differences from C ........................................................................................................................37 8.2 CAPL Equivalents to C Functions .....................................................................................................................38 8.3 Notation .............................................................................................................................................................38 8.4 Comments .........................................................................................................................................................38 8.5 Naming Conventions .........................................................................................................................................39 8.6 CAPL is Case Sensitive.....................................................................................................................................39 8.7 CAPL Keywords.................................................................................................................................................39 8.8 Data Types ........................................................................................................................................................40 8.9 Declarations.......................................................................................................................................................41 8.9.1 Local Variables are Static...........................................................................................................................41 8.9.2 Initialization.................................................................................................................................................42 8.10 Type Casting ..................................................................................................................................................42 8.11 Arrays.............................................................................................................................................................42 8.12 Constants .......................................................................................................................................................43 8.12.1 Integer Constants .......................................................................................................................................43 8.12.2 Floating Point Constants ............................................................................................................................44 8.12.3 Character Constants...................................................................................................................................44 8.12.4 String Constants .........................................................................................................................................45 8.12.5 Symbolic Constants....................................................................................................................................45 8.13 Operators .......................................................................................................................................................46 8.13.1 Arithmetic Operators...................................................................................................................................46 8.13.2 Assignment Operators................................................................................................................................47 8.13.3 Boolean Operators .....................................................................................................................................48 8.13.4 Relational Operators ..................................................................................................................................49 8.13.5 Bitwise Operators .......................................................................................................................................50 8.13.6 Miscellaneous Operators............................................................................................................................50 8.13.7 Unsupported Operators..............................................................................................................................51 8.14 Control Statements ........................................................................................................................................51 8.14.1 Branching Statements ................................................................................................................................51 8.14.2 If Statement ................................................................................................................................................52 8.14.3 If-Else Statement ........................................................................................................................................52 8.14.4 Switch Statement........................................................................................................................................53 8.15 Loops .............................................................................................................................................................54 8.15.1 While Statement .........................................................................................................................................54 8.15.2 Do–While Statement ..................................................................................................................................55 8.15.3 For Statement.............................................................................................................................................55 8.15.4 Unconditional Branching ............................................................................................................................56 8.15.5 Return Statement .......................................................................................................................................57 8.16 The “this” Keyword .........................................................................................................................................57 CAPL Functions ........................................................................................................................................................59 9.1 User-defined Functions......................................................................................................................................59 ...


Similar Free PDFs