• No results found

Best2rtl

N/A
N/A
Protected

Academic year: 2021

Share "Best2rtl"

Copied!
183
0
0

Loading.... (view fulltext now)

Full text

(1)

EDIABAS

Electronic Diagnostic Basic System

BEST/2 FUNCTION PRIMER

VERSION 6d

(2)

CONTENTS

CONTENTS 2

1. Revision history 8

2. Introduction 9

2.1. About the Runtime Library 9

2.2. Conventions 10 2.3. Special features, definitions, acronyms 11

3. Overview 12

3.1. Using the runtime library 12

3.1.1. Calling library functions 12

3.1.2. Paths and filenames 12

3.2. Functions of the runtime library by categories 13

3.2.1. Communication functions 14

3.2.2. Interface functions 15

3.2.3. Result and parameter management 16

3.2.4. String functions 17 3.2.5. Conversion functions 18 3.2.6. Real functions 19 3.2.7. Data functions 20 3.2.8. File functions 21 3.2.9. Sequence control 22 3.2.10. Error handling 23 3.2.11. Time handling 24 3.2.12. Table handling 25 3.2.13. Configuration 26 3.2.14. Control unit specific functions 27

4. Clamp states 28

(3)

4. Library functions 31

4.1. Using the function primer 31

ascii2ascii 33 ascii2hex 34 atoi 35 ator 36 atoy 37 bcd2ascii 38 bittest 39 bytetest 40 callPlugIn 41 clear_error 43 close_communication 44 datacat 46 dataclear 47 datacmp 48 datacopy 49 dataerase 50 datainsert 51 datalen 52 datarevers 53 dataset 54 doNewInit 55 enableIfhTrace 56 enableIgnitionHandling 57 enableUbattHandling 58 fclose 59

(4)

fseekln 64 ftell 65 ftellln 66 get_battery_voltage 68 get_error 69 get_error2 70 get_ignition_voltage 71 get_trap_mask 74 generateRunError 75 getasciidate 76 getasciitime 77 getCfgString 79 getdate 80 getETXblock 81 gettickcount 84 gettime 85 hex2ascii 86 ifboot 87 ifgetport 88 ifinfo 89 ifloopt 91 ifrawmode 92 ifrecv 93 ifrequeststate 94 ifreset 95 ifsend 96 ifsetport 97 ifsireset 98 iftype 99 ifvers 100 incProgressPos 101 4

(5)

isDebugLevel 102 isSimulation 103 itoad 104 itoax 105 itor 106 make_error 108 new_set_of_results 109 open_communication 110 parcount 111 realadd 113 realdiv 115 realmul 116 realresult 117 realsub 118 recv_frequent 119 recv_keybytes 120 rtoa 121 rtoi 122 send_and_receive 123 send_frequent 124 set_answer_length 125 set_communication_pars 128 set_program_voltage 146 set_repeat_counter 147 set_trap_mask 148 set_variable_result 151 setProgressRange 152

(6)

strcmp 157 strcpy 158 strcut 159 strerase 160 strinsert 161 strlen 162 strncpy 163 strrevers 164 tab2fix 165 tab_suche_index 166 tabget 169 tabline 170 tabseek 171 tabset 172 tabsetext 173 updateInfo 175 userbreak 176 var_result_data 177 var_result_long 178 var_result_real 179 var_result_string 180 wait 181 waitex 182 LIST OF REFERENCES 183 6

(7)
(8)

1. Revision

history

Version 5b Revision history is new

New chapter 3 (chapter 3 renamed as chapter 4, etc.) Version 5e New functions: rtoi, updateInfo, setProgressRange,

incProgressRange Version 5f New function: ascii2ascii

Version 6 New functions data_to_real, real_to_data, tab_suche_unsigned, ifinfoExt, realcomp, AdjustKWP2000TesterPr-StartComm,

GetKWP2000Block, GetKWP2000BlockIndex, linkPlugIn, callPlugIn, callPlugInExt, set_communication_pars

Version 6a Description of GetKWP2000Block reworked, function GetKWP2000BlockIndex is dropped.

Version 6b In set_communication_pars concept KWP 2000* new. Version 6d Revised for EDIABAS V6.4.4

(9)

2. Introduction

2.1. About the Runtime Library

The runtime library provides functions for control unit communication, string handling and error handling for use in BEST/2 description files. These functions provide

access to the interface handler access to external data

access to host system functions (e.g. time)

and functions that are regularly needed for general programming tasks (e.g. strings).

This runtime library is very important because it provides facilities which the rudimentary BEST/2 language does not have.

(10)

2.2. Conventions

The following typographical conventions are used in this manual:

Example Description

SAMPLE.C Upper case characters are used for filenames, registers and operating system commands.

job, string, while Bold type is used for key words and

operators of the BEST/2 and BEST/1 languages and for API functions. In syntax descriptions these words must be written as shown.

expression Italics designate placeholders for values to be entered by the programmer; e.g., file names.

[option] Words enclosed in square brackets may be optionally specified.

{ result |

argument }

Curvy braces and vertical strokes characterize entries from which only one must be selected, except when in square brackets.

[constant...] job... An ellipsis (three dots) which directly follows an expression indicates that several expressions of the same type can follow. hallo="Test"; This syntax designates examples, user

entries, program outputs and error messages.

while() { .

.}

A column or a row comprising three dots indicates that a section of an example was intentionally omitted.

[1] Reference to a document in References.

(11)

2.3. Special features, definitions, acronyms

The job INITIALISIERUNG (initialize) that is needed for correct operation has been omitted from all the examples in this manual.

BEST/2 is the abstract name for the programming language for description files.

However BEST2 refers to the compiler as a command at operating system level (cf. "C" <-> "C Compiler" <-> "CC").

The terms function, routine and command have equivalent status in this manual, and refer to self-contained function units in the runtime library.

The term host refers to the computer and operating system on which the EDIABAS runtime system is started.

(12)

3. Overview

3.1. Using the runtime library

3.1.1.

Calling library functions

To use a library function in a BEST/2 description file we simply call it in a job with the required parameters. For example, we can write the following job in a description file:

job ( name : SAMPLE; ...) { char buffer[]; ... getasciidate(buffer); . }

This job identifies the current date by means of the getasciidate function and writes it to the variable buffer.

3.1.2.

Paths and filenames

BEST2 uses B2RUNTIM.LIB as its default runtime library. Although this is expected to be in the same directory as the BEST/2 compiler, another library can be specified with the -L option when calling BEST2.

BEST2 -L \test\dev\neulib.lib test.b2v

This command line calls the BEST/2 compiler which will compile the description file test.b2v in the current directory. It uses the library NEULIB.LIB in the \TEST\DEV directory.

(13)

3.2. Functions of the runtime library by categories

BEST/2 library functions cover a range of job areas. If you know what the task is but do not know exactly which function you need you can search for it in the following sections. The "library functions" section gives a complete function description including syntax and examples.

Essentially, the following function categories are available: Communication functions

Interface functions

Result / parameter management String functions Conversion functions Data functions File functions Error handling Time handling Table handling Configuration

(14)

3.2.1. Communication

functions

Communication functions are used to communicate with the control unit. They provide the facility of the interface handler contained in EDIABAS.

Function Purpose

open_communication Opens communication with the interface

close_communication Closes communication with the interface

set_communication_pars Sets communication parameters

set_answer_length Sets the answer length of one or all telegrams

send_and_receive Sends and receives a telegram

recv_keybytes Gets the control unit key bytes

send_frequent Automatic repeat sending of a telegram

recv_frequent Receives a repeat telegram

stop_frequent Stops repeat sending

set_repeat_counter Sets the repeat counter for repeats in the event of an error

(15)

3.2.2. Interface

functions

Interface functions are used as an interface with the functions of the diagnostic bus interface. They provide the facility of the interface handler contained in EDIABAS.

Function Purpose

get_battery_voltage Reads out the battery voltage

get_ignition_voltage Reads out the ignition voltage

set_program_voltage Sets the programming voltage

ifboot Resets the interface (warm start)

ifreset Resets the communication parameters

ifgetport Reads out a port

ifsetport Sets a port

ifloopt Tests the diagnostic lead

ifsireset Sets the SIA relay

ifrequeststate Reads out the interface state

iftype Reads out the interface type

ifvers Reads out the interface version

ifrawmode Transmits any desired characters to the interface

ifsend For debugging only

(16)

3.2.3.

Result and parameter management

These functions are used to manage results and parameters

Function Purpose

new_set_of_results Signals a new result set

parcount Identifies the number of parameters

set_variable_result Produces a result with variable names

var_result_data Produces a data result with variable names

var_result_long Produces a "long" result with variable names

var_result_real Produces a "real" result with variable names

var_result_string Produces a "string" result with variable names

updateInfo Produces a "string" result as the job is being processed

setProgressRange Sets a range for the progress counter

incProgressPos Increases the current position of the progress counter

(17)

3.2.4. String

functions

The string functions are used to manage and process C-compatible strings. These strings must end with the zero character ('\0').

Function Purpose

strcat Catenates strings

strcut Shortens strings

strcmp Compares strings

strcpy Copies strings

strncpy Copies a string with length specification

strlen Identifies the string length

strerase Erases a part string

strinsert Inserts a part string

get_token Searches for a token

(18)

3.2.5. Conversion

functions

The conversion functions are used to convert data from an integer to a string form.

Function Purpose

ascii2hex Converts a string to a binary array

ascii2ascii converts characters to characters of a different code page

atoi Converts a string to an integer

atoy Converts a string to a binary array

bcd2ascii Converts a BCD chain to a BCD string

hex2ascii Converts a hex chain to a hex string

itoad Converts an integer to a decimal string

uitoad Converts an unsigned integer to a decimal string

itoax Converts an integer to a hexadecimal string

(19)

3.2.6. Real

functions

The real functions are used to process real numbers.

Function Purpose

itor Converts an integer to a real number

ator Converts a string to a real number

realcomp Compares two real numbers

realadd Adds two real numbers

realsub Subtracts two real numbers

realmul Multiplies two real numbers

realdiv Divides two real numbers

realresult Generates a real result

rtoa Converts a real number to a string

rtoi Converts a real number into an integer

data_to_real Converts data bytes into a real number

(20)

3.2.7. Data

functions

Data functions move and set data. Unlike strings this data does not end on a zero.

Function Purpose

datacat Appends data bytes to a buffer

dataclear Clears a buffer

datacmp Compare bytes of two buffers

datacopy Copies bytes from one buffer to another

dataerase Erase data bytes from a buffer

datainsert Inserts bytes into a buffer

datalen Identifies the length of a buffer

datarevers Reverses data in a buffer

dataset Sets bytes in a buffer

shdataget Read (get) the global data memory

shdataset Write (set) the global data memory

(21)

3.2.8. File

functions

File functions provide read access to files in the host system.

Function Purpose

fopen Opens a file

fclose Closes a file

fread Reads a character from a file

freadln Reads a line from a file

fseek Sets the read position in a file (byte by byte)

fseekln Sets the read position in a file (line by line)

ftell Identifies the read position in a file (byte by byte)

(22)

3.2.9. Sequence

control

This function enables access in the job sequence control; i.e., when and in which order standard jobs are called.

Function Purpose

doNewInit Forces the job INITIALISIERUNG before the next job call

(23)

3.2.10. Error

handling

The description file can handle error messages with these functions.

Function Purpose

clear_error Clears the error flag

get_error Identifies the error number

get_error2 Identifies the error number

make_error Issue an error

generateRunError Issues error “RUN-00XX”

set_trap_mask Sets the error trap mask

get_trap_mask Reads out the error trap mask

userbreak Produce the error message "BIP-0008: BEST BREAK"

(24)

3.2.11. Time

handling

The time handling functions make it possible to access the current time and date, among other options.

Function Purpose

gettime Gets the current time

getdate Gets the current date

getasciitime Gets the current time as an ASCIIZ string

getasciidate Gets current date as an ASCIIZ string

gettickcount Gets tick counter value of millisconds

wait Waits n seconds

waitex Waits n milliseconds

(25)

3.2.12. Table

handling

These functions are used to evaluate the constant tables defined in BEST/2.

Function Purpose

tabset Initializes table handling

tabsetext Initializes table handling of an ECU description file (SGBD)

Tabseek Searches a string in the current table

tab_suche_index Searches an integer string in the current table

tab_suche_unsigned Searches an unsigned integer string in the current table

Tabline Jumps to the specified line in the table

tabget Reads out values from the current table line

tab2fix Reads out values from the current table line and converts to an integer

bittest Special function for identifying bit results

(26)

3.2.13. Configuration

These functions are used to set and read the EDIABAS configuration.

Function Purpose

enableIfhTrace Enable/disable the IFH-Trace

enableIgnitionHandling Enable/disable the ignition monitoring

enableUbattHandling Enable/disable battery monitoring

getCfgInt Read (get) a configuration setting as an integer

getCfgString Read (get) a configuration setting as a string

isDebugLevel Interrogation of the configuration element "BipDebugLevel"

isSimulation Interrogation of the configuration element "Simulation"

(27)

3.2.14. Control unit specific functions

These functions are used to evaluate control unit answer telegrams.

Function Purpose

AdjustKWP2000TesterPr-StartComm

Adapts the TesterPresent and StartCommunication telegrams using the ECU address in the parameters

GetKWP2000Block Reads out a block from the response telegram of a control unit with KWP 2000

getETXblock Reads out a block from the answer telegram of a control unit

(28)

4. Clamp

states

All functions of the Interface Handler which communicate with the interface are listed below. Specification is made for each function as to which error messages are generated based on the EDIC terminal states and which response is made to the error message. If the UBattHandling or IgnitionHandling is disabled in configuration file EDIABAS.INI, neither the error messages UBATT ON/OFF ERROR (or IGNITION ON/OFF ERROR) are generated due set history bits nor is the communicaiton aborted (and the terminal states reset) as response to this.

The system results IGNITIONCURRENT; UBATTCURRENT; IGNITIONHISTORY; UBATTHISTORY are onlyassigned the values (0,1) for the current state of the terminal states when at least one of the following functions is executed in the job (except the function ifrawmode). If none of the following functions are executed in the job, the system results above are always labeled as undefined (-1).

Function Error messages Response

set_communication _pars WRONG UBATT UBATT ON/OFF ERROR IGNITION ON/OFF ERROR Only in case of error: Abort active communication with the ECU and reset the terminal states

send_and_receive WRONG UBATT UBATT ON/OFF ERROR IGNITION ON/OFF ERROR Only in case of error: Abort active communication with the ECU and reset the terminal states

(29)

recv_keybytes WRONG UBATT UBATT ON/OFF ERROR IGNITION ON/OFF ERROR Only in case of error:

Abort the active communication with the ECU and reset the terminal states

send_frequent WRONG UBATT UBATT ON/OFF ERROR IGNITION ON/OFF ERROR Only in case of error:

Abort the active communication with the ECU and reset the terminal states

recv_frequent WRONG UBATT UBATT ON/OFF ERROR IGNITION ON/OFF ERROR Only in case of error:

Abort the active communication with the ECU and reset the terminal states

stop_frequent None None

get_battery_voltage None None

get_ignition_voltage WRONG UBATT None

set_program_voltag

e None

(30)

ifboot None Always: The active

communication with the ECU is always aborted, and the terminal states are always reset.

ifreset None Always:

The active

communicaiton with the ECU is always aborted, and the terminal states are always reset.

ifgetport None None

ifsetport None None

ifloopt None None

ifsireset None None

ifrequeststate None None

ifvers None None

ifrawmode None None

(31)

4. Library

functions

4.1. Using the function primer

This section describes the BEST/2 runtime library functions in alphabetical order. Related functions are described together in many cases.

Each function description comprises the following sections:

Summary Summarizes what the function does, illustrates its syntax and briefly describes its arguments.

Remarks A detailed description of the function and its use.

Return value Describes the value that is returned by the function.

See also Refers the reader to related functions.

Example Shows an extract from a job to explain the function's use.

Result The results or effects of the example.

In the description of the arguments, (V) means that a variable must be specified, (C) means that a constant must be specified.

(32)

AdjustKWP2000TesterPrStartComm

Summary

void AdjustKWP2000TesterPrStartComm(char params[])

params KWP 2000 parameters in the raw format for EDIC API (V)

Remarks This function enters the control unit address in position 5 of the TesterPresent and StartCommunication telegram parameters and recalculates the checksums in these telegrams. Return value - See also - Example { char parameter[]; parameter = kwp_2000_parameter; parameter[5] = ecuAddress; AdjustKWP2000TesterPrStartComm(parameter); } Result - 32

(33)

ascii2ascii

Summary Converts all text characters into another character set.

void ascii2ascii(char codepage[],char text[])

codepage Character set text String buffer(V)

Remarks This function converts all characters in the string into characters with another ASCII code. Characters are converted according to the passed code page..

Return value -

See also - Example

unsigned char codepage[] = { // 0 1 2 3 4 5 6 7 8 9 A B C D E F /*0*/ 0x00,0x01,0x02,0x03,0x04,0x05,0x06,0x07,0x08,0x09,0x0A,0x0B,0x0C,0x0D,0x0E,0x0F, /*1*/ 0x10,0x11,0x12,0x13,0x14,0x15,0x16,0x17,0x18,0x19,0x1A,0x1B,0x1C,0x1D,0x1E,0x1F, /*2*/ 0x20,0x21,0x22,0x23,0x24,0x25,0x26,0x27,0x28,0x29,0x2A,0x2B,0x2C,0x2D,0x2E,0x2F, /*3*/ 0x30,0x31,0x32,0x33,0x34,0x35,0x36,0x37,0x38,0x39,0x3A,0x3B,0x3C,0x3D,0x3E,0x3F, /*4*/ 0x40,0x41,0x42,0x43,0x44,0x45,0x46,0x47,0x48,0x49,0x4A,0x4B,0x4C,0x4D,0x4E,0x4F, /*5*/ 0x50,0x51,0x52,0x53,0x54,0x55,0x56,0x57,0x58,0x59,0x5A,0x5B,0x5C,0x5D,0x5E,0x5F, /*6*/ 0x60,0x61,0x62,0x63,0x64,0x65,0x66,0x67,0x68,0x69,0x6A,0x6B,0x6C,0x6D,0x6E,0x6F, /*7*/ 0x70,0x71,0x72,0x73,0x74,0x75,0x76,0x77,0x78,0x79,0x7A,0xE4,0xF6,0xFC,0xDF,0x7F, /*8*/ 0x80,0x81,0x82,0x83,0x84,0x85,0x86,0x87,0x88,0x89,0x8A,0x8B,0x8C,0x8D,0x8E,0x8F, /*9*/ 0x90,0x91,0x92,0x93,0x94,0x95,0x96,0x97,0x98,0x99,0x9A,0x9B,0x9C,0x9D,0x9E,0x9F, /*A*/ 0xA0,0xA1,0xA2,0xA3,0xA4,0xA5,0xA6,0xA7,0xA8,0xA9,0xAA,0xAB,0xAC,0xAD,0xAE,0xAF, /*B*/ 0xB0,0xB1,0xB2,0xB3,0xB4,0xB5,0xB6,0xB7,0xB8,0xB9,0xBA,0xBB,0xBC,0xBD,0xBE,0xBF, /*C*/ 0xC0,0xC1,0xC2,0xC3,0xC4,0xC5,0xC6,0xC7,0xC8,0xC9,0xCA,0xCB,0xCC,0xCD,0xCE,0xCF, /*D*/ 0xD0,0xD1,0xD2,0xD3,0xD4,0xD5,0xD6,0xD7,0xD8,0xD9,0xDA,0xDB,0xDC,0xDD,0xDE,0xDF, /*E*/ 0xE0,0xE4,0xDF,0xE3,0xE4,0xE5,0xE6,0xE7,0xE8,0xE9,0xEA,0xEB,0xEC,0xED,0xEE,0xF6, /*F*/ 0xF0,0xF1,0xF2,0xF3,0xF4,0xFC,0xF6,0xF7,0xF8,0xF9,0xFA,0xFB,0xFC,0xFD,0xFE,0xFF };

unsigned char text[] = {0x7B,0xE1,0x7C,0xEF,0x7D,0xF5,0x7E,0xE2}; {

...

ascii2ascii(codepage,text); ...

}

(34)

ascii2hex

Summary Converts a hex string into a sequence of bytes

long ascii2hex(char destin[],char source[],int pos)

destin Destination buffer(V) source String buffer

pos Position in the destination buffer

Remarks Converts a zero-terminated string source into a sequence of bytes and inserts these in destin beginning at byte position pos. In this process, all characters of the string buffer are converted. Abortion occurs in the case of invalid characters or in case of an uneven number of characters. In the case of an error, destin contains all converted bytes up to the erroneous character.

Return value 0: Source contains invalid characters

1: Source contains only valid characters

See also atoi, atoy, bcd2ascii, itoad, itoax Example { char source[] = "00FF"; char destin[] = { 0x12, 0x34, 0x56, 0x78 }; ascii2hex(destin,source,1}; ... } Result destin = { 0x12, 0x00, 0xFF, 0x78 } 34

(35)

atoi

Summary Converts a string to a value

long atoi(char number[]);

number The string to be converted

Remarks The atoi function converts a string into an integer. If the string

begins with the characters "0x" or "0X" then it is interpreted as a hexadecimal number. If the string begins with the characters "0y" or "0Y" then it is interpreted as a binary number. In all other cases the string is interpreted as a decimal number. Conversion is aborted at the first character that does not match the number format.

Return value The converted value (2^31 maximum)

See also atoy, itoad, itoax, bcd2ascii, hex2ascii, ascii2hex Example { long hexnumber; long binnumber; long deznumber; hexnumber=atoi("0x77"); binnumber=atoi("0y01110110"); deznumber=atoi("014"); ... } Result hexnumber = 0x77 = 119 binnumber = 0x76 = 118 deznumber = 0x0e = 14

(36)

ator

Summary Converts a string to a real number

void ator(real destin, char value[]);

destin Real number to accept the conversion result value The string to be converted

Remarks The ator function converts a string into an integer. The string is

interpreted as a real number. It can have the following format: [{sign}][digits][{.|,}digits][{d|D|e|E}[sign]digits]

sign is either '+' or '-'.

digits are one or more digits.

Conversion is aborted at the first character that does not match the number format.

Return value The converted value (maximum double = 1.7E ± 308 (15 digits)).

See also rtoi, rtoa, realadd, realsub, realmul, realdiv Example { real realnumber; ator(realnumber,"1.22e01"); ... } Result realnumber = 12.2 36

(37)

atoy

Summary Converts a string into a binary array.

long atoy(char binary[],char ascii[]); binary Buffer for binary data ascii String to be converted

Remarks The atoy function converts a string into a binary array.

The ASCII string uses the format: [AA] { },{ } [AB] { },{ } … Conversion is aborted at the first character which does not match the format.

Return value The number of binary data in binary.

See also atoi, itoad, itoax, bcd2ascii, hex2ascii, ascii2hex Example { char ascii[]; char binary[]; ascii="aa,bb,cc,00,01" atoy(binary,ascii); }

(38)

bcd2ascii

Summary Converts a chain of characters to a BCD string

void bcd2ascii(char destin[], char source[], int index, int count) destin String buffer(V)

source Buffer

index Position in source buffer

count Number of bytes to be converted

Remarks Converts a chain of bytes (two nibbles) from the source buffer source, starting from the byte position index, into a zero-terminated BCD string destin. count nibbles are converted from the source buffer. An '*' stands in the destination string for nibbles with a value greater than hexadecimal 9 (A..F).

Return value -

See also atoi, atoy, itoad, itoax, hex2ascii, ascii2hex Example { char source[]={ 0x12, 0x34, 0xFF, 0x78, 0x90 }; char destin []; bcd2ascii(destin,source,2,5}; ... } Result destin = "34**7*" 38

(39)

bittest

Summary Identifies bit results via a table

long bittest(char name[], char source[], long value) name Result name

source Buffer to be analyzed value Test result

Remarks You must have a table with the columns NAME, BYTE, MASK,

VALUE. Table processing must first have been set to this table

using the tabset function. The BYTE column indicates which byte in source is to be looked at. The appropriate bits (the bits to be looked at) must be masked in the MASK column. In the VALUE column enter the value which the bits must have to make the status NAME true. The result value is TRUE (1) when all the bits set in MASK have the value specified in VALUE, otherwise it is FALSE (0).

Return value TRUE (1) when the result name was found in the table, otherwise FALSE (0)

See also bytetest Example

table bits[4][]={

{ "NAME", "BYTE" , "MASK" , "VALUE" }, { "XON", "0", , "0x07" , "0x06" }, { "XOFF", "0", , "0x07" , "0x01" } }; {

int xonvalue; int xoffvalue;

char buffer[]; buffer[0]=0x06; tabset("bits"); bittest("XON",buffer,xonvalue); bittest("XOFF",buffer,xoffvalue); }

(40)

bytetest

Summary Identifies byte results via a table

long bytetest(char name[], char source[], long value, long div) name Result name

source Buffer to be analyzed value Test result

div Divider

Remarks You must have a table with the columns NAME, BYTE, MIN,

MAX, MINDEF, MAXDEF, A, B, DIV. Table processing must first

have been set to this table using the tabset function. The BYTE column indicates which byte in source is to be looked at. The MIN and MAX columns indicate the lower and upper limits of the byte in source. If the limits are breached then the value in the MINDEF or MAXDEF columns is returned. If the value of the byte is within the defined limits then the returned value is calculated according to the formula A*x + B. The divider in the DIV column is returned in div. It indicates the value by which the result has to be divided in order to get a correct result.

Return value 0 = in valid range

1 = over range

-1 = under range

See also bittest Example

table bytes[3][]={

{"NAME","BYTE","MIN", "MAX", "MINDEF", "MAXDEF","A","B","DIV"}, {"TEMP","0", "07" , "254","-40", "120", "-4","8","1" }}, ...

int tempvalue; int tempdiv; char buffer[]; buffer[0]=0x06; tabset("bytes"); bytetest("TEMP",buffer,tempvalue,tempdiv); } Result tempvalue = -40 tempdiv = 1 40

(41)

callPlugIn

Summary Calls the main function within the Plugin component.

void callPlugIn(char dataOut[],char dataIn[]);

dataOut input data (V) dataIn output data

Remarks The callPlugIn function calls the main function within the Plugin component. The Plugin component provides the content for the string variable dataOut.

Return value -

See also linkPlugIn, callPlugInExt

Example { char name[]; char dataIn[]; char dataOut[]; long funcID; long status; ... linkPlugIn(name); ... callPlugIn(dataOut,dataIn); ... status = callPlugInExt(funcID,dataOut,dataIn); ... } Result -

(42)

callPlugInExt

Summary Calls the main function within the Plugin component.

long callPlugInExt(long funcID,char dataOut[],char dataIn[]);

funcID Subfunction number within the Plugin component dataOut Input data

dataIn Output data

Remarks The callPlugInExt function calls a subfunction within the Plugin component. The Plugin component provides the content for the string variable dataOut. For this function, the length of dataOut and dataIn is limited to 1019 bytes since 4 bytes of the string variable are needed internally for the subfunction number and the status.

Return value Subfunction status

See also linkPlugIn, callPlugIn

Example { char name[]; char dataIn[]; char dataOut[]; long funcID; long status; ... linkPlugIn(name); ... callPlugIn(dataOut,dataIn); ... status = callPlugInExt(funcID,dataOut,dataIn); ... } Result - 42

(43)

clear_error

Summary Clears the error flag

void clear_error()

Remarks The clear_error function clears the error flag. This function must

be called when an error has been masked. It clears the entry in EDIABAS that an error had occurred.

Return value - See also - Example set_trap_mask(0x60000); ifreset(); set_trap_mask(0x00); clear_error(); Result -

(44)

close_communication

Summary Closes the communication channel to the interface

void close_communication()

Remarks The close_communication function closes the driver. All the

communication and interface functions used after this function are answered with the error message IFH_0019 (except

open_communication). Return value -

See also open_communication Example -

Result -

(45)

data_to_real

Summary Converts data bytes into a real number

void data_to_real(real destin, char source[], long pos, long double, long byteorder);

destin Real number for recording the conversion result (V) source Source buffer (V)

pos Position of the 1st data byte in the source buffer

double Real number precision:

0 = single-precision (4 data bytes IEEE) <> 0 = double-precision (8 data bytes IEEE) byteorder Memory format in the source buffer:

0 = Little Endian (Intel) <> 0 = Big Endian (Motorola)

Note The data_to_real function converts 4 (double=0) or 8 data bytes (double=1) of the source buffer source into the real number destin as of the indicated buffer position.

Return value -

See also real_to_data

Example {

unsigned char buffer[]; real realzahl; buffer = { 0x66, 0xe6, 0xf6, 0x42 }; data_to_real(realzahl,buffer,0,0,0); ... } Result realzahl = 123.45

(46)

datacat

Summary Appends data bytes to a buffer

void datacat(unsigned char buffer[], unsigned char bytes[])

buffer Buffer to which the data bytes are appended (V) bytes Data bytes which are appended

Remarks This function appends data bytes to a buffer.

Return value -

See also dataclear, datacopy, datacmp, dataerase, datainsert, datalen, datarevers, dataset

Example

unsigned char buffer1[];

unsigned char buffer2[];

buffer1 = {0x01, 0x02, 0x03}; buffer2 = {0x04, 0x05, 0x06};

datacat(buffer1, buffer2);

Result buffer1 = {0x01, 0x02, 0x03, 0x04, 0x05, 0x06};

(47)

dataclear

Summary Clears a buffer

void dataclear(unsigned char buffer[])

buffer Data buffer (V)

Remarks This function clears a data buffer.

Return value -

See also datacat, datacopy, datacmp, dataerase, datainsert, datalen, datarevers, dataset

Example

unsigned char buffer[];

buffer = {0x01, 0x02, 0x03}; dataclear(buffer);

(48)

datacmp

Summary Compares two data buffers

long datacmp(char d1[],char d2[]) d1 Data buffer 1 (V) d2 Data buffer 2

Remarks The function compares the two data buffers d1 and d2. If the two buffer have the same length and contain identical characters, they are considered equal, otherwise unequal.

Return value 0 if both data buffers are equal, <> 0 if not equal.

See also datacat, dataclear, datacopy, dataerase, datainsert, datalen, datarevers

Example

{

int x; int y; int z;

unsigned char d1[]; d1 = {1,2,3} x=datacmp(d1,{1,2,3}); y=datacmp(d1,{1,2,3,4}); z=datacmp(d1,{1,2,4}); } Result x=0, y=1, z=1 48

(49)

datacopy

Summary Copies data from a source buffer to a target buffer

void datacopy(char destin[], char source[], long pos, long count) destin Target buffer (V)

source Source buffer

pos Start position in source buffer count Number of characters to be copied

Remarks The datacopy function copies count characters from position pos

from the source buffer source to the target buffer destin. Up to 1024 characters can be copied.

Value ranges: 0 <= pos < 1024

0 <= count <= 1024

pos+count < 1024

Exceeding the value range causes runtime error BIP_0001.

Return value -

See also datacat, dataclear, datacmp, dataerase, datainsert, datalen, datarevers, dataset

Example { char source[]= { 0x12, 0x34, 0x56, 0x78, 0x90 }; char destin[]; datacopy(destin,source,2,3); ... } Result destin={0x56,0x78,0x90}

(50)

dataerase

Summary Erase data from a buffer

void dataerase (char buffer[],int pos,int count);

buffer Buffer to be modified (V)

pos Position at which erasing is to begin count Number of characters to be erased (C)

Remarks The function dataerase erases an arbitrary number of

characters from a buffer. The remaining parts of the buffer are combined. Count characters will be erased beginning at position pos. The process is aborted when the end-of-buffer is reached. Only the buffer to pos then remains as the rest.

Return value -

See also datacat, dataclear, datacopy, datacmp, datainsert, datalen, datarevers, dataset

Example { char buffer[] = { 0x12,0x34,0xFF,0x56,0x78 }; dataerase(buffer,1,2); ... } Result destin={ 0x12,0x56,0x78 } 50

(51)

datainsert

Summary Inserts data in a buffern

void datainsert (char destin[],char source[],int pos);

destin Buffer to be modified (V) source Buffer to be inserted

pos Position to be inserted to

Remarks The function datainsert inserts the buffer source into the buffer

destin. Insertion is made beginning with position pos. If the buffer destin becomes longer than a string register

(i.e., 1023 characters), this causes a runtime error BIP_0001.

Return value -

See also datacat, dataclear, datacopy, datacmp, dataerase, datalen, datarevers, dataset

Example { char source[] = { 0xF0,0xF1 }; char destin[] = { 0x12,0x34,0x56,0x78 }; datainsert(destin,source,3); ... } Result destin={ 0x12,0x34,0x56,0xF0,0xF1,0x78 }

(52)

datalen

Summary Identifies the buffer length

long datalen(unsigned char buffer[])

buffer Buffer whose length is to be identified

Remarks This function identifies the length (number of characters) of a data buffer.

Return value Number of characters in the buffer.

See also datacat, dataclear, datacopy, datacmp, dataerase, datainsert, datarevers, dataset

Example

long length;

unsigned char buffer[];

buffer = {0x01, 0x02, 0x03, 0x04};

length = datalen(buffer);

Result length = 4

(53)

datarevers

Summary Reverses a data buffer

void datarevers(unsigned char buffer[])

buffer Buffer whose data bytes are to be reversed (V)

Remarks This function reverses the sequence of data bytes in a buffer.

Return value -

See also datacat, dataclear, datacopy, datacmp, dataerase, datainsert, datalen, dataset

Example

unsigned char buffer[];

buffer = {0x01, 0x02, 0x03, 0x04}; datarevers(buffer);

(54)

dataset

Summary Sets the bytes in a buffer to a defined value

void dataset(char destin[],char data, long count) destin Target buffer (V)

data Character to be set

count Number of bytes to be set

Remarks This function sets the number of bytes specified by count to the value data in the target buffer destin.

Values ranges: 0 <= count < 1024

Exceeding the value range causes runtime error BIP_0001.

Return value -

See also datacat, dataclear, datacopy, datacmp, dataerase, datainsert, datalen, datarevers

Example { char buffer[]={ 0x12, 0x34, 0x56, 0x78, 0x90 }; dataset(buffer,0x41,2}; ... } Result buffer ={ 0x41, 0x41, 0x56, 0x78, 0x90 } 54

(55)

doNewInit

Summary Forces the job INITIALISIERUNG before the next job call.

void doNewInit()

Remarks This function forces the standard job INITIALISIERUNG to be automatically called before executing the next job.

Return value - See also - Example

doNewInit();

(56)

enableIfhTrace

Summary Enable/disable the IFH-Trace

void enableIfhTrace(long enable)

enable 0 = disable / <>0 = enable

Remarks This function either enables or disables the IFH-Trace. After changing the ECU description file, this setting is reset again to the application default.

Return value -

See also enableIgnitionHandling, enableUbattHandling, getCfgInt, getCfgString, IsDebugLevel, IsSimulation Example

unsigned char buffer[];

enableIfhTrace(1); iftype(buffer); enableIfhTrace(0);

Result -

(57)

enableIgnitionHandling

Summary Enable/disable ignition monitoring

void enableIgnitionHandling(long enable)

enable 0 = disable / <>0 = enable

Remarks This function either enables or disables the ignition monitoring. If monitoring is enabled, the error "IFH-0016: IGNITION ON/OFF ERROR" is issued after disabling the ignition at the next interface communication. The current value can be read with "getCfgInt("IgnitionHandling"). After the ECU description file is changed, this setting is reset again to the application default.

Return value -

See also enableIfhTrace, enableUbattHandling, getCfgInt, getCfgString, IsDebugLevel, IsSimulation

Example

unsigned char buffer[];

enableIgnitionHandling(0); iftype(buffer);

enableIgnitionHandling(1);

(58)

enableUbattHandling

Summary Enable/disable battery monitoring

void enableUBattHandling(long enable)

enable 0 = disable / <>0 = enable

Remarks This function either enables or disables the battery monitoring. If monitoring is enabled, the error "IFH-0015: UBATT ON/OFF ERROR" is issued after disabling the battery voltage at the next interface communicaiton. The current value can be read with "getCfgInt("UBattHandling");". After the ECU description file is changed, this setting is reset again to the application default.

Return value -

See also enableIfhTrace, enableIgnitionHandling, getCfgInt, getCfgString, IsDebugLevel, IsSimulation

Example

unsigned char buffer[];

enableUbattHandling(0); iftype(buffer);

enableUbattHandling(1);

Result -

(59)

fclose

Summary Closes a file

void fclose(int handle)

handle Reference to a file opened by fopen (V)

Remarks The fclose function closes a file opened with fopen. No further file

operations are possible after fclose. Error BIP_0006 is activated in the event of an error (failure by EDIABAS host file system) [4].

Return value -

See also fopen, fread, freadln, fseek, fseekln, ftell, ftellln Example { int handle; handle=fopen("\test\div\test.dat"); ... /* file operations */ ... fclose(handle); } Result -

(60)

fopen

Summary Opens a text file

int fopen(char filename[])

filename Name of file to be opened

Remarks Opens the specified text file for reading. Up to 5 files can be opened at the same time. A so-called filehandle is returned if the open is successful. The filehandle refers to that and only that opened file and must be specified with all other file operations. When opened, the file's read pointer is moved to the first character of the file. Error BIP_0006 is activated in the event of an error (failure by EDIABAS host file system) [4].

Return value Filehandle

See also fclose, fread, freadln, fseek, fseekln, ftell, ftellln Example

{

int handle;

handle=fopen("/usr2/test/test.dat"); ...

/* file operations with handle */ ...

fclose(handle); }

Result -

(61)

fread

Summary Reads a single character from a file

long fread(int handle)

handle Reference to a file opened with fopen (V).

Remarks The fread function reads a character from a file. It reads from the

current position of the read pointer. The read pointer is incremented by 1 after the character is read. If an attempt was made to read at the end of a file, then -1 is returned as the value of the character and the read pointer is no longer incremented.

Return value The read character (0x00 - 0xff) or -1.

See also fclose, fopen, freadln, fseek, fseekln, ftell, ftellln Example

{

int handle;

long c; long i=0;

handle=fopen("test.dat");

while((c=fread(handle)) != -1)

i++;

}

(62)

freadln

Summary Reads a line from a file

long freadln(char line[],int handle)

line Buffer to accept the read line (V)

handle Reference to a file opened with fopen (V).

Remarks The freadln function reads a line from a file. A line is all

characters up to an LF character. It reads from the current position of the read pointer. After the line is read the read pointer is incremented until it points to the beginning of the next line. The function returns the length of the line. If an attempt was made to read at the end of a file, then -1 is returned as the length of the line and the read pointer is no longer incremented. Error BIP_0006 is activated in the event of an error (failure by EDIABAS host file system) [4].

Up to 1024 characters per line are allowed!

Return value The number of characters in the read line.

See also fclose, fopen, fread, fseek, fseekln, ftell, ftellln Example

{

int handle;

char line[]; long i=0;

handle=fopen("beispiel.txt");

while(freadln(line,handle) != -1 )

i++;

}

Result i = number of read lines

(63)

fseek

Summary Sets the position of the read pointer byte by byte

long fseek(long pos,int handle)

pos New position of the read pointer in the file handle Reference to a file opened with fopen (V).

Remarks The fseek function positions the read pointer on a certain byte in a

file. It is always positioned right at the start of the file. The position of the first character is 0. Error BIP_0006 is activated in the event of an error (failure by EDIABAS host file system) [4].

Return value The new position in the file.

See also fclose, fopen, fread, freadln, fseekln, ftell, ftellln

Example { int handle; int c; handle=fopen("Filename"); c=fread(handle); fseek(0,handle); c=fread(handle); ... }

(64)

fseekln

Summary Sets the position of the read pointer line by line

long fseekln(long pos,int handle)

pos New line position of the read pointer in the file handle Reference to a file opened with fopen (V)

Remarks The fseekln function positions the read pointer on a certain line in

a file. It is always positioned right at the start of the file. The number of the first line is 0. Error BIP_0006 is activated in the event of an error (failure by EDIABAS host file system) [4].

Return value The new line position in the file.

See also fclose, fopen, fread, freadln, fseek, ftell, ftellln Example { int handle; char line; handle=fopen("test.txt"); fseekln(10,handle); freadln(line,handle); ... }

Result The 11th line of the file is read.

(65)

ftell

Summary Identifies the position of the read pointer

long ftell(int handle)

handle Reference to a file opened with fopen (V)

Remarks The ftell function identifies the current position of the read pointer

in bytes from the start of a file. The position of the first character is 0. Error BIP_0006 is activated in the event of an error (failure by EDIABAS host file system) [4].

Return value The current position in the file.

See also fclose, fopen, fread, freadln, fseek, fseekln, ftellln Example { int handle; long c: handle=fopen("Filename"); c=fread(handle); c=fread(handle); ... c=ftell(handle); }

(66)

ftellln

Summary Identifies the position of the read pointer in lines

long ftellln(int handle)

handle Reference to a file opened with fopen (V)

Remarks The ftellln function identifies the current position of the read

pointer in lines from the start of a file. The position of the first line is 0. Error BIP_0006 is activated in the event of an error (failure by EDIABAS host file system) [4].

Return value The current position in the file.

See also fclose, fopen, fread, freadln, fseek, fseekln, ftell Example { int handle; char line[]; handle=fopen("xxx.tst"); freadln(line,handle); freadln(line,handle); ... c=ftellln(handle); }

Result c=2, 2 lines were read.

(67)

getasciitime

Summary Determines the current time as ASCII-String

void getasciitime(char time[])

time String buffer to take up the time string (v)

Remarks Determines the current time from the system time as a string of the following form:

"hh:mm:ss"

Return value -

See also getasciidate, getdate, gettime, wait

Example {

char time[];

getasciitime(time); ...

}

(68)

get_battery_voltage

Summary Reads out the battery voltage

long get_battery_voltage()

Remarks This function returns the voltage at clamp 30 (battery voltage) in millivolts.

Return value Voltage in millivolts.

See also get_ignition_voltage Example

long voltage;

voltage = get_battery_voltage();

Result -

(69)

get_error

(get_trap_mask, set_trap_mask )

Summary Checks whether an error has occurred

long get_error(long nr)

no Number of error to be checked

Remarks Normally, EDIABAS reacts to an error by automatically aborting the currently active job, and only an error message is returned. In some cases, however, e.g. in case of control unit identification, you may want to analyze certain errors in the control unit description file, and certain bits (trap bits) can be set in the trap mask register for this purpose (see set_trap_mask). Each trap bit is assigned an error message. When this bit is set, the job is not automatically aborted when an error occurs, but a trap bit and the trap number are set in the condition code register. The get_error function now checks whether the trap bit is set and whether the specified error agrees with the trap number. If it does, get_error returns TRUE (!0); if not, it returns FALSE (0). If no = 0, it only checks whether the trap bit is set. If it is, there is an error, and TRUE is returned. See set_trap_mask for a list of possible trap numbers.

Return value TRUE if there was an error; FALSE, if not. See also get_trap_mask, set_trap_mask, make_error

Example set_trap_mask(0xffffffff); //trap all errors

send_and_receive(destin,source); if(get_error(0))

(70)

get_error2

Summary Checks whether an error has occurred.

long get_error2()

Remarks Normally, EDIABAS reacts to an error by automatically aborting the currently active job, and only an error message is returned. In some cases, however, e.g. in case of control unit identification, you may want to analyze certain errors in the control unit description file, and certain bits (trap bits) can be set in the trap mask register for this purpose (see set_trap_mask). Each trap bit is assigned an error message. When this bit is set, the job is not automatically aborted when an error occurs, but a trap bit and the trap number are set in the condition code register. The get_error2 function returns the error number. For the list of available trapnumbers see funtion set_trap_mask.

Return value number of error that occured

See also get_error, get_trap_mask, set_trap_mask, make_error

Example long error;

set_trap_mask(0xffffffff); // trap all errors send_and_receive(destin,source);

error = get_error2();

(71)

get_ignition_voltage

Summary Reads out the voltage at the ignition

long get_ignition_voltage()

Remarks This function returns the voltage at clamp 15 (ignition voltage) in millivolts.

Return value Voltage in millivolts.

See also get_battery_voltage Example

long voltage;

voltage = get_ignition_voltage();

(72)

get_token

Summary Identifies a token in a string

void get_token(char destin[],char source[],char trenner[],long nr)

destin Target buffer for the identified token (V) source string to be analyzed

separator string with the possible token separators no number of the token to be identified

Remarks A token is a coherent part of a character string that is limited by one or more characters from separator. To split a normal text into tokens, the separator string separator must contain SPACE, TAB and CR. The get_token function analyzes the source string and identifies the tokens within the string that are defined by the characters in separator. The token number no is then copied to destin.

Return value -

See also get_token, strcat, strcmp, strcpy, strcut, strerase, strinsert, strlen, strncpy, strrevers

Example {

char source[]; char destin[];

source="DIES IST EIN TEST FUER TOKENS";

gettoken(destin,source," ",4);

}

Result destin = "TEST"

(73)

getasciidate

Summary Determines the current date as ASCII string

void getasciidate(char date[])

date string buffer to take up the date string (v)

Note Determines the current date from system time as a string of the following pattern:

"wt tt.mm.jj KW kw"

wt = weekday = MO, DI (TUE), MI (WED), DO (THU), FR, SA, SO (SUN)

The calendar week (KW) is determined according to the general rules.

Return value -

See also getasciitime, getdate, gettime, wait

Example {

char date[];

getasciidate(date); ...

}

(74)

get_trap_mask

Summary Gets the current value of the trap mask register

long get_trap_mask()

Remarks The get_trap_mask function reads the current value of the trap

mask register. This register decides which errors will be reported to the runtime system and which will not.

See set_trap_mask for a full description of the trap mask register.

Return value The current value of the trap mask register

See also get_error, set_trap_mask Example { long x; set_trap_mask(0x00180000); x=get_trap_mask(); } Result x=0x00180000 74

(75)

generateRunError

Summary Generates a runtime error „RUN-00XX“

void generateRunError(long errornumber)

errornumber number of error that has to be issued

Remarks This function generates an a runtime error „RUN-00XX“ determined by errornumber

Return value -

See also make_error, get_error

Example {

...

generateRunError(250); // generate „RUN-0000“

//

}

(76)

getasciidate

Summary Gets the current date as an ASCII string

void getasciidate(char date[])

date String buffer to take the date string (V)

Remarks From the system time this function identifies the current date as a string with the form

"wt tt.mm.jj KW kw"

wt = weekday = MO, DI, MI, DO, FR, SA, SO

The calendar week (KW) is identified according to generally applicable rules.

Return value -

See also getasciitime, getdate, gettime, wait Example { char date[]; getasciidate(date); ... }

Result date="FR 31.12.92 KW 52" (example)

(77)

getasciitime

Summary Gets the current time as an ASCII string

void getasciitime(char time[])

time String buffer to take the time string (V)

Remarks From the system time this function identifies the current time as a string with the form

"hh:mm:ss"

Return value -

See also getasciidate, getdate, gettime, wait Example { char time[]; getasciitime(time); ... }

(78)

getCfgInt

Summary Reads out a configuration element as integer

long getCfgInt(char cfg[])

cfg Configuration element

Remarks With this function, the setting of EDIABAS configuration elements can be determined.

Return value Current configuration setting

See also enableIIfhTrace, enableIgnitionHandling, enableUbattHandling, getCfgString, IsDebugLevel, IsSimulation

Example long cfgvalue;

cfgvalue=getCfgInt("RetryComm");

Result cfgvalue=0..1 // automatic repetition ?

(79)

getCfgString

Summary Reads (gets) a configuration element as a string

long getCfgString(char cfgvalue[],char cfg[]) cfgvalue Buffer for configuration setting

cfg Configuration element

Remarks This function can be used to determine the setting of EDIABAS configuration elements.

Return value 0: Configuration element not found 1: Configuration element found

See also enableIIfhTrace, enableIgnitionHandling,

enableUbattHandling, getCfgInt, IsDebugLevel, IsSimulation Example

{

char cfgvalue[];

getCfgString(cfgvalue,"SimulationPath"); }

(80)

getdate

Summary Gets the current time as an array structure

void getdate(char date[])

date Buffer to take the date structure (V)

Remarks From the system time this function identifies the current date as a structure with the form:

date[0] = day of month (1..31) date[1] = month of year (1..12) date[2] = year (0..99)

date[3] = calendar week (1..53)

date[4] = weekday (1 = Monday ... 7 = Sunday)

The calendar week is identified according to generally applicable rules.

Return value -

See also getasciidate, getasciitime, gettime, wait Example

{

char date[];// Friday, 6th of August, 1999 (calendar week 31)

getdate(date); ...

}

Result date= { 06, 08, 63 } (example)

(81)

getETXblock

Summary Returns the data bytes of a block specified for a KWP 1281 ECU.

long getETXblock(unsigned char antwort[], long status, long block, unsigned char daten[], long blocklaenge)

antwort ECU response message frame (V)

status In the function: Expected status byte of the block (V) From the function: Actual status byte of the block (V) block Block number beginning with 1

daten Daten bytes of the block (V)

blocklaenge Number of data bytes in the block (V)

Remarks This function filters out the data bytes of a certain block from the response message of an ECU. In addition, the block is checked for correctness by means of a passed status byte (expected status == actual status). If the expected (desired) status byte does no agree with the actual status byte, this function returns the value 0, otherwise 1.

Return value 0 = Fehler 1 = ok

See also - Example

{

unsigned char antwort[];

unsigned char buffer[];

unsigned char status = 0xfc; char blockLen; send_and_receive(antwort,tel_fslesen); if (getETXblock(antwort,status,1,buffer,blockLen)) { } Result -

(82)

GetKWP2000Block

Summary Extracts the data component from a KWP 2000 telegram in the control unit response.

int GetKWP2000Block(int position, char response[],char format, chartarget, char source, int length, char

data[])

position Initial position of a telegram in the control unit response (V)

response Control unit response

format KWP 2000 format byte in the header (V)

target KWP 2000 tester address in the 3-byte header. In a 1- byte header, 0 is entered. (V)

source KWP 2000 control unit address in the 3-byte header. In a 1-byte header, 0 is entered.(V)

length Length of the telegram data (including the ServiceID) (V) data Telegram data (including the ServiceID) (V)

Remarks This function extracts the data component (including ServiceID) from a KWP 2000 telegram; DataSegmentation is supported. Since the control unit response may consist of several telegrams, position points to the beginning of a telegram. After execution of the function, position points to the next telegram, if available. The function returns the value 1 as long as no error has occurred.

Return value 0: error 1: no error

See also -

(83)

Example {

unsigned char resonse[]; int position;

int format; int source; int target; int length;

unsigned char data[];

unsigned char dataglobal[];

send_and_receive(resonse,request); position = 0; while(GetKWP2000Block(position,resonse, format,source,target,length,data)) datacat(dataglobal,data); } Result -

(84)

gettickcount

Summary Gets an iternal tick counter of milliseconds.

unsigned long gettickcount()

Remarks This function gets an internal tick counter of milliseconds. Note: multiple calls of this function may cause a counter overrun. In this case the counter starts again with 0. The precision of the function gettickcount depends on the operating system:

Win16/32: milliseconds since system start Unix: seconds since 00:00 o`clock

Return value value of milliseconds

See also getasciidate, getasciitime, getdate, wait, waitex

Example {

unsigned long ticks; ticks=gettickcount(); ...

}

Result -

References

Related documents