Quick Introduction To CAPL Version /09/03 Application Note AN-AND-1-113

Similar documents
Quick Introduction to CANalyzer Version Application Note AN-AND-1-110

Getting Started with CANopen Version Application Note AN-AON

CANape CCP Communication Version /06/03 Application Note AN-AMC-1-100

Programming with CAPL

Introduction To The CANopen Protocol Version 1.1 Application Note AN-ION

Solutions for MOST. Reliable Solutions for MOST25, MOST50 and MOST150 ENGLISH

Introduction to J1939 Version Application Note AN-ION

Product Information CANalyzer.J1939

Introduction to the CAN Calibration Protocol Version Application Note AN-AMC-1-102

How to Use C Code Functions in CANape Version Application Note AN-IMC-1-012

Plug and Play Solution for AUTOSAR Software Components

Programming Flash Microcontrollers through the Controller Area Network (CAN) Interface

Car2x From Research to Product Development

From Diagnostic Requirements to Communication

CAN-based Protocols in Avionics Version Application Note AN-ION

Convenient Charging of Electric Vehicles

Adding a Modbus TCP Device to the Network. Setting Up Your Network

METROLOGIC INSTRUMENTS, INC. USB Addendum for the IS4220 Programming Guide (MLPN x)

CANoe and CANalyzer as diagnostic tools Version /07/17

AUTOMOTIVE FIELDBUS TECHNOLOGY: DEVELOPMENT TOOLS AND ELECTRONIC EQUIPMENT FOR LABORATORY PRACTICES

Model-Based Development of ECUs

AT89C5131A Starter Kit... Software User Guide

EBERSPÄCHER ELECTRONICS automotive bus systems. solutions for network analysis

Software User Guide UG-461

GEIGER COUNTER "Gamma Check Pro"

Manual. Vector XL log Config. CANcaseXL log Configuration Version 4.1 English

Automotive Ethernet Prototype and test development with CANoe/CANalyzer.Ethernet

Standardized software components will help in mastering the. software should be developed for FlexRay were presented at

Laboratory Course Industrial Automation. Experiment Nr. 6. Introduction to the FlexRay bus system. Brief User Guide CANoe

LDCDP GdW. L force Controls. Ä.GdWä. Software Manual. Industrial PC. WindowsR CE Thin Client. Operating system

EB TechPaper. Test drive with the tablet. automotive.elektrobit.com

In networking ECUs in heavy-duty vehicles, it is the J1939 protocol that. plays a key role. J1939 networks are based on the CAN bus (high-speed

Introduction. - Please be sure to read and understand Precautions and Introductions in CX-Simulator Operation Manual and

Project Manager Editor & Debugger

Remote Access Server - Dial-Out User s Guide

DeviceNet Configurator User Guide

Mastertech Diagnostic Software Frequently Asked Questions

Network Enabled Battery Health Monitoring System

Step-by-Step Tutorial For Using LinkSprite UART- WIFI Module Model LS_UART_WIFI

S7 for Windows S7-300/400

Software Development for Multiple OEMs Using Tool Configured Middleware for CAN Communication

Bluetooth HC-06 with serial port module Easy guide

MOST PCI Tool Kit. Overview. Ordering Information. Experience the Versatile MOST PC Interfaces.

The RT module VT6000 (VT6050 / VT6010) can be used to enhance the RT. performance of CANoe by distributing the real-time part of CANoe to a

Introduction to Higher-Level Protocols Version 1.0 Application Note AN-AND-1-160

Elektro GmbH & Co. KG 126xxx 450 FU-HS 128 (Rev01_120529)

Application Note. C51 Bootloaders. C51 General Information about Bootloader and In System Programming. Overview. Abreviations

Pcounter Web Administrator User Guide - v Pcounter Web Administrator User Guide Version 1.0


MT-350 SMS. Operation Manual. PORTech Communications Inc.

Important Notes for WinConnect Server ES Software Installation:

Configuring RSLinx as an OPC Server for PanelMate epro

Testing Data Radio Modem with Serial Port Tool V1.20

Introduction to RACE FUELS Hans-Christian von der Wense Munich, Germany

Modbus Communications for PanelView Terminals

Lab 7.1.9b Introduction to Fluke Protocol Inspector

Remote Access. Table Of Contents. Rev: 3.30, 8/03

TSX ETY 110 Module 8

Challenge of Ethernet Use in the Automobile

Wireless LAN g USB Adapter

User Manual. DG LINK Application Program This document applies to firmware version 2.00 and above.

eztcp Technical Document Modbus/TCP of eztcp Caution: Specifications of this document may be changed without prior notice for improvement.

ISO11783 a Standardized Tractor Implement Interface

Quick Installation. A Series of Intelligent Bar Code Reader with NeuroFuzzy Decoding. Quick Installation

RN-131-PICTAIL & RN-171-PICTAIL Web-Server Demo Application

Wi-Fi Wireless Remote Control

Secure Proxy Server Installation Guide

progecad NLM User Guide

Personal SES Software Security. Installing and Updating the Personal (Stand Alone) Software Security Key. Version15.1

System i and System p. Customer service, support, and troubleshooting

DeviceNet Bus Software Help for Programming an Allen Bradley Control System

Project 4: Pseudo USB Simulation Introduction to UNIVERSAL SERIAL BUS (USB) STANDARD

1 Technical Description Lokal-200PC

Device Type Manager (DTM) Basic HART

Serial Communications

Microcontroller Based Low Cost Portable PC Mouse and Keyboard Tester

The goal is to program the PLC and HMI to count with the following behaviors:

A+ Guide to Managing and Maintaining Your PC, 7e. Chapter 1 Introducing Hardware

Agilent Technologies Performing Pre-VoIP Network Assessments. Application Note 1402

One common language for domain experts and test engineers

Kiwi SyslogGen. A Freeware Syslog message generator for Windows. by SolarWinds, Inc.

In-Vehicle Networking

BLUETOOTH SERIAL PORT PROFILE. iwrap APPLICATION NOTE

MODFLEX MINI GATEWAY ETHERNET USER S GUIDE

CANnes PC CAN Interface Manual

RS-232 Communications Using BobCAD-CAM. RS-232 Introduction

Troubleshooting 920i / iqube Issues

Ethernet/IP Explicit Messaging Using Unity Software

Guest PC. for Mac OS X. User Guide. Version 1.6. Copyright Lismore Software Systems, Ltd. All rights reserved.

Gigabit Ethernet Packet Capture. User s Guide

Wifi Web Server Module w TF Socket User s Guide

Foglight Experience Monitor and Foglight Experience Viewer

GigE Cameras. IP Configuration

Adaptive Cruise Control System Overview

How To Connect A Port Replicator With An Ethernet To A Usb Port From A Usb Device

Copyright DECLARATION OF CONFORMITY. Canadian Compliance Statement: Australian Compliance. European Compliance

FAR 23 LOADS 6.0 Network Floating License Installation

FACTORY AUTOMATION MANUAL USB VIRTUAL COM PORT DRIVER INSTALLATION UNDER WINDOWS XP/WINDOWS 2000

Anybus OPC Server. Application Note. Doc.Id. SCM Rev HMS Industrial Networks AB

APPLICATION NOTE. Atmel AT02985: User s Guide for USB-CAN Demo on SAM4E-EK. Atmel AVR 32-bit Microcontroller. Features. Description.

Transcription:

Version 1.1 02/09/03 Application Note AN-AND-1-113 Author(s) Restrictions Abstract Bruce Emaus Public Document This application note is a brief introduction to CAPL, the easy-to-use C-based programming language and integrated programming environment inside both CANalyzer and CANoe. The focus is to help the beginning CAPL programmer. Table of Contents 1.0 CAPL Programming...1 2.0 CAPL Applications...1 2.1 Node Emulation...1 2.2 Network Emulation...1 2.3 Node Testing...2 2.4 Gateway...2 2.5 Bus Separator...2 3.0 CAPL Programming Environment...2 4.0 CAPL Responds to Events...3 5.0 Example CAPL Programs...4 5.1 Event Message Transmission...4 6.0 Periodic Message Transmission...5 6.1 Conditionally Periodic Message Transmission...7 7.0 Limitations of CAPL...8 8.0 Conclusions...8 9.0 Contacts...9 1.0 CAPL Programming For CAN-based networks, modules, and distributed embedded systems, Communication Application Programming Language, CAPL, makes it possible to program the CANalyzer for developer-specific applications that use the CAN protocol. CAPL may also be used in the CANoe tool for distributed product development, 2.0 CAPL Applications 2.1 Node Emulation Using the programmable version of CANalyzer, one can emulate functions of a node including the transmission of event, periodic, and conditionally periodic messages. Users can create conversational responding messages to the reception of designated messages. 2.2 Network Emulation Using CAPL, CANalyzer can emulate the system-level data traffic of all remaining nodes. Copyright 2003 - Vector CANtech, Inc. 1 Contact Information: www.vector-cantech.com or 1-248-449-9290

2.3 Node Testing During a portion of CAN-based module development, CANalyzer can be used to test the module s communication behavior. Evaluation of message timing, handling of Bus Off, and other functions are easy to accomplish. 2.4 Gateway The programmable CANalyzer can be used as a temporary or permanent gateway (or bridge) between different CAN buses to exchange data. 2.5 Bus Separator Another target application is to insert CANalyzer Pro between a node to be tested and the actual network. Such configurations can be used during system-level development to isolate (and optionally modify) behavior. The ability to interconnect modules at different revision levels to the distributed product in order to continue development is also another possible application. 3.0 CAPL Programming Environment Even though CAPL can be thought of as a procedural programming language, CAPL can also be considered as a programming environment. Within this programming environment a user can create, modify, and maintain CAPL programs that can interface with a wide variety of inputs, outputs and other functions. Start-stop events, keyboard entry events, the ability to transmit and receive CAN messages, interaction with the serial port and parallel port, the use of timers, and the ability to interconnect to customer specific DLLs are some of the interface choices available inside the CAPL programming environment. Most programs are developed using the CAPL Browser, which provides an easy to use "edit-thru-compilation" development process. Even though provided as an integrated component of CANalyzer or CANoe, the CAPL Browser application program can also be used separately. Application Note AN-AND-1-113 2

4.0 CAPL Responds to Events In general, CAPL programs are simply designed to detect events and then execute the associated event procedure. For example, you could output the text "Start Test" to the Write window upon clicking on the start button of CANalyzer by using the following program. on start write("start Test"); The types of events that can be detected in CAPL include - the pressing of the start stop button user keyboard entry CAN message reception the timeout of a timer user input via a graphic panel (available only in CANoe). Based on this "event causes procedural activity" technique, CAPL programs are constructed and organized as a collection of event procedures. The CAPL Browser is conveniently structured into different groupings of event procedures. These so-called event procedural groups or event classes include system, CAN controller, CAN message, timer, keyboard, and CAN error frame as shown in the CAPL event table. Application Note AN-AND-1-113 3

5.0 Example CAPL Programs Let's take a look at how much CAPL code is necessary to develop the three common information transfer methods (or transfer dialogs) used by most CAN-based distributed embedded systems. Our three examples will include the transmission of an event message, the transmission of a periodic message, and the transmission of a conditionally periodic message. 5.1 Event Message Transmission When information only needs to be transferred on an event basis, the event message is used. This sample program uses the pressing of the 'b' key on the PC keyboard to initiate a single CAN message transmission. Application Note AN-AND-1-113 4

It is important to note that the use of each message must include a definition within the global variables. In this example we have defined the message msg1 as having a CAN identifier of 555 hex and data length code (dlc) or data size of one byte. Note - While this example shows defining a message completely within this CAPL program, it is easy to use the CANdb program (another related application program in the Vector CAN tool suite) to link a user-defined, industry defined or corporate specific messaging database. In the "keyboard" event class we insert (via the right mouse button) a new procedure for the 'b' key press. Don't forget to include the single quote marks. In this on key procedure, we fix the first byte of the can message data equal to hexadecimal AA and then use the internal CAPL function output to transmit the message. Notice that the message name used in the output function is identical to the name defined in the global variables. variables message 0x555 msg1 = dlc=1; on key 'b' msg1.byte(0)=0xaa; output(msg1); 6.0 Periodic Message Transmission When information requires transferring on a repetitive basis, the periodic message is used. Application Note AN-AND-1-113 5

To send the periodic message requires the use of a timer and this timer must be defined by name in the global variables area. To get this timer running, we have chosen to initialize the timer in the "on start" event procedure that is executed upon clicking on the tool start button. We need to use one of the intrinsic CAPL functions called settimer to initialize the time value to 100 milliseconds. When this timer expires (or times out), the corresponding "on timer" event procedure will be executed. Within this "on timer" event procedure the timer will be reset again to 100 milliseconds. Additionally, we increment the first message data byte before sending the CAN message using the CAPL output function. This repetitive process will continue until one clicks on the tool's stop button. variables message 0x555 msg1 = dlc=1; mstimer timer1; // define timer1 on start settimer(timer1,100); // initialize timer to 100 msec on timer timer1 settimer(timer1,100); msg1.byte(0)=msg1.byte(0)+1; output(msg1); // reset timer // change the data // output message With respect to the CAPL program development, for this periodic message example, CAPL code must be entered into three different locations and a total of 6 lines of code are used. Application Note AN-AND-1-113 6

6.1 Conditionally Periodic Message Transmission When information requires transferring on a repetitive basis only when a certain set of conditions is true, the conditionally periodic message is used. This CAPL program uses the pressing of the 'a' key on the PC keyboard to toggle between no message transmission and a periodic message transmission. To send a conditionally periodic message also requires the use of a timer, but this timer does not need to run continuously. We have chosen to activate or deactivate the timer based upon the pressing of the <a> key sequence. The first press of the <a> key will start the periodic message and the second press of the <a> key will stop the periodic message. Each subsequent press of the <a> key will toggle back and forth between these two states. Notice in the global variables, we have defined a different message and timer name than was used for our periodic message example. This allows you the opportunity to experiment with both message transfer methods inside the same CAPL program if desired. To properly start the process in the inactive state, we have defined an integer variable called conditiona in the global variables area and have initialize its value to 0 which represents the off condition. Once the user presses the <a> key, the corresponding on key procedure will execute. This procedure will toggle the condition variable and check to see if the condition is active or true. If the condition is active, then the timer will be started. When this timer expires, the corresponding "on timer" event procedure will be executed. The timer is reset to continue running and after modifying the data the CAN message is transmitted. Notice that when the condition has been toggled back to the off condition, it will be the next timer event that actually stops the timer from running. This conditionally repetitive process will continue until the tool is stopped. With respect to the CAPL program development, source code must be entered into three different locations and a total of 10 lines of CAPL code are used. Application Note AN-AND-1-113 7

variables message 0x400 msga = dlc=1; mstimer timera; int conditiona = 0; // initialize conditiona = off on key 'a' conditiona =! conditiona; if(conditiona == 1) settimer(timera,200); on timer timera if(conditiona == 1) settimer(timera,200); msga.byte(0)=msga.byte(0)-1; output(msga); // toggle conditiona // if condition is active // then start timer // if condition is still true // then continue timer // change the data // output message 7.0 Limitations of CAPL CAPL is limited more by available PC resources than by its internal architecture and operation. As an example, high-speed gateways between CAN and other UART-based protocols were used to determine where the boundaries might lie. Laptops were exchanged to see the effects of increased speed, which showed it is quite difficult to deliver consistent qualitative numbers. Many CANoe models use c.40 concurrently running CAPL programs to simulate an entire car in real time. The model is also capable of interconnecting to real modules or sub-system portions of a real vehicle. 8.0 Conclusions From design through manufacturing and service, CAPL programs can be quite helpful. To experiment with CAPL, the demo version of CANalyzer (available from our website) can be used to write, compile, and do real CAPL programming. The resulting code written in the demo may be transferred to a fully licensed tool at a later date. Application Note AN-AND-1-113 8

9.0 Contacts Vector Informatik GmbH Ingersheimer Straße 24 70499 Stuttgart Germany Tel.: +49 711-80670-0 Fax: +49 711-80670-111 Email: info@vector-informatik.de Vector France SAS 168 Boulevard Camélinat 92240 Malakoff France Tel: +33 (0)1 42 31 40 00 Fax: +33 (0)1 42 31 40 09 Email: information@vector-france.fr Vector CANtech, Inc. 39500 Orchard Hill Pl., Ste 550 Novi, MI 48375 Tel: (248) 449-9290 Fax: (248) 449-9704 Email: info@vector-cantech.com Vector Japan Co. Ltd. Seafort Square Center Bld. 18F 2-3-12, Higashi-shinagawa, Shinagawa-ku, J-140-0002 Tokyo Tel.: +81 3 5769 6970 Fax: +81 3 5769 6975 Email: info@vector-japan.co.jp VecScan AB Fabriksgatan 7 412 50 Göteborg Sweden Tel: +46 (0)31 83 40 80 Fax: +46 (0)31 83 40 99 Email: info@vecscan.com Application Note AN-AND-1-113 9