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



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

Introduction to J1939 Version Application Note AN-ION

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

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

Plug and Play Solution for AUTOSAR Software Components

From Diagnostic Requirements to Communication

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

Convenient Charging of Electric Vehicles

Getting Started with CANopen Version Application Note AN-AON

Car2x From Research to Product Development

Model-Based Development of ECUs

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

AN4108 Application note

SCU-18 PC Connection Cable Driver Installation Manual

Administration Manual. CANoe/CANalyzer MSI Setup. Version 1.4 English

Challenge of Ethernet Use in the Automobile

SCU-19 PC Connection Cable Driver Installation Manual

Integrating CaliberRM with Software Configuration Management Tools

CANalyzer/CANoe as a COM Server Version Application Note AN-AND-1-117

Backing up IMail Server using Altaro Backup FS

Technical Note. Image Studio Software Work Area Folder Best Practices. Developed for: Image Studio Software

Project Manager Editor & Debugger

Release Notes: PowerChute plus for Windows 95 and Windows 98

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

Appendix K Introduction to Microsoft Visual C++ 6.0

Table Of Contents. iii

Introduction to the use of the environment of Microsoft Visual Studio 2008

Installation Guide E Dielectric Probe Kit 85071E Materials Measurement Software

MT8852B Bootloader Application

UM1676 User manual. Getting started with.net Micro Framework on the STM32F429 Discovery kit. Introduction

Getting Started with Windows Mobile Development Windows Mobile SDK C#

High-Speed Inter Connect (HSIC) Solution

Updating the QIAcube operating software

Agilent MATLAB Data Analysis Software Packages for Agilent Oscilloscopes

Athena Knowledge Base

Using Borland Deployment Op-Center to manage CaliberRM, StarTeam, and Mercury TestDirector server environments

APPLICATION NOTE. Easily Create Custom Waveform Plug-Ins With Waveform Creator Application Software

Eclipse installation, configuration and operation

System requirements. Installing FORAMENRehab. Before you install: Microsoft Windows XP or later operating system

UM0985 User manual. Developing your STM32VLDISCOVERY application using the IAR Embedded Workbench software. Introduction

Using SQL Server Management Studio

Manual Software SPECTRO3-MONITORING V5.0

Protocol Logging and Analysis Software

Installing LearningBay Enterprise Part 2

Creating a Java application using Perfect Developer and the Java Develo...

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

Microsoft Visual Studio 2010 Instructions For C Programs

Building a Global Internet Company: Driving Traffic to Your Site. Benjamin Edelman Harvard Business School

This document provides tips on how to use standard Adobe Acrobat tools to add tick marks to scanned tax documents in the form of PDF files.

How To Install The Welchallyn Cardioperfect Webstation On A Computer Or Network With A Hard Disk Drive (For A Non-Procedure)

Agilent BenchVue Software (34840B) Data capture simplified. Click, capture, done. Data Sheet

SIMATIC. WinCC V7.0. Getting started. Getting started. Welcome 2. Icons 3. Creating a project 4. Configure communication 5

Menus and Toolbars: Using and customizing those common to all OpenOffice.org components

The full setup includes the server itself, the server control panel, Firebird Database Server, and three sample applications with source code.

CAPIX Job Scheduler User Guide

High-voltage Differential Probes TMDP THDP THDP P5200A - P5202A - P5205A - P5210A

Reference Manual DATAKIT

WinCC. Configuration Manual. Manual Volume 2

Arrays. Atul Prakash Readings: Chapter 10, Downey Sun s Java tutorial on Arrays:

Keysight Technologies N1918A Power Analysis Manager and U2000 Series USB Power Sensors. Demo Guide

Product Information CANape Option Simulink XCP Server

DEPLOYING A VISUAL BASIC.NET APPLICATION

FISCHER DataCenter Software for Evaluating and Archiving Measurement Data FISCHER DataCenter IP Inspection plan Software for Quality Assurance

TIBCO Spotfire Automation Services 6.5. User s Manual

RES IT Store Integration Guide: MS System Center

PRODUCT DATA. PULSE WorkFlow Manager Type 7756

PI Server and Backups with Symantec Backup Exec. April, 2012

41 T Korea, Rep T Netherlands T Japan E Bulgaria T Argentina T Czech Republic T Greece 50.

CaliberRM / LDAP Integration. CaliberRM

M24LRxx/CR95HF application software installation guide

MERCER S COMPENSATION ANALYSIS AND REVIEW SYSTEM AN ONLINE TOOL DESIGNED TO TAKE THE WORK OUT OF YOUR COMPENSATION REVIEW PROCESS

Hands-On Lab. Client Workflow. Lab version: Last updated: 2/23/2011

APPLICATION NOTE. Getting Started with pylon and OpenCV

Jabra LINK 220 Jabra LINK 220a

PBA.pro Getting Started

Image Lab Software for the GS-900 Densitometer

UM1790 User manual. Getting started with STM32L053 discovery kit software development tools. Introduction

UM1727 User manual. Getting started with STM32 Nucleo board software development tools. Introduction

AN4156 Application note

How to test and debug an ASP.NET application

Java Coding Practices for Improved Application Performance

How to Configure Windows 8.1 to run ereports on IE11

Excel & Visual Basic for Applications (VBA)

Remote Desktop Connection

UNICORN. Hardening Guide

Magaya Software Installation Guide

Operating Instructions. Pioneer USB Audio Device Driver

Agilent N5970A Interactive Functional Test Software: Installation and Getting Started

ODBC Driver Version 4 Manual

Norton Ghost How to copy partitions from an HDD to a Samsung SSD

Important Notes for WinConnect Server ES Software Installation:

Metadata Import Plugin User manual

Image Lab Software How to Obtain Stain-Free Gel and Blot Images. Instructions

Configuring DHCP for ShoreTel IP Phones

FIRST STEPS WITH SCILAB

Agilent Evolution of Test Automation Using the Built-In VBA with the ENA Series RF Network Analyzers

Creating a Distribution List from an Excel Spreadsheet

Model 288B Charge Plate Graphing Software Operators Guide

International comparisons of obesity prevalence

Get the benefits of Norgren s unique range of Online services

Transcription:

Version 2.0 2014-01-30 Author(s) Restrictions Abstract Alexander Marx, Gerry Hendratno Public Document This document describes how to use C code functions in CANape. Table of Contents 1.0 Overview... 1 2.0 Files From the Sample Project... 1 2.1 CANape Files... 1 2.2 Demo DLL Files... 2 3.0 Sample Code... 2 3.1 Listing of Functions... 2 3.2 Declaring and Implementing Functions... 3 3.2.1 Supported Objects and Data Types... 4 4.0 Integration of Functions in CANape... 4 5.0 Use in Functions Editor... 5 6.0 Contacts... 6 1.0 Overview In CANape, it is possible to use the installed programming language CASL to develop functions and scripts, e.g. in analyzing measurement data or automating frequently used sequences. This document describes how the supplied functional library can be extended to include your own libraries or functions. Potential applications include functions whose source code should not be published, or algorithms that cannot be implemented with the existing library or only with great effort. In the directory \Examples\FunctionDemoDll of the CANape installation, you can find an example. It describes how to use your own functions including source code and how to integrate it in CANape. 2.0 Files From the Sample Project The sample project FunctionDemoDll is automatically installed with the CANape installation. Additionally in CANape s start menu, there is a separate entry for it, which you can find in the folder Demos\Functions & Scripts. 2.1 CANape Files The following files you can find in the directory \Examples\FunctionDemoDll of your CANape installation: CANape.INI DemoDll.cna demodll.dll Subfolder Panels Subfolder Scripts CANape project file CANape configuration file Sample file with auxiliary functions Several CANape panels for starting a sample script, e.g. Panel1.xvp, DemoDll.cnp Several sample scripts, e.g. StartProject.cns, StartMeasurement.cns, CloseXCPSimulator.scr Copyright 2014 - Vector Informatik GmbH Contact Information: www.vector.com or +49-711-80 670-0 1

2.2 Demo DLL Files The following demo DLL files you can find in the directory \Examples\FunctionDemoDll\Sources of your CANape installation: functiondll.h demodll.cpp demodll.dsp demodll.dsw Header file with auxiliary functions of the DLL Source file with sample implementation Microsoft Developer Studio Visual C++ 6.0 project file Microsoft Developer Studio Visual C++ 6.0 workspace 3.0 Sample Code In order to call your own functions in CANape, they must be defined, declared and implemented in the sample code. It is easy to modify the Demodll.cpp file for this purpose. 3.1 Listing of Functions In the sdllinterfacedescriptortable table, functions are listed according to the following scheme: { "Function name", "VALUE/REFERENCE Argument" }, Arguments are of the type VALUE or REFERENCE. In the case of VALUE, a copy of the parameter value is passed to the function (input parameter). Changes made to the parameter value in the function remain void for the calling program (call by value). In the case of output parameters if the parameter value should be changed by the function please use the type REFERENCE (call by reference). Arrays and strings are essentially passed by REFERENCE. In all cases, the return value of the function is of the type double. Both, the function name and the names of the formal parameters (arguments) may be user-defined. The function name must agree with the implementation. Note: Parameter names are shown on the status bar in CANape s Function Editor, when you select the related function with the cursor in the Function Editor s shortcut menu. Therefore, please use descriptive parameter names. Each function may contain as many arguments as desired. They just need to be separated by commas. Make sure that the end of the table is properly terminated! //------------------------------------------------------------------------- // Define the exported functions here //------------------------------------------------------------------------- // Allowable parameter types: // VALUE Single value "Call by Value" // REFERENCE Single value or array "Call by Reference" //------------------------------------------------------------------------- const static VDllInterfaceTable sdllinterfacedescriptortable[]= { { "ArithMinV", "VALUE arg1, VALUE arg2" }, { "ArithMaxV", "VALUE arg1, VALUE arg2" }, { "ArithMinB", "REFERENCE arg" }, { "ArithMaxB", "REFERENCE arg" }, { "ArithMiddleB", "REFERENCE arg" }, { "ChangeBuffer1D", "REFERENCE arg1, REFERENCE arg2" }, { "ChangeBuffer2D", "REFERENCE arg1, REFERENCE arg2" }, 2

{ "RotateString", "REFERENCE arg1, REFERENCE arg2" }, { NULL, NULL } // MUST: table termination }; 3.2 Declaring and Implementing Functions The following scheme is used for both declaration and implementation: // Declare Exported Functions MYAPI(double) ArithMinV(VDllFunArgVariant * arg, int argcnt); Only the function name (ArithMinV) needs to be modified here. The variable argcnt contains the number of formal parameters of the function. This agrees with the number of parameters shown in the listing of functions in the table sdllinterfacedescriptortable (see section 3.1). When calling the function, arg contains the list of parameter values, wherein the individual data types apply to the passed parameters. // ArithMinV // Example function to show how to work with values // Definition: { "ArithMinV", "VALUE arg1, VALUE arg2" }, // Script: // double arg1, arg2, minimum; // arg1= 3.14; // arg2= 3.1415; // minimum= ArithMinV(arg1, arg2); // write("minimum from %f and %f is %f", arg1, arg2, minimum); MYAPI(double) ArithMinV(VDllFunArgVariant * arg, int argcnt) { double arg1= DBL_MAX, arg2= DBL_MAX; } // Check arguments if (argcnt!= 2) return DBL_MAX; if (arg[0].type == kdclassunknown) return DBL_MAX; if (arg[0].type == kdclassstring) return DBL_MAX; if (arg[1].type == kdclassunknown) return DBL_MAX; if (arg[1].type == kdclassstring) return DBL_MAX; // Get doubles if (arg[0].type == kdclassfloat) arg1= (double) arg[0].data->f; if (arg[0].type == kdclassint) arg1= (double) arg[0].data->l; if (arg[0].type == kdclassuint) arg1= (double) arg[0].data->ul; if (arg[0].type == kdclassdouble) arg1= arg[0].data->d; if (arg[1].type == kdclassfloat) arg2= (double) arg[1].data->f; if (arg[1].type == kdclassint) arg2= (double) arg[1].data->l; if (arg[1].type == kdclassuint) arg2= (double) arg[1].data->ul; if (arg[1].type == kdclassdouble) arg2= arg[1].data->d; // Return the minimum return (arg1 < arg2)? arg1 : arg2; 3

3.2.1 Supported Objects and Data Types The return values of functions of an external function library (DLL) are all of the double type. Any of the simple data types of CANape s programming language may be used as parameters of a function: 8 bit signed/unsigned integer 16 bit signed/unsigned integer 32 bit signed/unsigned integer float (32 bit) double (64 bit) Furthermore, strings as well as one- and two-dimensional arrays of the simple data types may be passed. Characteristic curves and maps may also be passed to functions. Please note that only function values of the characteristic curve/map may be passed (not the X/Y axis points). When a function is called with a measurement variable as a function parameter, the current or last signal value is always passed (for arrays, the array of values is passed). It is not possible to use 64 bit integer data types in scripts and functions. 4.0 Integration of Functions in CANape The DLL is integrated in CANape by using the options dialog: 1. Open the menu Tools Options. 2. Choose the area Miscellaneous Functions and Scripts. 3. Use the button [Add] to select the appropriate DLL from the file explorer. 4

5.0 Use in Functions Editor After the DLL has been integrated, you can call the functions in the CANape Functions Editor. When you write a function or a script for example, you can access the functions in your DLL via the context menu (press right mouse key). They are located in the submenu of DLL functions, the last item in the context menu. Note: For a more detailed description see our manual CANape CASL Calculation and Scripting Language in the Vector download center on www.vector.com. 5

6.0 Contacts Germany and all countries not named below: Vector Informatik GmbH Ingersheimer Str. 24 70499 Stuttgart GERMANY Phone: +49 711-80670-0 Fax: +49 711-80670-111 E-mail: info@de.vector.com France, Belgium, Luxemburg: Vector France S.A.S. 168, Boulevard Camélinat 92240 Malakoff FRANCE Phone: +33 1 42 31 40 00 Fax: +33 1 42 31 40 09 E-mail: information@fr.vector.com Sweden, Denmark, Norway, Finland, Iceland: VecScan AB Theres Svenssons Gata 9 41755 Göteborg SWEDEN Phone: +46 31 764 76 00 Fax: +46 31 764 76 19 E-mail: info@se.vector.com United Kingdom, Ireland: Vector GB Ltd. Rhodium, Central Boulevard Blythe Valley Park Solihull, Birmingham West Midlands B90 8AS UNITED KINGDOM Phone: +44 121 50681-50 Fax: +44 121 50681-69 E-mail: info@uk.vector.com China: Vector Automotive Technology (Shanghai) Co., Ltd. Sunyoung Center, Room 1601-1603 No.398 Jiang Su Road Changning District Shanghai 200050 P.R. CHINA Phone: +86 21 6432 53530 Fax: +86 21 6432 5308 E-mail: info@cn.vector.com India: Vector Informatik India Pvt. Ltd. 4/1/1/1, Sutar Icon, Sus Road, Pashan, Pune - 411 021 INDIA Phone: +91 20 2587 2023 Fax: +91 20 2587 2025 E-mail: info@in.vector.com USA, Canada, Mexico: Vector CANtech, Inc. 39500 Orchard Hill Place Suite 400 Novi, MI 48375 USA Phone: +1 248 449 9290 Fax: +1 248 449 9704 E-mail: info@us.vector.com Japan: Vector Japan Co. Ltd. Tennozu Yusen Bldg. 16F 2-2-20 Higashi-shinagawa, Shinagawa-ku, Tokyo 140-0002 JAPAN Phone: +81 3 5769 7800 Fax: +81 3 5769 6975 E-mail: info@jp.vector.com Korea: Vector Korea IT Inc. 5F, Gomoas bldg. 12 Hannam-daero 11-gil, Yongsan-gu Seoul, 140-889 REPUBLIC OF KOREA Phone: +82 2 807 0600 Fax: +82 2 807 0601 E-mail: info@kr.vector.com 6