Professional Documents
Culture Documents
Ediabas Best Guide
Ediabas Best Guide
Ediabas Best Guide
1. Revision history
2. Introduction
3. General Information
4. Tutorial
5. BEST Tools
B. REFERENCES
1. Revision history
Version 3.0 First release
file:///C:/Users/sgtma/AppData/Local/Temp/~hhF948.htm 7/16/2020
EDIABAS BEST Developer's Guide Page 2 of 161
2. Introduction
More:
2.2. Conventions
2.4. Trademarks
EDIABAS BEST Developer's Guide > BEST User Manual > 2. Introduction
This manual sets out the principles for creating control unit description files and describes the use and options of the development
support programs. This manual does not go into any great depth about BEST/1 language. As a general rule all control unit
description files can be formulated in BEST/2 notation which is easier to read. You will find a detailed description of the BEST/1
language in [3]. General information about EDIABAS and control unit description files is given in Reference [4].
EDIABAS BEST Developer's Guide > BEST User Manual > 2. Introduction
2.2. Conventions
Example Description
SAMPLE.B2V 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.
.}
file:///C:/Users/sgtma/AppData/Local/Temp/~hhF948.htm 7/16/2020
EDIABAS BEST Developer's Guide Page 3 of 161
EDIABAS BEST Developer's Guide > BEST User Manual > 2. Introduction
The abbreviations used in this and all other EDIABAS documents are explained in the "GLOSSARY" section of the "EDIABAS
User Manual".
EDIABAS BEST Developer's Guide > BEST User Manual > 2. Introduction
2.4. Trademarks
Microsoft, MS, MS-DOS, Windows and WIN32 are registered trademarks of the Microsoft Corporation.
3. General Information
More:
3.5. Filenames
EDIABAS BEST Developer's Guide > BEST User Manual > 3. General Information
Control unit description files - SGBDs for short - contain methods for reading control unit specific data from the control unit and
compiling it into an abstract and generally readable form.
In EDIABAS, these methods are called jobs and are usually written in BEST/2. BEST/2 syntax is based on C language but is
matched to the specific needs of control unit description. You will find a detailed description of BEST/2 syntax in [5]. In particular,
the jobs have had to be incorporated as a special type of function. The use of fields has also been streamlined to simplify the handling
of complex telegram data. Unlike C, the user cannot define his own functions, but there is a runtime library (see [1]) that has been
optimized for diagnostic tasks and it provides functions for all problems.
A job can be called independently of other jobs at any time so jobs are not allowed to be dependent on one other in time terms.
BEST/2 prevents this by not having any constructs that allow jobs to exchange data. Only constants may be global.
EDIABAS BEST Developer's Guide > BEST User Manual > 3. General Information
There are three types of ECU description files: 1) Variant, 2) Basic and 3) Group. An explanation of the terms "ECU variant" and
"ECU group" can be found in [4]).
EDIABAS expects all ECU description files in the ECU directory (configuration element EcuPath in EDIABAS.INI).
More:
file:///C:/Users/sgtma/AppData/Local/Temp/~hhF948.htm 7/16/2020
EDIABAS BEST Developer's Guide Page 4 of 161
EDIABAS BEST Developer's Guide > BEST User Manual > 3. General Information > 3.2. ECU description files
In addition to the jobs INITIALISIERUNG and ENDE (optional), the group description file only contains the job
IDENTIFIKATION which determines the variant currently installed in the vehicle. Jobs in a group description file cannot be
called with an API job.
EDIABAS BEST Developer's Guide > BEST User Manual > 3. General Information > 3.2. ECU description files
In addition to the jobs INITIALISIERUNG and ENDE (optional), the variant description files contain the actual jobs for
determining data from the ECU.
A variant description file can access one or more basic description files. Jobs in the basic description files are treated like the jobs
from the variant description file when jobs are processed.. Standard jobs in the basic description file are ignored.
EDIABAS BEST Developer's Guide > BEST User Manual > 3. General Information > 3.2. ECU description files
Jobs which are the same for several ECUs are stored in commonly used basic ECU description files (SGBDs). ECU-specific jobs,
in contrast, are stored in the respective "variant" ECU description file.
In order not to limit the alternative search to the single basic ECU description file, alternative basic ECU description files can be
specified within the ECU description file.
More:
EDIABAS BEST Developer's Guide > BEST User Manual > 3. General Information > 3.2. ECU description files > 3.2.3. Basic
description file
Which basic ECU description file or alternative ECU description files are to be applied whenever the job in the ECU description
file is not found can be specified in the header of a variant ECU description file. For this purpose, the new entry uses is defined in
the header followed by the name(s) (without extension) of the alternative basic ECU description files (PRG files), separated by one
or more blanks and/or comma. The line must end with a semicolon.
Example:
The example below shows the header of a variant ECU description file designated VARIANTE.PRG. Jobs which are not found in
this ECU description file should be searched in the basic ECU description files BASIS1, BASIS2 and BASIS3. This is defined in
the line uses.
/////////////////////////////////////////////////////////////
// H E A D E R
/////////////////////////////////////////////////////////////
file:///C:/Users/sgtma/AppData/Local/Temp/~hhF948.htm 7/16/2020
EDIABAS BEST Developer's Guide Page 5 of 161
origin : softing.BG5.Ma;
revision: 1.0;
author : softing.BG5.Ma;
language: German;
uses : BASIS1, BASIS2, BASIS3;
/////////////////////////////////////////////////////////////
EDIABAS first checks whether the job specified in the apiJob call can be found in VARIANTE.PRG. If this is the case, the job is
executed. If the job does not exist in VARIANTE.PRG, search is continued in the first alternative basic ECU description file
specified in the header from VARIANTE.PRG following uses, here BASIS1.PRG. Search is continued accordingly until the job is
found. If the job is also not found in the last ECU description file (here BASIS.PRG), EDIABAS issues the error message "SYS-
0008: JOB NOT FOUND" .
In another example, assumption is made that the application in the apiJob call specifies the name of a group ECU description file
(here D XY) beside the job name. The ECU variant is determined in the job identification of the group ECU description file
D_XY.GRP , and the associated name of the variant ECU description file is entered in the result VARIANTE: In this case, XY_1
or XY_2 or XY_3. EDIABAS searches the job in the corresponding ECU description file. Jobs which are not found there are
searched in the basic ECU description file (here BASIS.PRG or BASIS2.PRG). The reference to the basic ECU description file
must always be entered in the variant ECU description files.
A variant ECU description file must exist for each ECU variant which, in the extreme case, only consists of the header and the jobs
INITIALISIERUNG and ENDE (optional). When a basic ECU description file is accessed, the standard jobs INITIALISIERUNG
and ENDE of the basic ECU description file are not called (the standard jobs INITIALISIERUNG and ENDE are not required in a
basic ECU description file).
EDIABAS BEST Developer's Guide > BEST User Manual > 3. General Information > 3.2. ECU description files > 3.2.3. Basic
description file
If a job is to be an ECU-specific variant and not to be called from the basic ECU description file, this job is to be appropriately
defined in the variant ECU description file. For this purpose, the corresponding job is stored in the variant ECU description file of
the ECU under the same name and implemented ECU specifically. Since EDIABAS already finds the job in the variant ECU
description file, this is executed instead of the job with the same name from the basic ECU description file.
EDIABAS BEST Developer's Guide > BEST User Manual > 3. General Information
Standard jobs have a special meaning for EDIABAS. These jobs are automatically called by the runtime system under certain
conditions in addition to the job specified. These jobs can receive parameters.
The result of standard jobs is stored in defined standard results which EDIABAS automatically interrogates.
file:///C:/Users/sgtma/AppData/Local/Temp/~hhF948.htm 7/16/2020
EDIABAS BEST Developer's Guide Page 6 of 161
JOB1
apiJob(SGBD1,JOB1,...)
SGBD1.PRG JOB1
apiJob(SGBD1,JOB1,...)
SGBD1.PRG JOB1 (error occured)
apiJob(SGBD1,JOB1,...)
SGBD1.PRG INITIALISIERUNG
JOB1
apiJob(SGBD2,JOB1,...)
SGBD1.PRG ENDE
SGBD2.PRG INITIALISIERUNG
JOB1
apiInit()
apiJob(SGBD3,JOB1,...)
SGBD2.PRG ENDE
SGBD3.PRG INITIALISIERUNG
JOB1
IDENTIFIKATION (of
the variant)
ENDE
VARIANT.PRG INITIALISIERUNG
JOB1
apiJob(GROUP,JOB1,...)
VARIANT.PRG ENDE
GROUP.GRP INITIALISIERUNG
IDENTIFIKATION (of
the variant)
ENDE
VARIANT.PRG INITIALISIERUNG
JOB1
apiInit()
apiJob(GROUP,JOB1,...)
file:///C:/Users/sgtma/AppData/Local/Temp/~hhF948.htm 7/16/2020
EDIABAS BEST Developer's Guide Page 7 of 161
GROUP.GRP INITIALISIERUNG
IDENTIFIKATION (of
the variant)
ENDE
VARIANT.PRG INITIALISIERUNG
JOB1
More:
EDIABAS BEST Developer's Guide > BEST User Manual > 3. General Information > 3.3. Standard jobs
The standard job INITIALISIERUNG must exist in every group and variant description file. It is automatically called:
Successful initialization is to be displayed with the standard result DONE (result type int or unsigned int):
Except for the result DONE, the standard job INITIALISIERUNG must not return any other results .
EDIABAS BEST Developer's Guide > BEST User Manual > 3. General Information > 3.3. Standard jobs
The standard job IDENTIFIKATION is called to determine the installed ECU variant whenever a group description file has been
specified in the job.
The standard job IDENTIFIKATION must exist in every group description file.
An identified ECU variant is to be displayed in the first result record with the standard result VARIANTE (string from result type
string):
• Result VARIANTE = String (at least 1 character) Successful identification, the result represents the name of the ECU variant
Except for VARIANTE, the standard job IDENTIFIKATION must not delivery any other results.
file:///C:/Users/sgtma/AppData/Local/Temp/~hhF948.htm 7/16/2020
EDIABAS BEST Developer's Guide Page 8 of 161
EDIABAS BEST Developer's Guide > BEST User Manual > 3. General Information > 3.3. Standard jobs
The optional standard job ENDE is called when the description file is varied:
The standard job ENDE can exist in each group and variant description file.
EDIABAS BEST Developer's Guide > BEST User Manual > 3. General Information
The variant is identified by the job IDENTIFIKATION which is mandatory in the group description file. This job must return the
result VARIANTE which is then used to identify the variant description file.
IDENTIFIKATION (of
the variant)
ENDE
VARIANT.PRG INITIALISIERUNG
JOB1
EDIABAS BEST Developer's Guide > BEST User Manual > 3. General Information
3.5. Filenames
Files that are used by EDIABAS have defined filename extensions which are mandatory and are different for group and variant
description files.
file:///C:/Users/sgtma/AppData/Local/Temp/~hhF948.htm 7/16/2020
EDIABAS BEST Developer's Guide Page 9 of 161
4. Tutorial
This tutorial uses a realistic example to show you how to create a BEST/2 description file. We have tried to cover as many aspects of
programming as possible. The use of the development tools is also explained at a number of points.
1. You can either use the files supplied by the BEST DEVELOPMENT KIT, or
2. You can edit the files as you go, starting from the DEMO0.B2V file in section 4.2.
With the first method you are prompted what file to load for the section. With the second method all the changes in this manual are
listed and shown like this:
You will find a detailed description of the BEST/2 functions used in this tutorial in [1] which fully describes all BEST/2 library
functions with their call parameters and an example.
More:
4.1. Preconditions
EDIABAS BEST Developer's Guide > BEST User Manual > 4. Tutorial
4.1. Preconditions
For this tutorial a development of ECU description files under MS-WINDOWS is provided. The development environment
BestBoard and the Source Code Debugger BestView is only available for MS-WINDOWS.
In order to walk-through the sequences shown in this tutorial, the EDIABAS-RUNTIME-SYSTEM and the BEST-
DEVELOPMENT-KIT must be installed.
The following settings have to be done in the EDIABAS configuration file EDIABAS.INI:
file:///C:/Users/sgtma/AppData/Local/Temp/~hhF948.htm 7/16/2020
EDIABAS BEST Developer's Guide Page 10 of 161
EcuPath = C:\EDIABAS\TUTORIAL
TracePath = C:\EDIABAS\TUTORIAL
SimulationPath = C:\EDIABAS\TUTORIAL
Simulation = 1
Assumption is made that EDIABAS has been installed in directory C:\EDIABAS. If this is not the case, the EDIABAS
configuration file EDIABAS.INI must be adapted. The configuration setting C:\EDIABAS\TUTORIAL is to be replaced by
<EDIABAS path>\TUTORIAL for the configuration elements EcuPath, TracePath and SimulationPath. Moreover, this must be
replaced by the path of the EDIABAS directory everywhere where C:\EDIABAS can be read in this description.
The tutorial describes how to program ECU communication. In order to enable this independent of the hardware used and the
available ECUs, the ECU Simulator contained in EDIABAS is used. Refer to [2] for a detailed functional description concerning
this. Files DEMO*.SIM and EDIC.SIM are necessary for this purpose.
The individual development phases are represented by prepared description files in directory C:\EDIABAS\TUTORIAL. A total of
9 steps are involved and the corresponding files DEMO0.B2V to DEMO8.B2V.
EDIABAS BEST Developer's Guide > BEST User Manual > 4. Tutorial
To begin developing our SGBD, first start the BestBoard routine BESTBD32.EXE in the directory \EDIABAS\BIN respectively.
Provided your settings are correct you will see the dialogue box "Notify Test Environment" which shows that the control unit
simulator is activated in the selected ECU directory. The simulation file directory and the simulated interface are displayed, also
whether the traces of API and IFH are active.
Acknowledge this message and you will see the BestBoard main window. All the actions needed to create and test an SGBD can be
controlled from this program.
To open the raw version of our SGBD, select the FILE/OPEN menu or press the appropriate key (second from left, see also
BestBoard description).
EDIABAS BEST Developer's Guide > BEST User Manual > 4. Tutorial
Opening the file automatically calls the text editor NOTEPAD.EXE. This displays the selected file - in this case DEMO0.B2V (The
copyright message contained in this file is not reproduced in this manual). The file contains a frame for an SGBD that is blank but
which already has comments:
//////////////////////////////////////////////////////////////////////
// H E A D E R
//////////////////////////////////////////////////////////////////////
ecu :;
file:///C:/Users/sgtma/AppData/Local/Temp/~hhF948.htm 7/16/2020
EDIABAS BEST Developer's Guide Page 11 of 161
origin : ;
revision: ;
author : ;
comment : ;
//////////////////////////////////////////////////////////////////////
// C O N S T A N T S
//////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////
// J O B S
//////////////////////////////////////////////////////////////////////
job(name : INITIALISIERUNG;
comment : Initializing;
result : DONE;
type : int;
defrslt : ;
DONE = 1;
//////////////////////////////////////////////////////////////////////
job(name : ENDE;
file:///C:/Users/sgtma/AppData/Local/Temp/~hhF948.htm 7/16/2020
EDIABAS BEST Developer's Guide Page 12 of 161
comment : De-initializing;
//////////////////////////////////////////////////////////////////////
The file contains a header (that must be filled out) and two jobs. These are the standard jobs INITIALISIERUNG and ENDE and are
called automatically by the runtime system when a description file is loaded (INITIALISIERUNG) or unloaded (ENDE).
You will see that a job's header contains its name and at least one comment line. It also lists and comments all the parameters and
results of the job. During compiling, these headers are incorporated in the objects and can be read out with the XTRACT tool. The
header consists of n entries in the form: "keyword: data;". Here is a description of these keywords:
• name Name of the job. The name with which the application program addresses the job.
• comment Comment line. Contains any desired comment (at least 1 line).
• result Beginning of the result block. Must be followed by the keywords type, defrslt (optional) and comment(s). data
gives the name of the result. The application program and the job can access the result with this name.
• argument Beginning of a parameter block. Must be followed by the keywords type and comment(s). data gives the name of
the parameter. The application program and the job can access the parameter with this name. Only the parameter
sequence is important for the application program.
• type Type of parameter or result, the following values of data are allowed:
• [unsigned] char byte or character (8 bit)
• [unsigned] int word or integer (16 bit)
• [unsigned] long double word or long integer (32 bit)
• string zero-terminating text string (1024 bytes max.)
• real double value
• data byte field (1024 bytes max.)
• defrslt Optional default value for a result.
In the INITIALISIERUNG job, the result DONE is assigned the value 1. This result must be present in this job as it tells the runtime
system whether the job was executed successfully or not.
EDIABAS BEST Developer's Guide > BEST User Manual > 4. Tutorial
The file now opened can already be compiled. It attempts to communicate with the interface. To do this the following lines must be
inserted or changed:
//////////////////////////////////////////////////////////////////////
// HEADER
//////////////////////////////////////////////////////////////////////
file:///C:/Users/sgtma/AppData/Local/Temp/~hhF948.htm 7/16/2020
EDIABAS BEST Developer's Guide Page 13 of 161
ó origin : softing.SAG.HD;
ó revision: 1.1;
ó author : softing.SAG.HD;
...
job(..name : INITIALISIERUNG;
comment : Initializing;
comment : a CU.;
result : DONE;
type : int;
defrslt :;
DONE = 1;
//////////////////////////////////////////////////////////////////////
job(..name : ENDE;
comment : De-initializing;
file:///C:/Users/sgtma/AppData/Local/Temp/~hhF948.htm 7/16/2020
EDIABAS BEST Developer's Guide Page 14 of 161
Since this SGBD wants to communicate with a control unit (actually with the interface in between) the function
open_communication must be called in the INITIALISIERUNG and ENDE jobs. This function attempts to open a communication
channel to the interface. No special error handling is needed. If an error occurs during this function call, the job routine is aborted at
this point and an appropriate error message is sent to the application program. This applies to all communication functions.
To compile the created file, start the compiler BEST2WIN in the PROJECT/COMPILE menu. The compiler's icon can be seen on
the Windows screen background while it is working. Any errors that occur during compiling are subsequently shown in the
application area of BestBoard and the Editor is loaded with the appropriate file. All errors can be shown in sequence using the
PROJECT/NEXT ERROR or PROJECT/PREVIOUS ERROR menu (optional also with the 6th and 7th toolbar keys) and corrected
in the Editor. An audible signal and a blank application area indicate that the last error has been processed and you may now restart
the compiler. When the compiler shows no further error messages a runnable SGBD object file has been generated.
EDIABAS BEST Developer's Guide > BEST User Manual > 4. Tutorial
The filed now opened will also prepare the hardware interface for communication with the control unit. First the constants for the
parameters and telegrams are defined:
//////////////////////////////////////////////////////////////////////
// CONSTANTS
//////////////////////////////////////////////////////////////////////
ð //
ð // Concept 1
ð // Baudrate 9600
ð // Wakeup time 0 ms
ð // Idle time 0 ms
file:///C:/Users/sgtma/AppData/Local/Temp/~hhF948.htm 7/16/2020
EDIABAS BEST Developer's Guide Page 15 of 161
ð //
ð int CTRLPOS = 3;
ð //
The parameters define how the interface will process the telegrams on the diagnostic bus. The individual parameters are explained in
the comment before the definition of the parameter fields.
CTRLPOS and CTRLOR are constants which are needed again and again in this SGBD and so they are defined at the beginning of
the file to make the file easier to read.
The telegrams are diagnostic jobs defined in the control unit specification.
In the INITIALISIERUNG job the communication parameters are sent to the interface:
//////////////////////////////////////////////////////////////////////
ð set_answer_length(AWLEN); // parameters
DONE = 1;
file:///C:/Users/sgtma/AppData/Local/Temp/~hhF948.htm 7/16/2020
EDIABAS BEST Developer's Guide Page 16 of 161
The function set_repeat_counter ensures that each failed control unit communication is repeated twice. The functions
set_communication_pars and set_answer_length use the predefined constants to load the communication parameters to the
interface. These functions and their parameters are described fully in [1].
EDIABAS BEST Developer's Guide > BEST User Manual > 4. Tutorial
The file DEMO3.B2V can already communicate with the control unit. To do this properly, two jobs are appended at the end of the
SGBD:
ð ///////////////////////////////////////////////////////////////////
ð result : IDENT_STRING;
ð type : string;
ð defrslt : ;
ð result : IDENT_VERSION;
ð type : string;
ð defrslt : ;
ð )
ð{
ð IDENT_STRING="*****";
ð IDENT_VERSION="*****";
ð send_and_receive(answer,TEL_ID_READ);
ð}
ð ///////////////////////////////////////////////////////////////////
file:///C:/Users/sgtma/AppData/Local/Temp/~hhF948.htm 7/16/2020
EDIABAS BEST Developer's Guide Page 17 of 161
ð result : STATUS;
ð type : string;
ð defrslt : ;
ð )
ð{
ð send_and_receive(answer,TEL_TC_CLEAR);
ð}
ð ///////////////////////////////////////////////////////////////////
The job READ_IDENT is used to read the identification data, supplying it as two text results, IDENT_STRING and
IDENT_VERSION, to the calling application program. The results are pre-assigned the values "****" in the job. the buffer answer[]
is defined to receive the control unit answer. A length is not given: in BEST/2 all fields are up to 65536 bytes long (depending on the
string register size in the description file). Calling the function send_and_receive sends the predefined TEL_ID_READ to the
control unit and the answer is expected in the answer field.
The job CLEAR_TC6 clears the control unit's fault memory by sending the telegram TEL_TC_CLEAR to the control unit. The
answer is expected in the locally defined buffer answer. The field statusText is also defined - this is where the result text for the
result STATUS will be generated.
The job ENDE is expanded by sending the diagnostic end telegram TEL_END_DIAG:
ð send_and_receive(answer,TEL_END_DIAG);
To test the changes made so far, we will now compile the SGBD. You can ignore the 2 warnings. They just say that the variable
statusText and the result STATUS were not used in the CLEAR_TC job. Provided the compile run is OK the description file
can be tested with the debugger. To do this, start the BestView debugger with the PROJECT/DEBUG menu or the 5th key from
left.
file:///C:/Users/sgtma/AppData/Local/Temp/~hhF948.htm 7/16/2020
EDIABAS BEST Developer's Guide Page 18 of 161
Having started the debugger you are asked to select the job. Select READ_IDENT for the first attempt and press OK to confirm your
choice. You will see the SGBD source code in the window. Scroll down and position the cursor on line 109. Use F9
(DEBUG/TOGGLE BREAKPOINT to set a breakpoint in this line, i.e. job processing will be interrupted at that point. Hit F5
(RUN/GO) to start the selected job. A window with a counter shows the number of processed internal working cycles. When the run
reaches line 109 it stops and the current line is marked. This line has not been processed yet. You can now continue processing line
by line by pressing F8 (RUN/STEP). The debugger allows you to display variables and result contents during line-by-line processing
or when a breakpoint is reached. You will find further details in BestView's online help (HELP/CONTENTS).
To run the job to the end without stopping just hit F5 again (RUN/GO). When the job has finished you should see a window with the
results identified by the job. In this case it should contain the following:
VARIANTE = DEMO3.PRG
OBJECT = DEMO3
SETS =1
JOB STATUS =
The operation described above can be repeated as often as you like with this or any other job.
EDIABAS BEST Developer's Guide > BEST User Manual > 4. Tutorial
This version evaluates the answer telegrams sent by the control unit. For this purpose the job READ_IDENT is added to the SGBD as
follows:
IDENT_STRING="*****";
IDENT_VERSION="*****";
ð send_and_receive(answer,TEL_ID_READ);
ð // valid answer ?
file:///C:/Users/sgtma/AppData/Local/Temp/~hhF948.htm 7/16/2020
EDIABAS BEST Developer's Guide Page 19 of 161
ð if (answer[CTRLPOS]==TEL_ID_READ[CTRLPOS] | CTRLOR) {
ð // Make IDENT_STRING
ð datacopy(idString,answer,4,13);
ð strrevers(idString);
ð IDENT_STRING=idString;
ð // Make IDENT_VERSION
ð dataclear(idString);
ð bcd2ascii(verString,answer,17,1);
ð strcopy(idString,verString);
ð strcat(idString,".");
ð bcd2ascii(verString,answer,18,1);
ð strcat(idString,verString);
ð IDENT_VERSION=idString;
ð }
To compute the text results the buffers idString and verString are defined. After checking the control byte in the answer
telegram, 13 characters are copied from the telegram from the 4th position. The string must also be reversed with the
strrevers function so that the result is shown correctly.
The control unit version is a 4-digit BCD number in the telegram from address 17. The first BCD number is read in (bcd2ascii) and
copied to the idString buffer. A full-stop is appended to separate the version number and then the second BCD number is appended.
In the TC_CLEAR job the test result Status should be assigned the string "fault memory cleared" or "fault memory NOT cleared"
irrespective of the returned control byte:
send_and_receive(answer,TEL_TC_CLEAR);
ð // valid answer ?
ð if (answer[CTRLPOS]!=TEL_TC_CLEAR[CTRLPOS] | CTRLOR))
file:///C:/Users/sgtma/AppData/Local/Temp/~hhF948.htm 7/16/2020
EDIABAS BEST Developer's Guide Page 20 of 161
ð strcat(statusText,"NOT");
ð strcat(statusText, "cleared");
ð STATUS=statusText;
If you now compile the file created, starting the debugger as described in the previous section, you will see the following output in
the Results window when the READ_IDENT job is finished:
VARIANTE = DEMO4.PRG
OBJECT = DEMO4
SETS =1
JOB STATUS =
EDIABAS BEST Developer's Guide > BEST User Manual > 4. Tutorial
This version will read out and evaluate the control unit fault memory. For this purpose the job READ_TC is added to the SGBD:
ð result : TC_NR;
ð type : int;
ð defrslt : ;
ð )
ð {
ð int count;
file:///C:/Users/sgtma/AppData/Local/Temp/~hhF948.htm 7/16/2020
EDIABAS BEST Developer's Guide Page 21 of 161
ð send_and_receive(answer,TEL_TC_READ);
ð // valid answer ?
ð if (answer[CTRLPOS]==TEL_TC_READ[CTRLPOS] | CTRLOR) {
ð }
ð }
ð}
This job returns the result TC_NR which simply displays the stored fault code for all faults reported by the control unit. This is done
by storing the same result in a number of result sets. In the loop that runs across all faults the start of a new set is marked after the
result value is assigned. All results that are assigned subsequently are stored in this new set, and results in previous sets are not
changed.
This job returns the following results when it has been processes in the debugger as described above:
VARIANTE = DEMO5.PRG
OBJECT = DEMO5
SETS =5
JOB STATUS =
Five result sets are created, all containing the same result but with different values.
file:///C:/Users/sgtma/AppData/Local/Temp/~hhF948.htm 7/16/2020
EDIABAS BEST Developer's Guide Page 22 of 161
EDIABAS BEST Developer's Guide > BEST User Manual > 4. Tutorial
As well as the above results in the READ_TC job, file DEMO6.B2V returns not only the fault code but also the corresponding fault
text. These fault texts are stored in a table:
ð //
ð {
ð {"NR", "TEXT" },
ð };
This table has 2 columns and as many lines as required. The first column "NR" gives the fault code in hexadecimal format. The
second column "TEXT" gives the corresponding fault text for the fault number. The last line is the default telegram that is used when
the fault code is not found.
ð result : TC_TEXT;
ð type : string;
ð defrslt : ;
file:///C:/Users/sgtma/AppData/Local/Temp/~hhF948.htm 7/16/2020
EDIABAS BEST Developer's Guide Page 23 of 161
ð )
ð {
ð char tableText[];
int count;
send_and_receive(answer,TEL_TC_READ);
// valid answer ?
if (answer[CTRLPOS]==TEL_TC_READ[CTRLPOS] | CTRLOR) {
// number
// fault text
The command tabset initializes table processing and all subsequent table processing commands affect the "TCText" table. The
command tab_suche_index changes the second argument it receives into a string with the format "0x##". This string is searched in
the "NR" column of the table. The search stops when the value is found. The command tabget now reads out the corresponding text
on the same line in the "TEXT" column. If the search text is not found it reads the text from the last line.
VARIANTE = DEMO6.PRG
OBJECT = DEMO6
SETS =5
file:///C:/Users/sgtma/AppData/Local/Temp/~hhF948.htm 7/16/2020
EDIABAS BEST Developer's Guide Page 24 of 161
JOB STATUS =
Each result set contains 2 results, the fault number and the fault text.
EDIABAS BEST Developer's Guide > BEST User Manual > 4. Tutorial
In this version of our SGBD a job is added that reads out three status values from the control unit. The application program can
determine which results are to be computed and which are not. This can speed up the job run when only one result is required. The
new job is appended to the end of the SGBD:
ð ///////////////////////////////////////////////////////////////////
ð result : ENGINESPEED;
ð defrslt : ;
ð result : TEMPERATURE;
ð type : real;
ð defrslt : ;
ð result : VOLTAGE;
ð type : real;
file:///C:/Users/sgtma/AppData/Local/Temp/~hhF948.htm 7/16/2020
EDIABAS BEST Developer's Guide Page 25 of 161
ð defrslt : ;
ð )
ð send_and_receive(answer,TEL_RPM_READ);
ð if (answer[CTRLPOS]==TEL_RPM_READ[CTRLPOS] | CTRLOR) {
ð tmp=256*answer[4]+answer[5];
ð tmp/=4; // adc16/4
ð ENGINESPEED=tmp;
ð }
ð }
ð send_and_receive(answer,TEL_TEMP_READ);
ð if (answer[CTRLPOS]==TEL_TEMP_READ[CTRLPOS] | CTRLOR) {
ð tmp=256*answer[4]+answer[5];
ð itor(a,tmp);
ð ator(b,"100.0"); // adc16/100-40
ð realdiv(a,b);
ð ator(b,"40.0");
ð realsub(a,b);
ð TEMPERATURE=a;
ð }
file:///C:/Users/sgtma/AppData/Local/Temp/~hhF948.htm 7/16/2020
EDIABAS BEST Developer's Guide Page 26 of 161
ð }
ð send_and_receive(answer,TEL_VOLT_READ);
ð if (answer[CTRLPOS]==TEL_VOLT_READ[CTRLPOS] | CTRLOR) {
ð tmp=256*answer[4]+answer[5];
ð itor(a,tmp);
ð ator(b,"1.238"); // 1.238*adc16100/4000
ð realmul(a,b);
ð ator(b,"4000.0");
ð realdiv(a,b);
ð VOLTAGE=a;
ð }
ð }
ð }
The construct if(ENGINESPEED) does not read the value of the result ENGINESPEED, it decides whether this result was requested
by the application program (the way in which the application program requests these results is described in [6]). ENGINESPEED
returns TRUE if the result must be computed, otherwise FALSE. You can also test this in BestView: the RUN/JOB dialogue contains
a field in which the requested results can be entered. If nothing is entered, then all the results are returned. To request the VOLTAGE
and ENGINESPEED results enter "Results you want to see:" in the field.
voltage;enginespeed
The instructions in the block if(TEMPERATURE) { ... } are not processed. If nothing is entered then all results are reckoned to have
been requested.
When computing the temperature (TEMPERATURE) and supply voltage (VOLTAGE) an integer is read out of the answer telegram
(tmp) and changed to a real number by the itor function. This real number is then handled by functions because BEST/2 has not
operators to process real numbers with.
EDIABAS BEST Developer's Guide > BEST User Manual > 4. Tutorial
In this final version a job is added to the description file that sends a parameter defined by the application program to the control unit.
This parameter is a byte that is inserted into the telegram to the control unit. When the parameter is sent its value is overwritten on the
5th byte in the telegram to the control unit. If no parameter is set the predefined telegram is used:
/////////////////////////////////////////////////////////////////
file:///C:/Users/sgtma/AppData/Local/Temp/~hhF948.htm 7/16/2020
EDIABAS BEST Developer's Guide Page 27 of 161
ð argument : PARAMETER;
ð type : int;
ð result : STATUS;
ð type : string;
ð defrslt : ;
ð )
ð {
ð }
ð send_and_receive(answer,request);
ð // valid answer ?
ð if (answer[CTRLPOS]!=TEL_PARAM_SET[CTRLPOS] | CTRLOR))
ð strcat(statusText,"NOT");
ð strcat(statusText, "set");
ð STATUS=statusText;
ð }
The exist operator checks whether the parameter PARAMETER has been supplied to the job. the application program must send the
parameters in the sequence as defined in the job header. There is no check. The application program supplies the parameters as a
cohesive string, with parameters separated by a ;. A parameter ;; is reckoned not to be sent. In BestView you can also send arguments
file:///C:/Users/sgtma/AppData/Local/Temp/~hhF948.htm 7/16/2020
EDIABAS BEST Developer's Guide Page 28 of 161
to the job. To do this you edit the field "Parameters to be supplied to job:" (sic) field in the RUN/JOB dialogue.
Examples:
;;TEST
Only supplies TEST as the third argument to a job.
0x0005;0x0001
Sends two parameters to a job.
The parameters must be provided with data types, then conversion is automatic. If the first parameter in the above example is a string
type and the second an int type, then the first is seen as a field and the second as a number.
EDIABAS BEST Developer's Guide > BEST User Manual > 4. Tutorial
A job can also receive and return binary parameters and results.
Only one binary parameter of the data type can be defined. This contains a binary field that contains either the complete parameter
string or a special data field. API has special functions (apiJobData/apiJobExt, see [6]) for supplying a binary data field.
More than one result of the data type can be defined on the other hand, and these can be assigned array variables in binary format,
e.g. telegrams.
Example:
argument : SEND_TEL;
type : data;
result : RECV_TEL_1;
type : data;
defrslt : ;
result : RECV_TEL_2;
type : data;
defrslt : ;
file:///C:/Users/sgtma/AppData/Local/Temp/~hhF948.htm 7/16/2020
EDIABAS BEST Developer's Guide Page 29 of 161
send_and_receive(answer1,request); // CU communication
send_and_receive(answer2,request);
RECV_TEL_1=answer1; // results
RECV_TEL_2=answer2;
5. BEST Tools
This section describes tools for creating description files.
More:
5.1. BEST2(WIN)
5.2. BestBoard
5.3. BestView
EDIABAS BEST Developer's Guide > BEST User Manual > 5. BEST Tools
5.1. BEST2(WIN)
BEST2 and BEST2WIN are used to compile ECU description files written in BEST/2 into an object which can be interpreted by
EDIABAS.
BEST2 is a Win32 program called BEST2.EXE is consequently started from the explorer. We recommend, however, that BEST2
be included in a program group.
BEST2WIN is a Win32 program called BEST2WIN.EXE and is consequently started from the explorer. We recommend, however,
that BEST2WIN be included in a program group. An on-line help is available in menu "Help" under option "Contents" which
extensively explains all operating procedures as well as the BEST2WIN call parameters.
BEST2 [-C commandfile] [-B] [-A] [-I] [-S] [-L libfile] [-Z includedir]
BEST2WIN [-C commandfile] [-B] [-A] [-I] [-S] [-L libfile] [-Z includedir]
file:///C:/Users/sgtma/AppData/Local/Temp/~hhF948.htm 7/16/2020
EDIABAS BEST Developer's Guide Page 30 of 161
Compiler option -L enables specification of an alternative BEST/2 runtime library. If this option is not used, BEST/2 uses the
default file B2RUNTIM.LIB. Search is made in the directory where BEST2(WIN).EXE resides.
BEST2(WIN) support the use of Include files. These files are first searched in the directory of the BEST/2 source file. With the
option –Z, the search can be extended to another directory. If several Include directories are indicated, they are searched from left
to right, where each directory is labelled with the option –Z (-Z incldir1 –Z incldir2 ... –Z incldirN). This option is disregarded if
the BEST/2 source file already contained information on the path of the Include file.
The option -S leads to the additional output of the BEST/2 preprocessor file with the ending .p2v for variant description files
or .p2g for group description files, respectively. The BEST/2 preprocessor file contains the entire BEST/2 source code including
the content of the BEST/2 Include files.
If compiler option -A or -I are also specified, either an assembler output (*.b1) or an Infofile with the extension .bix for variant
description files (or .big for group descriptions files (or both)) are output in additional to the object file. All mandatory comments
from the BES/2 source file are listed in the Infofile.
Compiler option -R and its parameters enables a certain revision number and an author to be stored in the object file, overwriting
the specifications in the BEST/2 header.
The option –O stores an error log file. This file has the extension .out. If compiler option -O is not specified, an error log file with
the name best2err.out is then automatically created in case of an error.
Compiler option -P and its parameters enables certain passwords to be stored in the object file. Either a single label to a password
can be specified in a file, or an entire list of label. The parameter is characterized by a prefix "@" as file name. Only password
labels can be used which were previously made known to the system.
The parameter sourcefile describes one or more BEST/2 source files. The optional parameter outdir determines the directory where
BEST2 is to store the output files.
BEST2(WIN) command line parameters can be stored in separate text files and made known by the command line parameter -C
<command line parameter file>.
Compiler option –Q suppresses in BEST2 die acknowledgement of the end of program. Option –B also automatically sets option –
Q.
Example:
BEST2 demo.b2v
The minimum version required by EDIABAS is output for each source files which compiled without errors:
EDIABAS BEST Developer's Guide > BEST User Manual > 5. BEST Tools
5.2. BestBoard
More:
file:///C:/Users/sgtma/AppData/Local/Temp/~hhF948.htm 7/16/2020
EDIABAS BEST Developer's Guide Page 31 of 161
5.2.3. Toolbar
EDIABAS BEST Developer's Guide > BEST User Manual > 5. BEST Tools > 5.2. BestBoard
BestBoard combines the creation of description files in a single program and controls the Editor, the Compiler and the Debugger. It
also lets you run your own application programs for test purposes.
BestBoard is available for WIN32 (BESTBD32.EXE). BestBoard is started from the Explorer. However we recommend that you
put BestBoard in a program group.
• ECU Directory:
Menu: Options ECU directory
The SGBDs in object format are in this directory, or they should be stored there.
When the program is started, the EDIABAS configuration element EcuPath is considered and, if available, assumed.
• EDIABAS Directory:
Menu: Options EDIABAS directory
This directory contains the installed EDIABAS version with the sub-directories BIN, ECU, API etc.
When the program is started, the current EDIABAS directory is assumed.
The name of the editor must be entered in the Tools/Editor menu with the exact command line. A working directory of the Editor can
also be entered optionally. The "Notepad" editor that is generally available under Windows is used as a default.
If the control unit simulator or an EDIABAS trace is activated while starting or stopping BestBoard, you will see a warning together
with the set parameters.
EDIABAS BEST Developer's Guide > BEST User Manual > 5. BEST Tools > 5.2. BestBoard
File
The File menu also lists the last 4 description files, the desired description file is opened by selecting a
name
Project
Debug Calls the BEST debugger BestView with the BEST source file and BEST object file
file:///C:/Users/sgtma/AppData/Local/Temp/~hhF948.htm 7/16/2020
EDIABAS BEST Developer's Guide Page 32 of 161
Run Application Calls the active application program (see also the section on application programs)
Tools
Applications Menu for application program management: activates, clears, adds, changes and calls application
programs
Options
Auto Editor Act. Automatic activation of the editor when opening the BEST source file.
Save Configur. Stores the current BestBoard configuration when you quit BestBoard (file BESTBD.INI or
BESTBRD.INI in the Windows directory)
Window
Default Sets the default position and size of the BestBoard main window
Always On Top Turns on/off the option of always positioning BestBoard in the desktop foreground
Help
EDIABAS BEST Developer's Guide > BEST User Manual > 5. BEST Tools > 5.2. BestBoard
5.2.3. Toolbar
The Toolbar is intended to simplify the selection of the main menu options. Hitting a button in the Toolbar selects only the
corresponding menu.
"Pressed" buttons indicate that an action has started (e.g. Compiler running).
EDIABAS BEST Developer's Guide > BEST User Manual > 5. BEST Tools > 5.2. BestBoard
In BestBoard it is possible to integrate any desired programs that you need to develop or test description files. BestBoard can manage
several application programs simultaneously. BestBoard always starts the active application program. The active application program
is the application program selected in the TOOLS/APPLICATIONS menu.
The name and the command line must be entered for each application program. If you wish you can also specify the working
directory in which the application program is started.
file:///C:/Users/sgtma/AppData/Local/Temp/~hhF948.htm 7/16/2020
EDIABAS BEST Developer's Guide Page 33 of 161
Various replacements can be entered on the command line (e.g. current object file, current ECU directory etc.).
N.B.:
Application programs can only be called when a description file is opened/generated in BestBoard.
EDIABAS BEST Developer's Guide > BEST User Manual > 5. BEST Tools > 5.2. BestBoard
• If source file does not yet exist: File/New menu or Toolbar button
Correct source file in the Editor (is started automatically), the relevant line number and the error message are output in the
BestBoard working area. You can switch to the other error messages with the Project/Next Error and Project/Previous
Error menus. An audible warning tone and an empty working area signal the end of the error list.
Start Editor with Project/Edit or Toolbar button and edit source file, then repeat 2.
EDIABAS BEST Developer's Guide > BEST User Manual > 5. BEST Tools
5.3. BestView
More:
file:///C:/Users/sgtma/AppData/Local/Temp/~hhF948.htm 7/16/2020
EDIABAS BEST Developer's Guide Page 34 of 161
5.3.9. Menus
EDIABAS BEST Developer's Guide > BEST User Manual > 5. BEST Tools > 5.3. BestView
BestView is a Source Level Debugger for testing SGBD's written in BEST/2. These files must exist both as source code and as object
files. Alternatively, object or BEST/1 files can be tested but without the source code debugging facility.
With BestView you can run jobs line by line and view variables and analyze the job results during the run.
You can get detailed explanations of all the user operations and the BestView call parameters by selecting the "Contents" option from
the "Help" menu.
EDIABAS BEST Developer's Guide > BEST User Manual > 5. BEST Tools > 5.3. BestView
BestView for WIN32 has a new user interface different from the WIN16 version with new and altered workspaces:
More:
5.3.2.1. Toolbar
EDIABAS BEST Developer's Guide > BEST User Manual > 5. BEST Tools > 5.3. BestView > 5.3.2. User Interface
5.3.2.1. Toolbar
BestView now has a toolbar with buttons for the following functions:
· choosing SGBD
· choosing job
file:///C:/Users/sgtma/AppData/Local/Temp/~hhF948.htm 7/16/2020
EDIABAS BEST Developer's Guide Page 35 of 161
· starting/continuing job
· online help
The toolbar is implemented as a docking window and can also be positioned outside the BestView workspace.
EDIABAS BEST Developer's Guide > BEST User Manual > 5. BEST Tools > 5.3. BestView > 5.3.2. User Interface
In the status bar, BestView displays additional information. On the right side, an active simulation and/or IFH trace is indicated.
If the source, IFH and result windows are active, the current position within the window (row, column) is also displayed in the
status bar.
EDIABAS BEST Developer's Guide > BEST User Manual > 5. BEST Tools > 5.3. BestView > 5.3.2. User Interface
The Project Window provides information on the content of the currently loaded description file. The folder "Source Files" lists all
source files involved in the compilation process (B2V file + Include files). The "Jobs" folder contains all jobs available in the
description file (except virtual jobs and jobs in basic files).
By clicking once on an entry in the Project Window, it is possible to display the corresponding source file or the first instruction of
the corresponding job in the Source Window, respectively.
A double-click on a job within the Project Window will open the job selection dialog, unless this job is one of the jobs last started
(see chapter Menu Run-Job). In this case, a double-click will start the job immediately.
The Project Window can be used as a miniature window or as a docking window (see fig.). As a miniature window, it can also be
positioned outside the BestView workspace without changing it. As a docking window, it can dock with the left, right, top or
bottom part of the BestView workspace; the size of the BestView workspace decreases accordingly. It is possible to switch
between miniature and docking window representation by double-clicking on the frame of the Project Window. A new docking
position can be selected by simply drawing the Project Window to the desired position on the BestView frame.
The width and height of a "docked" Project Window are determined by the size of the Project Window in miniature window
representation. For changing the size of the "docked" Project Window, you have to change to the miniature window display, alter
the window size and then change back to the docking display.
EDIABAS BEST Developer's Guide > BEST User Manual > 5. BEST Tools > 5.3. BestView > 5.3.2. User Interface
In the Source Code Window, the source code of the SGBD is displayed. Here, breakpoints (with brown background) can be set.
The line to be executed during the next program step has a yellow background.
file:///C:/Users/sgtma/AppData/Local/Temp/~hhF948.htm 7/16/2020
EDIABAS BEST Developer's Guide Page 36 of 161
EDIABAS BEST Developer's Guide > BEST User Manual > 5. BEST Tools > 5.3. BestView > 5.3.2. User Interface
EDIABAS BEST Developer's Guide > BEST User Manual > 5. BEST Tools > 5.3. BestView > 5.3.2. User Interface
EDIABAS BEST Developer's Guide > BEST User Manual > 5. BEST Tools > 5.3. BestView > 5.3.2. User Interface
In the IFH Trace Window, the content of the IFH trace file is displayed. After each job execution and each job interruption (e.g.
after Run-Step), the Trace Window is automatically updated.
EDIABAS BEST Developer's Guide > BEST User Manual > 5. BEST Tools > 5.3. BestView
Description files can be selected with the ”File Open“ menu. BEST/2 source files (with the ending .B2V or .B2G) can be opened
as well as BEST/1 source files (with the ending .B1V or .B1G) and executable object files (with the ending .PRG or .GRP). A
description file can also be opened by drag&drop; the file must be dragged from the Explorer to the workspace of BestView.
Debugging is possible only if a BEST/2 source file is opened. With a BEST/1 source file or an object file, the jobs can only be
executed.
If a source file is selected, BestView searches the corresponding object file in the directory selected with ”ECU-Directory“. If you
do not want this, you can set the ”ECU-Directory“ option to '.' In this case, BestView searches the object file in the directory of
the source file. Changing the ECU directory is only possible if no description file is loaded in BestView.
If an object file is selected, BestView behaves like the normal EDIABAS runtime system. If a group is selected, the job
IDENTIFIKATION in the group file is executed automatically; then the selected job in the variant file determined in this manner
is executed. In case of source file selection, a group description file behaves in the same way as a variant description file, i.e. the
IDENTIFIKATION job has no particular significance and can be examined at any time.
When a description file is opened, it is displayed in a Source Window; if, on the other hand, an object file is selected, only a
minimized Object Window is displayed. A description file can be based on several BEST/2 source files (modules). With the ”File
View“ menu, it is possible to switch between the different modules.
BestView permits automatic opening of a Project Window displaying all jobs and BEST/2 source files (modules) of the loaded
description file. The Project Window can be used as a miniature or a docking window. With the miniature display, the Project
Window can be positioned in any part of the window desktop without influencing the workspace of BestView. With the docking
window display, the workspace of BestView is automatically reduced in size depending on the docking position (left, right, top or
bottom). By double-clicking on the Project Window frame, it is possible to switch between the miniature and the docking display.
With the ”Window Project“ menu, the Project Window display can be switched on or off.
The linkage of the debugger with a description file is maintained until the file is closed with the ”File Close“ menu, the
Description File Window is closed or a new description file is selected.
If a description file consists of several modules (the B2V file opened with File Open + Include files), the same search algorithm is
used for the Include file search as with the BEST/2 Compiler:
For #include instructions with absolute or relative paths, BestView only searches the indicated paths for the relevant
Include file. In case of relative paths, the path always refers to the directory of the B2V file opened with “File
Open“ (source directory).
In case of #include instructions without indication of path, BestView first searches the directory of the B2V file opened
file:///C:/Users/sgtma/AppData/Local/Temp/~hhF948.htm 7/16/2020
EDIABAS BEST Developer's Guide Page 37 of 161
with ”File Open“ for the corresponding Include file. With the ”Options Include-Path“ menu, the search can be extended to other
directories.
EDIABAS BEST Developer's Guide > BEST User Manual > 5. BEST Tools > 5.3. BestView
Changing a description file without leaving the debugger makes it necessary to update the description file.
This is done easily by again selecting the loaded description file with the “File Open“ menu.
Choose the file already indicated by default.
EDIABAS BEST Developer's Guide > BEST User Manual > 5. BEST Tools > 5.3. BestView
Selection of a job is performed by the ”Run Job“ menu. All jobs of the selected description file are displayed. The job
INITIALISIERUNG can be selected as well. In group description files, selection of the job IDENTIFIKATION is also possible.
If a group description file is opened as object file, the entered job name refers to the variant file and not to the group file.
The job to be executed can be configured by the following entries:
Job Parameters
The data entered here will later be passed to the job to be executed. With the ”String“ setting, the job parameters are
passed to the job unchanged. With the ”Data“ setting, the job parameters are converted into a binary data stream before job
execution and then passed to the job.
Binary data entry requires the following syntax:
hex,hex,hex,...
As an alternative to the direct entry of binary data, the job can also be provided with binary data specified in a separate text
file. If @<text file name> is indicated, the text file will be read in during job execution, converted into a binary data stream
and then be passed to the job. For this purpose, the text file must have the following format:
hex,hex,hex,hex,hex,hex,hex,hex
hex,hex,...
file:///C:/Users/sgtma/AppData/Local/Temp/~hhF948.htm 7/16/2020
EDIABAS BEST Developer's Guide Page 38 of 161
Job Results
Here, the results to be generated by the job can be selected. This functionality must be supported by the description file.
If nothing is entered in this input field, all results are generated.
EDIABAS BEST Developer's Guide > BEST User Manual > 5. BEST Tools > 5.3. BestView
Breakpoints are set in the Source Window. For this purpose, the cursor is placed on the line in the Source Window in which the
breakpoint is supposed to appear.
With the F9 key, the breakpoint in this line is activated. The line color changes. By pressing F9 again, the breakpoint is
deactivated.
Breakpoints can also be set and deleted with the mouse. To do this, place the mouse pointer on the desired line. A double-click
with the left mouse button will activate or deactivate the breakpoint in this line, respectively.
With the menu item ”Debug Clear Breakpoints“, all breakpoints are deleted.
EDIABAS BEST Developer's Guide > BEST User Manual > 5. BEST Tools > 5.3. BestView
file:///C:/Users/sgtma/AppData/Local/Temp/~hhF948.htm 7/16/2020
EDIABAS BEST Developer's Guide Page 39 of 161
Variables, results and parameters can be displayed with the menu item ”Debug Show Data“.
A dialog box appears in which the kind of data to be displayed can be selected. For the results, the desired set must be selected in
addition to the name.
All data are displayed as values and as binary data. The display format of the value can be adapted according to the requirements.
If the displayed value is a variable, it can be changed from the dialog box by a click on the Modify button or by means of the menu
item ”Debug Modify Variable“ in a separate dialog box.
During debugging, a variable can be continuously monitored in a separate window. For this purpose, it must be included in the
watch list with the menu item ”Debug Watch Variable“. It can also be removed from there.
If the mouse points to a variable or a parameter in the Source Window, the variable and parameter are automatically displayed.
Data variables are shown in hexadecimal form; the display is limited to max. 32 bytes.
EDIABAS BEST Developer's Guide > BEST User Manual > 5. BEST Tools > 5.3. BestView
Before the execution of a job, the description file is initialized if this was defined during job selection. For this purpose, the
EDIABAS runtime system is initialized and the INITIALISIERUNG job runs.
Go
The job runs until either a breakpoint or the end of the job are reached.
Step
Continue to Cursor
The job is executed down to the line where the cursor is located. If a breakpoint is set before the highlighted line, the job is
only executed to this breakpoint. It runs until either a breakpoint or the end of the job are reached.
In addition, it is possible to start a job by double-clicking on the corresponding job name in the Project Window. In case of an
unknown job configuration, the job selection dialog is displayed instead.
EDIABAS BEST Developer's Guide > BEST User Manual > 5. BEST Tools > 5.3. BestView
5.3.9. Menus
More:
file:///C:/Users/sgtma/AppData/Local/Temp/~hhF948.htm 7/16/2020
EDIABAS BEST Developer's Guide Page 40 of 161
EDIABAS BEST Developer's Guide > BEST User Manual > 5. BEST Tools > 5.3. BestView > 5.3.9. Menus
Open
Opens a description file. Both source files and object files can be opened. Debugging is possible only if a BEST/2 source file is
opened. With a BEST/1 source file or an object file, the jobs can only be executed.
If a source file is selected, the object file is searched according to the configured ECU directory. If this directory is supposed to be
always identical with the source file directory, the directory in the Options menu must be set to '.' If ”Use EDIABAS
Configuration“ is selected, the ECU directory from the EDIABAS configuration file (EDIABAS.INI) is used.
Close
Closing the loaded description file. The linkage of the debugger with the loaded description file is cleared.
As long as a description file is loaded, it may not be changed in an Editor. Opening a new description file and leaving BestView
will automatically close the currently loaded description file.
View
Selection of the module to be displayed. If a description file consists of several BEST/2 source files (modules), another module of
the description file can be displayed in this manner.
The module to be displayed can also be selected via the Project Window.
Exit
Leaving BestView.
EDIABAS BEST Developer's Guide > BEST User Manual > 5. BEST Tools > 5.3. BestView > 5.3.9. Menus
Copy
Select All
Find
Searching a text in the active window. If the option ”Match Uppercase/Lowercase“ is activated, the case of character of the
searched text must be matched precisely.
Find Next
Goto Line
Goes to a specific text line. By entering the desired line number, it is possible to go to the corresponding text line in the source
file.
file:///C:/Users/sgtma/AppData/Local/Temp/~hhF948.htm 7/16/2020
EDIABAS BEST Developer's Guide Page 41 of 161
EDIABAS BEST Developer's Guide > BEST User Manual > 5. BEST Tools > 5.3. BestView > 5.3.9. Menus
Job
Selection of the job to be executed. All jobs within the description file can be selected. In addition, the job parameters and desired
results can be indicated. With the ”Go“ button, the jobs can be started immediately.
Go
Start or restart of job processing. The job is executed until either a breakpoint or the end of the job is reached.
Continue to Cursor
Start or restart of job processing. The job is executed down to the line where the cursor is located. If a breakpoint is set before the
highlighted line, the job is only executed to this breakpoint. It runs until either a breakpoint or the end of the job is reached.
Step
Restart
EDIABAS BEST Developer's Guide > BEST User Manual > 5. BEST Tools > 5.3. BestView > 5.3.9. Menus
Toggle Breakpoint
Setting or deleting a breakpoint. If no breakpoint is set in the current line, it is set now; otherwise, it is deleted.
The same can be achieved by double-clicking with the left mouse button on the corresponding line.
Clear Breakpoints
Show Data
Display of a variable, a parameter or a result. A dialog box is displayed where the values of all currently valid variables,
parameters or results and their binary representation can be displayed.
Modify Variable
Display and modification of a variable. All variables which are currently valid can be displayed and changed. A dialog box
appears which contains the variable value and its binary representation.
The value of single variables (no arrays) can be displayed in decimal, hexadecimal or ASCII representation.
The variable value can be changed in all three kinds of representation. By pressing the Update key, the binary display is updated.
The variable can also be changed in binary representation; the display format, however, must be observed.
file:///C:/Users/sgtma/AppData/Local/Temp/~hhF948.htm 7/16/2020
EDIABAS BEST Developer's Guide Page 42 of 161
Watch Variable
Monitoring of a variable. The values of selected variables are displayed in a separate Watch window and updated continuously, i.e.
after each step.
EDIABAS BEST Developer's Guide > BEST User Manual > 5. BEST Tools > 5.3. BestView > 5.3.9. Menus
ECU Directory
Here, the directory can be set where the debugger searches the object files. If the debugger is to search the Source Directory, ”.“
must be entered.
If the option ”Use EDIABAS Configuration“ is activated, the ECU Directory selected via the EDIABAS configuration file
EDIABAS.INI is used.
Include Path
Here, additional directories can be indicated where BestView searches Include files. Directories must be separated by ”:“. The
search always begins in the directory of the BEST/2 source file opened with “File Open”. Subsequently, the Include path is
searched from left to right.
For #include instructions with absolute or relative paths, the Include path is not taken into account.
Device
ECU Simulation
Here, the ECU simulation can be switched on or off; the EDIABAS configuration file EDIABAS.INI remains unchanged. In the
status bar, an active ECU simulation is indicated.
IFH Trace
Here, the IFH trace level can be entered and the IFH trace switched on or off, accordingly. The EDIABAS configuration file
EDIABAS.INI remains unchanged. In the status bar, an active IFH trace is indicated.
The IFH trace can be displayed via the menu ”Window IFH Trace“.
With the ”Delete File“ button, the IFH trace file can be deleted.
If this option is active, the “Run Job” menu will automatically be executed after opening of a description file.
EDIABAS BEST Developer's Guide > BEST User Manual > 5. BEST Tools > 5.3. BestView > 5.3.9. Menus
Project
Watch
IFH Trace
file:///C:/Users/sgtma/AppData/Local/Temp/~hhF948.htm 7/16/2020
EDIABAS BEST Developer's Guide Page 43 of 161
Cascade
Tile Horizontally
Symmetrical horizontal arrangement of all windows with the exception of minimized windows.
Tile Vertically
Symmetrical vertical arrangement of all windows with the exception of minimized windows.
Arrange Icons
EDIABAS BEST Developer's Guide > BEST User Manual > 5. BEST Tools > 5.3. BestView > 5.3.9. Menus
Contents
Index
About
file:///C:/Users/sgtma/AppData/Local/Temp/~hhF948.htm 7/16/2020
EDIABAS BEST Developer's Guide Page 44 of 161
B. REFERENCES
[1] EDIABAS: BEST/2 Function Primer
file:///C:/Users/sgtma/AppData/Local/Temp/~hhF948.htm 7/16/2020
EDIABAS BEST Developer's Guide Page 45 of 161
1. Introduction to BEST/2
2. Text conventions
3. Conversions
4. Expressions
5. Declarations
6. Statements
7. Global declarations
8. Areas of application
9. Runtime library
1. Introduction to BEST/2
BEST is the acronym for 'BEschreibungssprache für STeuergeräte' (description language for control units). In EDIABAS this
description language is used to meet the requirement for an application-independent description facility. During the program
runtime the system loads and interprets description files in which information about the control units such as addresses and
conversions is hidden (encapsuling). BEST/2 description language therefore provides the means to convert data stored in the
control units into control unit independent values such as engine speed or control unit number. Only data actually required by the
application is downloaded (information hiding).
A language with a syntax based on assembler language, BEST/1, already exists for this purpose. However although BEST/1 is
good for test purposes and simple programming it is difficult to read and understand.
The more readable BEST/2 language was developed based on C language to resolve these problems. C was chosen because it is in
widespread use, is structured and contains only a few language elements that are easy to learn.
BEST/2 is a problem-oriented language, with special functions that are called by library functions. The only exception to this rule
is the result manager which is a fundamental part of the language definition.
There are no storage definitions because the virtual processor used with BEST/2 has no memory apart from the stack that is
already available in the processor.
2. Text conventions
There are seven classes of word: names, reserved words, constants, strings, lists, operator and other separators. Blanks, tabs, line
separators and comments are classed as spaces and ignored apart from the fact that they are needed to separate adjacent names,
constants and reserved words.
More:
2.1. Comments
2.2. Names
file:///C:/Users/sgtma/AppData/Local/Temp/~hhF948.htm 7/16/2020
EDIABAS BEST Developer's Guide Page 46 of 161
2.4. Constants
2.5. Sizes
EDIABAS BEST Developer's Guide > BEST/2 Language Description > 2. Text conventions
2.1. Comments
A comment starts with the characters /* and ends with the characters */. Comments that start with the characters // end at the end
of the line. Comments by /* */ cannot be nested.
EDIABAS BEST Developer's Guide > BEST/2 Language Description > 2. Text conventions
2.2. Names
A name consists of a sequence of letters and digits; the first character must be a letter. The underscore character _ counts as a
letter. There is case sensitivity. The first 32 characters are used to distinguish names, but they may also be longer.
EDIABAS BEST Developer's Guide > BEST/2 Language Description > 2. Text conventions
The following words are reserved and can only be used with their predefined meaning:
EDIABAS BEST Developer's Guide > BEST/2 Language Description > 2. Text conventions
2.4. Constants
There is a whole range of constants and they are described in this section. Section 2.5 describes the properties of the virtual
processor that affects the size of the constants. All constants are Long Constants.
More:
file:///C:/Users/sgtma/AppData/Local/Temp/~hhF948.htm 7/16/2020
EDIABAS BEST Developer's Guide Page 47 of 161
EDIABAS BEST Developer's Guide > BEST/2 Language Description > 2. Text conventions > 2.4. Constants
An integer constant consists of a string of digits. Its type is int and it is usually interpreted decimally.
If the string starts with the sequence 0x or 0X it is interpreted hexadecimally, i.e. in base 16, and the letters a (or A) to f (or F)
count as hexadecimal digits with the decimal values 10 to 15.
If the string starts with the sequence 0y or 0Y it is interpreted binary, i.e. in base 2, and only digits 1 and 0 are used.
EDIABAS BEST Developer's Guide > BEST/2 Language Description > 2. Text conventions > 2.4. Constants
A character in single quotes, e.g. 'x', is a char constant and its value is the value of the character in the ASCII character set.
EDIABAS BEST Developer's Guide > BEST/2 Language Description > 2. Text conventions > 2.4. Constants
A string is a sequence of characters in double quotes, i.e. "...". A string ends with the character 0.
EDIABAS BEST Developer's Guide > BEST/2 Language Description > 2. Text conventions > 2.4. Constants
A list is a sequence of other constants (not lists) separated by , and enclosed in { and }. Strings in lists do not end with 0. The
length of the list carried over.
EDIABAS BEST Developer's Guide > BEST/2 Language Description > 2. Text conventions
2.5. Sizes
int 16 Bit
long 32 Bit
real 64 Bit
char[] max. 1023 bis 65535 Byte, default = max. 1023 bytes
int[] max. 1023 bytes
long[] max. 1023 bytes
EDIABAS BEST Developer's Guide > BEST/2 Language Description > 2. Text conventions
The following rules apply when describing the grammar: "I" separates alternatives, "[" and "]" enclose optional parts, "{" and "}"
enclose optional parts that can be specified more than once, and ";" terminates a rule.
EDIABAS BEST Developer's Guide > BEST/2 Language Description > 2. Text conventions
A name is an object known to the compiler by its type and memory location.
file:///C:/Users/sgtma/AppData/Local/Temp/~hhF948.htm 7/16/2020
EDIABAS BEST Developer's Guide Page 48 of 161
EDIABAS BEST Developer's Guide > BEST/2 Language Description > 2. Text conventions
An object is a storage area that can be modified. An L value is an expression that describes an object. A name is a simple example
of an L value expression. The term L value recalls the assignment E1=E2 in which the left operand must be an L value expression.
3. Conversions
More:
EDIABAS BEST Developer's Guide > BEST/2 Language Description > 3. Conversions
char, int and long can be used wherever an integer object is needed. The values are converted to integer values. A char, int or
long value has a sign that is retained when converted to longer integer values.
EDIABAS BEST Developer's Guide > BEST/2 Language Description > 3. Conversions
When an unsigned value and a regular value are combined the regular value is converted to an unsigned value and the result is also
unsigned. A short unsigned value is converted into a regular value by adding zero bits as the most significant bits.
EDIABAS BEST Developer's Guide > BEST/2 Language Description > 3. Conversions
If one of the operands is unsigned then the other is also changed to unsigned, and this then also becomes the type of the result.
Otherwise, both operands are long values and the result is also a long value.
4. Expressions
This section describes the operators for expressions. For simple expressions and unary operations the manual states whether they
return L values. The other operators do not return L values.
The following sections are arranged in descending order of priority of the operators; all the operators in a section have equal
priority. The associativity of the operators is given in each section (invisible bracketing).
NOTE: Operators cannot be used with real values since this will lead to undefined results! Real values can only be
processed with the corresponding BEST/2 functions.
file:///C:/Users/sgtma/AppData/Local/Temp/~hhF948.htm 7/16/2020
EDIABAS BEST Developer's Guide Page 49 of 161
More:
4.6. Comparisons
4.13. Assignments
EDIABAS BEST Developer's Guide > BEST/2 Language Description > 4. Expressions
Simple expressions are references to objects and constants, the index operation and function calls. These operations are left-
associative.
primary:
identifier
| constant integer
| constant array
| (expression )
| primary ( [argument-list] )
| primary [ expression ]
;
argument-list:
assignment { , assignment }
;
A name is a simple expression provided it has been suitably declared. Most names are L values. The name type is usually given by
the declaration. A constant is an L value. Constant arrays always return 1. Identifiers return their value. Arrays always returns the
value 1 unless they are assigned to arrays. Names of job results return 1 if the result was requested, otherwise 0. Names of job
parameters return 1 if they were specified, otherwise 0.
EDIABAS BEST Developer's Guide > BEST/2 Language Description > 4. Expressions
unary:
file:///C:/Users/sgtma/AppData/Local/Temp/~hhF948.htm 7/16/2020
EDIABAS BEST Developer's Guide Page 50 of 161
primary
| primary ++
| primary --
| - primary
| ! primary
| ~ primary
| ++ primary
| -- primary
| exist identifier
| sizeof unary
| sizeof (type-specifikation)
;
The ! operator for logic negation returns 1 for an operand with the value 0 and 0 for all other operands. The result is the long type.
The ++ and -- operands (sic) modify their operands by adding or subtracting 1. The operand must be an L value. The result is not
an L value.
The expression ++E is equivalent to E+=1, so the result is the new value of the operand after 1 is added.
The expression --E is equivalent to E-=1, so the result is the new value of the operand after 1 is subtracted.
The expression E++ returns the same value of operand E, i.e. the original value of the object that the L value E describes. 1 is
added to the object itself.
The expression E-- returns the same value of operand E, i.e. the original value of the object that the L value E describes. 1 is
subtracted from the object itself.
The sizeof operator returns the size of its operand measured in bytes.
The exist operator returns <>0 (TRUE) or 0 (FALSE) depending on whether the specified identifier is available or not. This is
always TRUE for all variables, constants and result names but only for job arguments when they were defined when the job was
called.
EDIABAS BEST Developer's Guide > BEST/2 Language Description > 4. Expressions
The operators *,/ and % for multiplication and division are left associative. The usual arithmetic conversions are used.
multiplication:
unary
| multiplication * unary
| multiplication / unary
| multiplication % unary
;
The binary operator / designates division. When positive values are divided it breaks off towards 0. Otherwise it breaks off towards
the most negative number.
The binary operator % returns the remainder after dividing its two operators.
EDIABAS BEST Developer's Guide > BEST/2 Language Description > 4. Expressions
The operators + and - for multiplication and division are left associative. The usual arithmetic conversions are used.
file:///C:/Users/sgtma/AppData/Local/Temp/~hhF948.htm 7/16/2020
EDIABAS BEST Developer's Guide Page 51 of 161
addition:
multiplication
| addition + multiplication
| addition - mutliplication
;
The + operator returns the sum of its operands. It is commutative and associative.
EDIABAS BEST Developer's Guide > BEST/2 Language Description > 4. Expressions
The shift operators << and >> are left associative. The usual arithmetic conversions are used. The right operand is converted into
an unsigned value.
shift:
addition
| shift << addition
| shift >> addition
;
The value of E1<<E2 is the bit pattern of E1 shifted E2 bits to the left.
The value of E1>>E2 is the bit pattern of E1 shifted E2 bits to the right. If E1 unsigned then bits with the value 0 are inserted. If
E1 is a regular value then bits are inserted according to its bit sign.
EDIABAS BEST Developer's Guide > BEST/2 Language Description > 4. Expressions
4.6. Comparisons
comparison:
shift
| comparison < shift
| comparison <= shift
| comparison > shift
| comparison >= shift
;
The comparison operators return the long value 0 if the specified relation is false and 1 when the relation exists. The usual
arithmetic conversions are used.
EDIABAS BEST Developer's Guide > BEST/2 Language Description > 4. Expressions
The operators == and != behave in the same way as the other comparison operators but have a lower priority.
equality:
comparison
| equality == comaprison
| equality != comparison
;
EDIABAS BEST Developer's Guide > BEST/2 Language Description > 4. Expressions
file:///C:/Users/sgtma/AppData/Local/Temp/~hhF948.htm 7/16/2020
EDIABAS BEST Developer's Guide Page 52 of 161
bit-and:
equality { & equality }
;
The & operator is commutative and associative. The usual arithmetic conversions are used.
EDIABAS BEST Developer's Guide > BEST/2 Language Description > 4. Expressions
bit-exclusive-or:
bit-and { ^ bit-and }
;
The ^ operator is commutative and associative. The usual arithmetic conversions are used.
EDIABAS BEST Developer's Guide > BEST/2 Language Description > 4. Expressions
bit-or:
bit-exclusive-or { | bit-exclusive-or }
;
The | operator is commutative and associative. The usual arithmetic conversions are used.
EDIABAS BEST Developer's Guide > BEST/2 Language Description > 4. Expressions
andif:
bit-or { && bit-or }
;
The && operator is left associative. The result is 1 when both operators are not 0, otherwise the result is 0. The right operand is
only evaluated when the left is not 0.
EDIABAS BEST Developer's Guide > BEST/2 Language Description > 4. Expressions
binary:
andif { || andif }
;
The || operator is left associative. The result is 0 when both operators are 0, otherwise the result is 1. The right operand is only
evaluated when the left is 0.
EDIABAS BEST Developer's Guide > BEST/2 Language Description > 4. Expressions
4.13. Assignments
Assignment operators are right associative. The left operand must always be an L value. The type of the result is always the type of
the left operand. An assignment operation returns the value in the left operand as the result.
assignment:
binary
| unary = assignment
| unary *= assignment
| unary /= assignment
file:///C:/Users/sgtma/AppData/Local/Temp/~hhF948.htm 7/16/2020
EDIABAS BEST Developer's Guide Page 53 of 161
| unary %= assignment
| unary += assignment
| unary -= assignment
| unary &= assignment
| unary ^= assignment
| unary |= assignment
;
With simple assignment the value of the right operand replaces the value of the object which designates the left operand. Before
assignment the right operand is converted to the type of the left operand.
The value of the assignment in the form E1 op= E2 can be derived from the assignment E1 = E1 op (E2). E1 is only evaluated
once however.
EDIABAS BEST Developer's Guide > BEST/2 Language Description > 4. Expressions
expression:
assignment {, assignment}
;
Two expressions separated by a comma are evaluated left to right. The type and value of the result are the type and value of the
right expression. This operation is left associative.
5. Declarations
Declarations define how BEST/2 interprets the individual names entered by the user. They take the following form:
declaration:
type-name initialized-declarator-list ;
| real identifier ;
;
Definitions reserve storage space (register) and contain information for the type of a list of declarators. The declarators contain the
names that are declared, possibly together with initializers.
More:
5.2. Declarators
5.3. Initializers
EDIABAS BEST Developer's Guide > BEST/2 Language Description > 5. Declarations
type-name:
[unsigned] int
| [unsigned] long
| [unsigned] char
;
file:///C:/Users/sgtma/AppData/Local/Temp/~hhF948.htm 7/16/2020
EDIABAS BEST Developer's Guide Page 54 of 161
extra-type-name:
data
string
real
;
EDIABAS BEST Developer's Guide > BEST/2 Language Description > 5. Declarations
5.2. Declarators
A declaration contains a list of declarators separated by commas. In data definitions an initializer can also be specified after each
declarator.
initialized-declarator-list:
declarator [ = initializer ]
;
declarator:
identifier { '[' ']' }
| ( declarator )
;
If a declarator is followed by a pair of square brackets then an array variable was declared.
EDIABAS BEST Developer's Guide > BEST/2 Language Description > 5. Declarations
5.3. Initializers
Data can also be initialized in a definition. Each initializer is preceded by the character = and followed by an expression.
initializer:
assignment
;
EDIABAS BEST Developer's Guide > BEST/2 Language Description > 5. Declarations
BEST/2 contains a number of predefined macros permitting the query of header definitions in BEST/2 jobs:
__AUTHOR__ author
__LANGUAGE__ language
In BEST/2 jobs, the macros are to be used like global string constants. If one of the optional header definitions is not available, the
macro will supply a null string.
file:///C:/Users/sgtma/AppData/Local/Temp/~hhF948.htm 7/16/2020
EDIABAS BEST Developer's Guide Page 55 of 161
6. Statements
Unless otherwise specifically stated, statements are executed sequentially.
statement:
statement-prefix statement
| [expression] ;
| compound-statement
| if ( expression ) statement
| if ( expression ) statement else statement
| do statement while ( expression ) ;
| break ;
| continue ;
| return ;
;
statement-prefix:
while ( expression )
| switch ( expression )
| case constant-integer :
| default :
;
More:
6.3. Blocks
EDIABAS BEST Developer's Guide > BEST/2 Language Description > 6. Statements
More:
6.1.1. #include
6.1.2. #define
6.1.3. #undef
6.1.5. #pragma
file:///C:/Users/sgtma/AppData/Local/Temp/~hhF948.htm 7/16/2020
EDIABAS BEST Developer's Guide Page 56 of 161
EDIABAS BEST Developer's Guide > BEST/2 Language Description > 6. Statements > 6.1. Compiler instructions
6.1.1. #include
With the #include instruction, additional BEST/2 source files can be entered in BEST/2 description files. A line
is replaced by the content of the desired file. If absolute and relative paths are indicated, DOS notation must be used.
If the indicated Include file name contains an absolute or relative path, the Include file must be located in the corresponding
directory. With relative paths, the path of the BEST/2 source file is used.
If the indicated Include file name contains no path, searching starts in the directory of the BEST/2 description file. With the
compiler, the search can be extended to other directories.
Behind the filename of an #include instruction only a comment is permitted. The comment has to end within the same line. A
comment over more than this line is not permitted.
EDIABAS BEST Developer's Guide > BEST/2 Language Description > 6. Statements > 6.1. Compiler instructions
6.1.2. #define
In BEST/2 description files, text replacements can be defined with the instruction #define. A line
causes the name to be replaced by the indicated text throughout the BEST/2 description file. It is possible to distribute a long
replacement text over several lines by placing the character \ at the end of the line. No text will be replaced within comments and
character strings.
The name is structured according to the rules for other BEST2 names.
Behind the text of an #define instruction only a comment is permitted. The comment has to end within the same line. A comment
over more than this line is not permitted.
EDIABAS BEST Developer's Guide > BEST/2 Language Description > 6. Statements > 6.1. Compiler instructions
6.1.3. #undef
In BEST/2 description files, previously performed #define definitions can be undone with the instruction
#undef identifier
Behind the identifier of an #undef instruction only a comment is permitted. The comment has to end within the same line. A
comment over more than this line is not permitted.
EDIABAS BEST Developer's Guide > BEST/2 Language Description > 6. Statements > 6.1. Compiler instructions
In BEST/2 description files, BEST/1 code can be entered. It will be inserted between the instructions #asm and #endasm.
#asm
BEST/1 code
#endasm
file:///C:/Users/sgtma/AppData/Local/Temp/~hhF948.htm 7/16/2020
EDIABAS BEST Developer's Guide Page 57 of 161
EDIABAS BEST Developer's Guide > BEST/2 Language Description > 6. Statements > 6.1. Compiler instructions
6.1.5. #pragma
With the #pragma instruction BEST/2 compiler features can be configured, and thus the resulting code and execution of the ECU
description file can be influenced at runtime.
More:
6.1.5.1. arraysize
6.1.5.2. best2_version
6.1.5.3. runtime_version
6.1.5.4. best2_type
EDIABAS BEST Developer's Guide > BEST/2 Language Description > 6. Statements > 6.1. Compiler instructions > 6.1.5.
#pragma
6.1.5.1. arraysize
The array size of a ECU description file can be preset using the pragma arraysize:
The pragma instruction must always be situated at the beginning of a line and never inside of comments, strings, tables and
constants.
The setting of the array size always refers to all arrays of a compiled ECU description file. In case of multiple and differing
definitions of the array size the greatest value will always be assumed within an ECU description file. The definition of array sizes
smaller than 1024 bytes or greater than 65536 bytes causes compiler errors.
Without setting of an array size the arrays of an ECU description file will be limited to 1024 Bytes.
The last data byte in Arrays can in principle not be addressed. This constraint is valid independently of the array size set by the
pragma arraysize.
The actually possible number of data bytes in ECU telegrams depends on the used interface and protocol.
EDIABAS BEST Developer's Guide > BEST/2 Language Description > 6. Statements > 6.1. Compiler instructions > 6.1.5.
#pragma
6.1.5.2. best2_version
The pragma best2_version sets the minimum BEST2 compiler version required for the compilation.
The BEST2 major/minor version number has to be passed in the high/low byte, e.g. for BEST2-Version 7.0.x:
The pragma instruction must always be situated at the beginning of a line and never inside of comments, strings, tables and
constants.
In case of multiple and differing definitions of the BEST2 minimum version the greatest value will always be assumed within an
ECU description file. The interpretation is done at compilation time. A compilation with a lower BEST2-Compilerversion will
cause a compiler error.
EDIABAS BEST Developer's Guide > BEST/2 Language Description > 6. Statements > 6.1. Compiler instructions > 6.1.5.
#pragma
file:///C:/Users/sgtma/AppData/Local/Temp/~hhF948.htm 7/16/2020
EDIABAS BEST Developer's Guide Page 58 of 161
6.1.5.3. runtime_version
The EDIABAS major/minor version number has to be passed in the high/low byte, e.g. for EDIABAS 6.10.x:
The pragma instruction must always be situated at the beginning of a line and never inside of comments, strings, tables and
constants.
In case of multiple and differing definitions of the EDIABAS minimum version the greatest value will always be assumed within
an ECU description file. The interpretation is done at runtime and may cause the EDIABAS error BIP-0009: BEST VERSION
ERROR.
EDIABAS BEST Developer's Guide > BEST/2 Language Description > 6. Statements > 6.1. Compiler instructions > 6.1.5.
#pragma
6.1.5.4. best2_type
The pragma best2_type sets the BEST2 compiler type needed for compilation.
For setting the BEST2 compiler type for Win32 the pre-defined type identifier win32 must be given:
The pragma instruction must always be situated at the beginning of a line and never inside of comments, strings, tables and
constants.
The interpretation is done at compilation time. A compilation with another BEST2 compiler type will cause a compiler error.
EDIABAS BEST Developer's Guide > BEST/2 Language Description > 6. Statements
The calculation of an expression is the most commonly used statement; it takes the following form:
expression ;
EDIABAS BEST Developer's Guide > BEST/2 Language Description > 6. Statements
6.3. Blocks
A number of statements are assembled in a block. A block can always be specified instead of a single statement.
compound-statement:
{ {declaration} {statement} }
;
A block can contain declarations. If a name that was previously entered is declared then the previous declaration is replaced for
that area of the block and restored at the end of the block. This does not apply to array variables which apply globally for all blocks
as soon as they are defined.
EDIABAS BEST Developer's Guide > BEST/2 Language Description > 6. Statements
file:///C:/Users/sgtma/AppData/Local/Temp/~hhF948.htm 7/16/2020
EDIABAS BEST Developer's Guide Page 59 of 161
if (expression)
statement
and
if (expression)
statement
else
statement
In both cases the expression is evaluated first. If the result is not 0, then the first dependent statement is executed. In the second
case the second dependent statement is executed when and only when the result is 0. Else is assigned to the next if.
EDIABAS BEST Developer's Guide > BEST/2 Language Description > 6. Statements
while(expression)
statement
The dependent statement is repeated for as long as the value of the expression is not 0. The expression is evaluated each time
before the dependent statement is executed.
EDIABAS BEST Developer's Guide > BEST/2 Language Description > 6. Statements
Do
statement
while(expression);
The dependent statement is repeated for as long as the value of the expression is not 0. The expression is evaluated each time after
the dependent statement is executed. That means, the statement is executed at least once.
EDIABAS BEST Developer's Guide > BEST/2 Language Description > 6. Statements
The switch statement ensures that the execution of the program is continued with one or more statements depending on the value
of an expression. The switch statement has the following form:
switch (expression)
statement;
The usual arithmetic conversions are used to evaluate the expression but the result must be an integer. The dependent statement is
typically a block. Each statement within the dependent statement can be preceded by any number of case labels:
case constant-integer:
Each of these constants can only occur once in a switch statement. A case label can also take the following form:
default :
To execute the switch statement the expression is evaluated and compared with all case constants. If a case constant is found that
has the same value as the expression, then the execution of the program is continued with the statement that follows the case label.
If no suitable case constant is found then execution is continued at a default case label if one exists.
file:///C:/Users/sgtma/AppData/Local/Temp/~hhF948.htm 7/16/2020
EDIABAS BEST Developer's Guide Page 60 of 161
EDIABAS BEST Developer's Guide > BEST/2 Language Description > 6. Statements
The
break;
EDIABAS BEST Developer's Guide > BEST/2 Language Description > 6. Statements
The
continue;
statement must be dependent on a do- or while- statement. It ensures that the execution of a program is continued from the point
where the repeat of the nearest statement is decided.
EDIABAS BEST Developer's Guide > BEST/2 Language Description > 6. Statements
If a job was called, the return statement within the job assures that exit is made from the job again. A string variable or string
constant can be specified along in the return statement. The runtime system assigns this value to the result JOBSTATUS in result
record 0. The return statement syntax is shown below:
7. Global declarations
A BEST/2 description file consists of a header and a sequence of jobs:
program:
header
{ declaration }
job
More:
7.1. Header
7.2. Jobs
EDIABAS BEST Developer's Guide > BEST/2 Language Description > 7. Global declarations
7.1. Header
header:
ecu : string;
origin : string;
revision : string;
author : string;
language : string;
file:///C:/Users/sgtma/AppData/Local/Temp/~hhF948.htm 7/16/2020
EDIABAS BEST Developer's Guide Page 61 of 161
uses : string;
comment : string;
revision specifies the version as numeric pair separated by a dot.(e.g. 1.0). Both numbers has to be within the range 0-65535.
comment specifies a user comment, whereby several comment lines may be specified.
The header definitions can be queried in the BEST/2 jobs of the corresponding description file by means of PREDEFINED
MACROS.
EDIABAS BEST Developer's Guide > BEST/2 Language Description > 7. Global declarations
7.2. Jobs
job:
job-header compound-statement
job-header:
job ( name : identifier ;
{ comment : string ; }
{[ argument : identifier ;
type : type-name | extra-type-name ;
{ comment : string ; } ]}
{[ result : identifier ;
type : type-name | extra-type-name ;
range : value |string ;
defrslt : value |string ;
{ comment : string ; } ]}
)
The job header defines the name of the job, the call parameters and possible results. The parameters are declarations with possible
initializers. These initializers are then evaluated as default results or call parameters. The declaration of default results is optional.
8. Areas of application
Global declarations apply to all jobs within the description file. These global declarations declare constants! These cannot be
modified!
Otherwise declarations only apply to the block in which they are described.
9. Runtime library
The runtime library provides functions for communication, string handling, error handling etc. The runtime library functions are
written in BEST/1 so cannot be created by the user himself.
file:///C:/Users/sgtma/AppData/Local/Temp/~hhF948.htm 7/16/2020
EDIABAS BEST Developer's Guide Page 62 of 161
1. Revision history
2. Introduction
3. Overview
4. Clamp states
5. Library functions
LIST OF REFERENCES
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 6c New function: tabsetext.
Version 6d Revised for EDIABAS V6.4.4
Version 7a Corrected get_error2.
New function enableClampHandling, Corrected waitex.
Changes in function waitex for EDIABAS V6.5.0.
New functions open_channel, close_channel, closeall_channel, switch_channel, send, receive for
EDIABAS V6.9.0.
Revision for EDIABAS V7.0.0.
New functions tabcolumns, tabrows.
Version 7b Generalization of various functions regarding EDIC interface.
Version 7c Revised for EDIABAS V7.2.0,
Enhanced description of set_communication_pars
Version 7d Revised for EDIABAS V7.2.0
2. Introduction
More:
2.2. Conventions
file:///C:/Users/sgtma/AppData/Local/Temp/~hhF948.htm 7/16/2020
EDIABAS BEST Developer's Guide Page 63 of 161
EDIABAS BEST Developer's Guide > BEST/2 Function Primer > 2. Introduction
The runtime library provides functions for control unit communication, string handling and error handling for use in BEST/2
description files. These functions provide
This runtime library is very important because it provides facilities which the rudimentary BEST/2 language does not have.
EDIABAS BEST Developer's Guide > BEST/2 Function Primer > 2. Introduction
2.2. Conventions
Example Description
SAMPLE.B2V 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.
.}
[1] Reference to a document in References.
EDIABAS BEST Developer's Guide > BEST/2 Function Primer > 2. Introduction
The job INITIALISIERUNG (initialize) that is needed for correct operation has been omitted from all the examples in this
file:///C:/Users/sgtma/AppData/Local/Temp/~hhF948.htm 7/16/2020
EDIABAS BEST Developer's Guide Page 64 of 161
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.
3. Overview
More:
EDIABAS BEST Developer's Guide > BEST/2 Function Primer > 3. Overview
More:
EDIABAS BEST Developer's Guide > BEST/2 Function Primer > 3. Overview > 3.1. Using the runtime library
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:
char buffer[];
...
getasciidate(buffer);
This job identifies the current date by means of the getasciidate function and writes it to the variable buffer.
EDIABAS BEST Developer's Guide > BEST/2 Function Primer > 3. Overview > 3.1. Using the runtime library
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.
file:///C:/Users/sgtma/AppData/Local/Temp/~hhF948.htm 7/16/2020
EDIABAS BEST Developer's Guide Page 65 of 161
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.
EDIABAS BEST Developer's Guide > BEST/2 Function Primer > 3. Overview
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.
• Communication functions
• Interface functions
• Result / parameter management
• String functions
• Conversion functions
• Data functions
• File functions
• Error handling
• Time handling
• Table handling
• Configuration
• Functions specific to the ECU
• Plugin functions
More:
3.2.13. Configuration
file:///C:/Users/sgtma/AppData/Local/Temp/~hhF948.htm 7/16/2020
EDIABAS BEST Developer's Guide Page 66 of 161
EDIABAS BEST Developer's Guide > BEST/2 Function Primer > 3. Overview > 3.2. Functions of the runtime library by
categories
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
open_channel Opens an interface channel
close_channel Closes an interface channel
closeall_channel Closes all interface channels
switch_channel Switches the current interface channel
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
EDIABAS BEST Developer's Guide > BEST/2 Function Primer > 3. Overview > 3.2. Functions of the runtime library by
categories
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
ifrecv For debugging only
ifinfo For debugging only
ifinfoExt For debugging only
EDIABAS BEST Developer's Guide > BEST/2 Function Primer > 3. Overview > 3.2. Functions of the runtime library by
categories
file:///C:/Users/sgtma/AppData/Local/Temp/~hhF948.htm 7/16/2020
EDIABAS BEST Developer's Guide Page 67 of 161
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
EDIABAS BEST Developer's Guide > BEST/2 Function Primer > 3. Overview > 3.2. Functions of the runtime library by
categories
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
strrevers Reverses a string
EDIABAS BEST Developer's Guide > BEST/2 Function Primer > 3. Overview > 3.2. Functions of the runtime library by
categories
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
file:///C:/Users/sgtma/AppData/Local/Temp/~hhF948.htm 7/16/2020
EDIABAS BEST Developer's Guide Page 68 of 161
EDIABAS BEST Developer's Guide > BEST/2 Function Primer > 3. Overview > 3.2. Functions of the runtime library by
categories
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
real_to_data Converts a real number into data bytes
EDIABAS BEST Developer's Guide > BEST/2 Function Primer > 3. Overview > 3.2. Functions of the runtime library by
categories
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
EDIABAS BEST Developer's Guide > BEST/2 Function Primer > 3. Overview > 3.2. Functions of the runtime library by
categories
Function Purpose
fopen Opens a file
fclose Closes a file
file:///C:/Users/sgtma/AppData/Local/Temp/~hhF948.htm 7/16/2020
EDIABAS BEST Developer's Guide Page 69 of 161
EDIABAS BEST Developer's Guide > BEST/2 Function Primer > 3. Overview > 3.2. Functions of the runtime library by
categories
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
EDIABAS BEST Developer's Guide > BEST/2 Function Primer > 3. Overview > 3.2. Functions of the runtime library by
categories
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
EDIABAS BEST Developer's Guide > BEST/2 Function Primer > 3. Overview > 3.2. Functions of the runtime library by
categories
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 milliseconds
wait Waits n seconds
waitex Waits n milliseconds
file:///C:/Users/sgtma/AppData/Local/Temp/~hhF948.htm 7/16/2020
EDIABAS BEST Developer's Guide Page 70 of 161
EDIABAS BEST Developer's Guide > BEST/2 Function Primer > 3. Overview > 3.2. Functions of the runtime library by
categories
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
tabcolumns Gets the column count of the current table
tabrows Gets the row count of the current table
bittest Special function for identifying bit results
bytetest Special function for identifying byte results
EDIABAS BEST Developer's Guide > BEST/2 Function Primer > 3. Overview > 3.2. Functions of the runtime library by
categories
3.2.13. Configuration
These functions are used to set and read the EDIABAS configuration.
Function Purpose
enableIfhTrace Enable/disable the IFH-Trace
enableClampHandling Enable/disable the automatic clamp monitoring
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"
EDIABAS BEST Developer's Guide > BEST/2 Function Primer > 3. Overview > 3.2. Functions of the runtime library by
categories
Function Purpose
AdjustKWP2000TesterPr- Adapts the TesterPresent and StartCommunication
StartComm 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
file:///C:/Users/sgtma/AppData/Local/Temp/~hhF948.htm 7/16/2020
EDIABAS BEST Developer's Guide Page 71 of 161
control unit
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 interface 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 communication aborted
(and the terminal states reset) as response to this.
The system results IGNITIONCURRENT; UBATTCURRENT; IGNITIONHISTORY; UBATTHISTORY are only assigned 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 labelled
as undefined (-1).
file:///C:/Users/sgtma/AppData/Local/Temp/~hhF948.htm 7/16/2020
EDIABAS BEST Developer's Guide Page 72 of 161
5. Library functions
More:
AdjustKWP2000TesterPrStartComm
ascii2ascii
ascii2hex
atoi
ator
atoy
bcd2ascii
bittest
bytetest
clear_error
close_channel
closeall_channel
close_communication
data_to_real
datacat
dataclear
datacmp
datacopy
dataerase
datainsert
datalen
datarevers
dataset
file:///C:/Users/sgtma/AppData/Local/Temp/~hhF948.htm 7/16/2020
EDIABAS BEST Developer's Guide Page 73 of 161
doNewInit
enableIfhTrace
enableClampHandling
enableIgnitionHandling
enableUBattHandling
fclose
fopen
fread
freadln
fseek
fseekln
ftell
ftellln
get_battery_voltage
get_error
get_error2
get_ignition_voltage
get_token
get_trap_mask
generateRunError
getasciidate
getasciitime
getCfgInt
getCfgString
getdate
getETXblock
GetKWP2000Block
gettickcount
gettime
hex2ascii
ifboot
ifgetport
ifinfo
file:///C:/Users/sgtma/AppData/Local/Temp/~hhF948.htm 7/16/2020
EDIABAS BEST Developer's Guide Page 74 of 161
ifinfoExt
ifloopt
ifrawmode
ifrecv
ifrequeststate
ifreset
ifsend
ifsetport
ifsireset
iftype
ifvers
incProgressPos
isDebugLevel
isSimulation
itoad
itoax
itor
make_error
new_set_of_results
open_channel
open_communication
parcount
real_to_data
realadd
realcomp
realdiv
realmul
realresult
realsub
receive
recv_frequent
recv_keybytes
rtoa
file:///C:/Users/sgtma/AppData/Local/Temp/~hhF948.htm 7/16/2020
EDIABAS BEST Developer's Guide Page 75 of 161
rtoi
send
send_and_receive
send_frequent
set_answer_length
set_communication_pars
set_program_voltage
set_repeat_counter
set_trap_mask
set_variable_result
setProgressRange
shdataget
shdataset
stop_frequent
strcat
strcmp
strcpy
strcut
strerase
strinsert
strlen
strncpy
strrevers
switch_channel
tab2fix
tab_suche_index
tab_suche_unsigned
tabget
tabcolumns
tabline
tabrows
tabseek
tabset
file:///C:/Users/sgtma/AppData/Local/Temp/~hhF948.htm 7/16/2020
EDIABAS BEST Developer's Guide Page 76 of 161
tabsetext
uitoad
updateInfo
userbreak
var_result_data
var_result_long
var_result_real
var_result_string
wait
waitex
EDIABAS BEST Developer's Guide > BEST/2 Function Primer > 5. Library functions
This section describes the BEST/2 runtime library functions in alphabetical order. Related functions are described together in
many cases.
• 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.
This section lists all the functions of the BEST/2 runtime library in alphabetical order.
EDIABAS BEST Developer's Guide > BEST/2 Function Primer > 5. Library functions
AdjustKWP2000TesterPrStartComm
Summary
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 {
file:///C:/Users/sgtma/AppData/Local/Temp/~hhF948.htm 7/16/2020
EDIABAS BEST Developer's Guide Page 77 of 161
char parameter[];
parameter = kwp_2000_parameter;
parameter[5] = ecuAddress;
AdjustKWP2000TesterPrStartComm(parameter);
Result -
EDIABAS BEST Developer's Guide > BEST/2 Function Primer > 5. Library functions
ascii2ascii
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
// 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,
file:///C:/Users/sgtma/AppData/Local/Temp/~hhF948.htm 7/16/2020
EDIABAS BEST Developer's Guide Page 78 of 161
/*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
};
...
ascii2ascii(codepage,text);
...
EDIABAS BEST Developer's Guide > BEST/2 Function Primer > 5. Library functions
ascii2hex
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.
Example {
ascii2hex(destin,source,1};
file:///C:/Users/sgtma/AppData/Local/Temp/~hhF948.htm 7/16/2020
EDIABAS BEST Developer's Guide Page 79 of 161
...
EDIABAS BEST Developer's Guide > BEST/2 Function Primer > 5. Library functions
atoi
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.
Example {
long hexzahl;
long binzahl;
long dezzahl;
hexzahl=atoi("0x77");
binzahl=atoi("0y01110110");
dezzahl=atoi("014");
...
dezzahl= 0x0e = 14
EDIABAS BEST Developer's Guide > BEST/2 Function Primer > 5. Library functions
ator
Remarks The ator function converts a string into an integer. The string is interpreted as a real number. It can have
file:///C:/Users/sgtma/AppData/Local/Temp/~hhF948.htm 7/16/2020
EDIABAS BEST Developer's Guide Page 80 of 161
[{sign}][digits][{.|,}digits][{d|D|e|E}[sign]digits]
Conversion is aborted at the first character that does not match the number format.
Return value -
Example {
real realzahl;
ator(realzahl,"1.22e01");
...
EDIABAS BEST Developer's Guide > BEST/2 Function Primer > 5. Library functions
atoy
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.
Example {
char ascii[];
char binary[];
ascii="aa,bb,cc, ,01"
atoy(binary,ascii);
EDIABAS BEST Developer's Guide > BEST/2 Function Primer > 5. Library functions
bcd2ascii
file:///C:/Users/sgtma/AppData/Local/Temp/~hhF948.htm 7/16/2020
EDIABAS BEST Developer's Guide Page 81 of 161
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 -
Example {
char destin[];
bcd2ascii(destin,source,1,3};
...
EDIABAS BEST Developer's Guide > BEST/2 Function Primer > 5. Library functions
bittest
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)
file:///C:/Users/sgtma/AppData/Local/Temp/~hhF948.htm 7/16/2020
EDIABAS BEST Developer's Guide Page 82 of 161
char buffer[];
buffer[0]=0x06;
tabset("bits");
bittest("XEIN",buffer,xeinvalue);
bittest("XAUS",buffer,xausvalue);
Result xeinvalue = 1
xausvalue = 0
EDIABAS BEST Developer's Guide > BEST/2 Function Primer > 5. Library functions
bytetest
divs 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 und 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 divs. It indicates the value by which the result has to be divided in order to get a correct
result.
1 = over range
-1 = under range
{ "NAME","BYTE","MIN","MAX","MINDEF","MAXDEF","A","B","DIV" },
file:///C:/Users/sgtma/AppData/Local/Temp/~hhF948.htm 7/16/2020
EDIABAS BEST Developer's Guide Page 83 of 161
...
tabset("bytes");
bytetest("TEMP",buffer,tempvalue,tempdivs);
tempdivs = 1
EDIABAS BEST Developer's Guide > BEST/2 Function Primer > 5. Library functions
clear_error
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 -
EDIABAS BEST Developer's Guide > BEST/2 Function Primer > 5. Library functions
close_channel
void close_channel ()
Remarks The close_channel function closes the current communication channel formerly opened by
open_channel or selected by switch_channel. The default interface channel becomes the current
interface channel. If the current interface channel is the default interface channel it will not be closed
by close_channel.
Return value -
Example -
Result -
EDIABAS BEST Developer's Guide > BEST/2 Function Primer > 5. Library functions
file:///C:/Users/sgtma/AppData/Local/Temp/~hhF948.htm 7/16/2020
EDIABAS BEST Developer's Guide Page 84 of 161
close_communication
void close_communication()
Remarks The close_communication function resets the interface’s communication parameters and closes the
driver. Interface channels, which are still open, will automatically be closed as in the function
closeall_channel. The default Interface channel will be closed as well. All the communication and
interface functions used after this function are answered with the error message IFH_0019 (except
open_communication).
Return value -
Example -
Result -
EDIABAS BEST Developer's Guide > BEST/2 Function Primer > 5. Library functions
closeall_channel
void closeall_channel ()
Remarks The closeall_channel function closes all interface channels formerly opened by open_channel and not
closed by close_channel. The default interface channel stays open and becomes the current interface
channel.
Return value -
Example -
Result -
EDIABAS BEST Developer's Guide > BEST/2 Function Primer > 5. Library functions
data_to_real
void data_to_real(real destin, char source[], long pos, long double, long byteorder);
Remarks The data_to_real function converts 4 (double=0) or 8 data bytes (double=1) of the source buffer source
file:///C:/Users/sgtma/AppData/Local/Temp/~hhF948.htm 7/16/2020
EDIABAS BEST Developer's Guide Page 85 of 161
Return value -
Example {
real realzahl;
data_to_real(realzahl,buffer,0,0,0);
...
EDIABAS BEST Developer's Guide > BEST/2 Function Primer > 5. Library functions
datacat
Return value -
See also dataclear, datacopy, datacmp, dataerase, datainsert, datalen, datarevers, dataset
datacat(buffer1, buffer2);
EDIABAS BEST Developer's Guide > BEST/2 Function Primer > 5. Library functions
dataclear
Return value -
file:///C:/Users/sgtma/AppData/Local/Temp/~hhF948.htm 7/16/2020
EDIABAS BEST Developer's Guide Page 86 of 161
See also datacat, datacopy, datacmp, dataerase, datainsert, datalen, datarevers, dataset
dataclear(buffer);
EDIABAS BEST Developer's Guide > BEST/2 Function Primer > 5. Library functions
datacmp
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.
Example {
d1 = {1,2,3}
x=datacmp(d1,{1,2,3});
y=datacmp(d1,{1,2,3,4});
z=datacmp(d1,{1,2,4});
EDIABAS BEST Developer's Guide > BEST/2 Function Primer > 5. Library functions
datacopy
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. The maximum number of characters, that
file:///C:/Users/sgtma/AppData/Local/Temp/~hhF948.htm 7/16/2020
EDIABAS BEST Developer's Guide Page 87 of 161
can be copied, depends on the string register size of the currently loaded ECU description file, i.e. string register size – 1 character.
From EDIABAS V7.0.0: max. buffer size = 65536 characters (depends on string register size of the ECU
description file)
Return value -
See also datacat, dataclear, datacmp, dataerase, datainsert, datalen, datarevers, dataset
Example {
char destin[];
datacopy(destin,source,2,3);
...
Result destin={0x56,0x78,0x90}
EDIABAS BEST Developer's Guide > BEST/2 Function Primer > 5. Library functions
dataerase
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 {
dataerase(buffer,1,2);
...
file:///C:/Users/sgtma/AppData/Local/Temp/~hhF948.htm 7/16/2020
EDIABAS BEST Developer's Guide Page 88 of 161
EDIABAS BEST Developer's Guide > BEST/2 Function Primer > 5. Library functions
datainsert
Remarks The function datainsert inserts the buffer source into the buffer destin. Insertion is done beginning with
position pos. If the buffer destin becomes longer than a string register, i.e., string register size – 1
character, this causes a runtime error BIP_0001.
Return value -
See also datacat, dataclear, datacopy, datacmp, dataerase, datalen, datarevers, dataset
Example {
datainsert(destin,source,3);
...
EDIABAS BEST Developer's Guide > BEST/2 Function Primer > 5. Library functions
datalen
Remarks This function identifies the length (number of characters) of a data buffer.
See also datacat, dataclear, datacopy, datacmp, dataerase, datainsert, datarevers, dataset
length = datalen(buffer);
file:///C:/Users/sgtma/AppData/Local/Temp/~hhF948.htm 7/16/2020
EDIABAS BEST Developer's Guide Page 89 of 161
Result length = 4
EDIABAS BEST Developer's Guide > BEST/2 Function Primer > 5. Library functions
datarevers
Return value -
See also datacat, dataclear, datacopy, datacmp, dataerase, datainsert, datalen, dataset
datarevers(buffer);
EDIABAS BEST Developer's Guide > BEST/2 Function Primer > 5. Library functions
dataset
Remarks This function sets the number of bytes specified by count to the value data in the target buffer destin.
From EDIABAS V7.0.0: max. buffer size = 65536 characters (depends on string register size of the ECU
description file)
Return value -
See also datacat, dataclear, datacopy, datacmp, dataerase, datainsert, datalen, datarevers
Example {
dataset(buffer,0x41,2};
...
file:///C:/Users/sgtma/AppData/Local/Temp/~hhF948.htm 7/16/2020
EDIABAS BEST Developer's Guide Page 90 of 161
EDIABAS BEST Developer's Guide > BEST/2 Function Primer > 5. Library functions
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();
Result -
EDIABAS BEST Developer's Guide > BEST/2 Function Primer > 5. Library functions
enableClampHandling
Remarks This function either enables or disables the automatic monitoring of clamps 15/30. If monitoring is
enabled, the clamps 15/30 will be monitored at every interface access. The current value can be read
with "getCfgInt("ClampHandling"). After the ECU description file is changed, this setting is reset
again to the application default.
The configuration of the automatic clamp state monitoring must be supported by the interface. With
interfaces not supporting automatic clamp state monitoring the configuration element
ClampHandling will be ignored (i.e. in that case the function has no effect).
Return value -
enableClampHandling(0);
iftype(buffer);
enableClampHandling(1);
Result -
EDIABAS BEST Developer's Guide > BEST/2 Function Primer > 5. Library functions
enableIfhTrace
file:///C:/Users/sgtma/AppData/Local/Temp/~hhF948.htm 7/16/2020
EDIABAS BEST Developer's Guide Page 91 of 161
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 -
enableIfhTrace(1);
iftype(buffer);
enableIfhTrace(0);
Result -
EDIABAS BEST Developer's Guide > BEST/2 Function Primer > 5. Library functions
enableIgnitionHandling
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 -
enableIgnitionHandling(0);
iftype(buffer);
enableIgnitionHandling(1);
Result -
EDIABAS BEST Developer's Guide > BEST/2 Function Primer > 5. Library functions
enableUBattHandling
Remarks This function either enables or disables the battery monitoring. If monitoring is enabled, the error "IFH-
file:///C:/Users/sgtma/AppData/Local/Temp/~hhF948.htm 7/16/2020
EDIABAS BEST Developer's Guide Page 92 of 161
0015: UBATT ON/OFF ERROR" is issued after disabling the battery voltage at the next interface communication. 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 -
enableUBattHandling(0);
iftype(buffer);
enableUBattHandling(1);
Result -
EDIABAS BEST Developer's Guide > BEST/2 Function Primer > 5. Library functions
fclose
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 -
Example {
int handle;
handle=fopen("/test/div/test.dat");
...
/* file operations */
...
fclose(handle);
Result -
EDIABAS BEST Developer's Guide > BEST/2 Function Primer > 5. Library functions
fopen
file:///C:/Users/sgtma/AppData/Local/Temp/~hhF948.htm 7/16/2020
EDIABAS BEST Developer's Guide Page 93 of 161
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].
Example {
int handle;
handle=fopen("/usr2/test/test.dat");
...
...
fclose(handle);
Result -
EDIABAS BEST Developer's Guide > BEST/2 Function Primer > 5. Library functions
fread
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.
Example {
int handle;
handle=fopen("test.dat");
while((c=fread(handle)) != -1 )
i++;
file:///C:/Users/sgtma/AppData/Local/Temp/~hhF948.htm 7/16/2020
EDIABAS BEST Developer's Guide Page 94 of 161
EDIABAS BEST Developer's Guide > BEST/2 Function Primer > 5. Library functions
freadln
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].
Example {
int handle;
handle=fopen("Example.txt");
while(freadln(line,handle) != -1 )
i++;
EDIABAS BEST Developer's Guide > BEST/2 Function Primer > 5. Library functions
fseek
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].
file:///C:/Users/sgtma/AppData/Local/Temp/~hhF948.htm 7/16/2020
EDIABAS BEST Developer's Guide Page 95 of 161
Example {
int handle;
int c;
handle=fopen("Filename");
c=fread(handle);
fseek(0,handle);
c=fread(handle);
...
EDIABAS BEST Developer's Guide > BEST/2 Function Primer > 5. Library functions
fseekln
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].
Example {
int handle;
char line[];
handle=fopen("test.txt");
fseekln(10,handle);
freadln(line,handle);
...
file:///C:/Users/sgtma/AppData/Local/Temp/~hhF948.htm 7/16/2020
EDIABAS BEST Developer's Guide Page 96 of 161
EDIABAS BEST Developer's Guide > BEST/2 Function Primer > 5. Library functions
ftell
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].
Example {
int handle;
long c;
handle=fopen("Filename");
c=fread(handle);
c=fread(handle);
c=ftell(handle);
EDIABAS BEST Developer's Guide > BEST/2 Function Primer > 5. Library functions
ftellln
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].
Example {
char line[];
file:///C:/Users/sgtma/AppData/Local/Temp/~hhF948.htm 7/16/2020
EDIABAS BEST Developer's Guide Page 97 of 161
handle=fopen("xxx.tst");
freadln(line,handle);
freadln(line,handle);
c=ftellln(handle);
EDIABAS BEST Developer's Guide > BEST/2 Function Primer > 5. Library functions
generateRunError
Return value -
Example {
...
Result -
EDIABAS BEST Developer's Guide > BEST/2 Function Primer > 5. Library functions
get_battery_voltage
long get_battery_voltage()
Remarks This function returns the voltage at clamp 30 (battery voltage) in millivolts.
voltage = get_battery_voltage();
Result -
EDIABAS BEST Developer's Guide > BEST/2 Function Primer > 5. Library functions
get_error
file:///C:/Users/sgtma/AppData/Local/Temp/~hhF948.htm 7/16/2020
EDIABAS BEST Developer's Guide Page 98 of 161
(get_trap_mask, set_trap_mask)
Summary Checks whether an error has occurred
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.
send_and_receive(destin,source);
if(get_error(0))
else
EDIABAS BEST Developer's Guide > BEST/2 Function Primer > 5. Library functions
get_error2
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 trap numbers see function set_trap_mask.
// errors
send_and_receive(destin,source);
error = get_error2();
file:///C:/Users/sgtma/AppData/Local/Temp/~hhF948.htm 7/16/2020
EDIABAS BEST Developer's Guide Page 99 of 161
Result -
EDIABAS BEST Developer's Guide > BEST/2 Function Primer > 5. Library functions
get_ignition_voltage
long get_ignition_voltage()
Remarks This function returns the voltage at clamp 15 (ignition voltage) in millivolts.
voltage = get_ignition_voltage();
Result -
EDIABAS BEST Developer's Guide > BEST/2 Function Primer > 5. Library functions
get_token
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 {
gettoken(destin,source," ",4);
EDIABAS BEST Developer's Guide > BEST/2 Function Primer > 5. Library functions
get_trap_mask
file:///C:/Users/sgtma/AppData/Local/Temp/~hhF948.htm 7/16/2020
EDIABAS BEST Developer's Guide Page 100 of 161
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.
Example {
long x;
set_trap_mask(0x00180000);
x=get_trap_mask();
Result x=0x00180000
EDIABAS BEST Developer's Guide > BEST/2 Function Primer > 5. Library functions
getasciidate
Remarks From the system time this function identifies the current date as a string with the form
Return value -
Example {
char date[];
getasciidate(date);
...
EDIABAS BEST Developer's Guide > BEST/2 Function Primer > 5. Library functions
getasciitime
file:///C:/Users/sgtma/AppData/Local/Temp/~hhF948.htm 7/16/2020
EDIABAS BEST Developer's Guide Page 101 of 161
Remarks From the system time this function identifies the current time as a string with the form
"hh:mm:ss"
Return value -
Example {
char time[];
getasciitime(time);
...
EDIABAS BEST Developer's Guide > BEST/2 Function Primer > 5. Library functions
getCfgInt
Remarks With this function, the setting of EDIABAS configuration elements can be determined.
cfgvalue=getCfgInt("RetryComm");
EDIABAS BEST Developer's Guide > BEST/2 Function Primer > 5. Library functions
getCfgString
Remarks This function can be used to determine the setting of EDIABAS configuration elements.
file:///C:/Users/sgtma/AppData/Local/Temp/~hhF948.htm 7/16/2020
EDIABAS BEST Developer's Guide Page 102 of 161
getCfgString(cfgvalue,"SimulationPath");
EDIABAS BEST Developer's Guide > BEST/2 Function Primer > 5. Library functions
getdate
Remarks From the system time this function identifies the current date as a structure with the form:
Return value -
Example {
char date[];
getdate(date);
...
EDIABAS BEST Developer's Guide > BEST/2 Function Primer > 5. Library functions
getETXblock
Summary Returns the data bytes of a block specified for a KWP 1281 ECU.
file:///C:/Users/sgtma/AppData/Local/Temp/~hhF948.htm 7/16/2020
EDIABAS BEST Developer's Guide Page 103 of 161
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.
See also -
send_and_receive(response,tel_fslesen);
if (getETXblock(response,status,1,buffer,blockLen))
{
Result -
EDIABAS BEST Developer's Guide > BEST/2 Function Primer > 5. Library functions
GetKWP2000Block
Summary Extracts the data component from a KWP 2000 telegram in the control unit response.
int GetKWP2000Block(int position, char response[],char format, char target, char source, int length, char data[])
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)
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.
See also -
file:///C:/Users/sgtma/AppData/Local/Temp/~hhF948.htm 7/16/2020
EDIABAS BEST Developer's Guide Page 104 of 161
Example {
int position;
int format;
int source;
int target;
int length;
send_and_receive(resonse,request);
position = 0;
while(GetKWP2000Block(position,resonse,
format,source,target,length,data))
datacat(dataglobal,data);
Result -
EDIABAS BEST Developer's Guide > BEST/2 Function Primer > 5. Library functions
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:
Example {
ticks=gettickcount();
...
file:///C:/Users/sgtma/AppData/Local/Temp/~hhF948.htm 7/16/2020
EDIABAS BEST Developer's Guide Page 105 of 161
Result -
EDIABAS BEST Developer's Guide > BEST/2 Function Primer > 5. Library functions
gettime
Remarks From the system time this function identifies the current time as a structure with the form
Return value -
Example {
char time[];
gettime(time);
...
EDIABAS BEST Developer's Guide > BEST/2 Function Primer > 5. Library functions
hex2ascii
Remarks Converts a chain of bytes from the source buffer source, starting from the byte position pos, into a zero-
terminated string destin. count nibbles are converted from the source string.
Return value -
Example {
file:///C:/Users/sgtma/AppData/Local/Temp/~hhF948.htm 7/16/2020
EDIABAS BEST Developer's Guide Page 106 of 161
char destin[];
hex2ascii(destin,source,1,2};
...
EDIABAS BEST Developer's Guide > BEST/2 Function Primer > 5. Library functions
ifboot
void ifboot()
Remarks This function returns the interface to initializing status and tests the diagnostic interface. The IDBSS will
not accept commands for about 2 seconds after this job.
Return value -
See also -
Example ifboot();
Result -
EDIABAS BEST Developer's Guide > BEST/2 Function Primer > 5. Library functions
ifgetport
Remarks This function reads out ports. With EDIC up to nine ports can be read out. Ports 0 - 7 are analog inputs
(results in millivolts), port 8 returns the value of the jumper field (each bit is a jumper).
EDIC:
long jumper;
voltageCl30= ifgetport(7);
jumper = ifgetport(8);
file:///C:/Users/sgtma/AppData/Local/Temp/~hhF948.htm 7/16/2020
EDIABAS BEST Developer's Guide Page 107 of 161
Result -
EDIABAS BEST Developer's Guide > BEST/2 Function Primer > 5. Library functions
ifinfo
Remarks This function only exists for the purpose of debugging. When developing EDIABAS, the internal
functionality over the description file can be influenced using this function. The functionality can
vary depending on the EDIABAS version. This function must not be used by the user and is only
explained for completeness.
Return value -
Example -
Result -
EDIABAS BEST Developer's Guide > BEST/2 Function Primer > 5. Library functions
ifinfoExt
Remarks This function exists only for debugging purposes. During the development of EDIABAS, the function
can influence the internal functionality via the description file. This functionality can vary among the
different EDIABAS versions. The user may not use this function; it is only described here for
completeness.
Example -
Result -
EDIABAS BEST Developer's Guide > BEST/2 Function Primer > 5. Library functions
ifloopt
long ifloopt()
Remarks This function tests the diagnostic lead - there must be a short between the RD and TD leads.
file:///C:/Users/sgtma/AppData/Local/Temp/~hhF948.htm 7/16/2020
EDIABAS BEST Developer's Guide Page 108 of 161
1: Test OK
See also -
Example if (ifloopt())
/* execute diagnostic */
Result -
EDIABAS BEST Developer's Guide > BEST/2 Function Primer > 5. Library functions
ifrawmode
Remarks This function passes the transmitted data direct to the interface. The interface answer is returned un-
interpreted. The control bytes of an answer of the EIDBSS application of the EDIC interface are not
evaluated.
Return value -
See also -
ifrawmode(response, request);
EDIABAS BEST Developer's Guide > BEST/2 Function Primer > 5. Library functions
ifrecv
Remarks This function waits the specified time for characters on the serial interface. This function is only used for
the purpose of debugging. Never use this function, since it may vary depending on the EDIABAS
version.
Return value -
Example -
Result -
file:///C:/Users/sgtma/AppData/Local/Temp/~hhF948.htm 7/16/2020
EDIABAS BEST Developer's Guide Page 109 of 161
EDIABAS BEST Developer's Guide > BEST/2 Function Primer > 5. Library functions
ifrequeststate
Return value -
See also -
Example
Result -
EDIABAS BEST Developer's Guide > BEST/2 Function Primer > 5. Library functions
ifreset
void ifreset()
Remarks This function breaks off communication with a control unit and resets the communication parameters.
Any control unit telegram that may be stored in the interface is erased.
Return value -
Example ifreset();
Result -
EDIABAS BEST Developer's Guide > BEST/2 Function Primer > 5. Library functions
ifsend
Remarks This function sends characters to the serial interface. It is used only for the purpose of debugging. Never
use this function, since it may vary depending on the EDIABAS version.
Return value -
Example -
Result -
EDIABAS BEST Developer's Guide > BEST/2 Function Primer > 5. Library functions
ifsetport
file:///C:/Users/sgtma/AppData/Local/Temp/~hhF948.htm 7/16/2020
EDIABAS BEST Developer's Guide Page 110 of 161
Remarks Ports can be set with this function. Only port 9 can be set in EDIC (digital outputs).
Return value -
value = 0xff;
ifsetport(9, value);
Result -
EDIABAS BEST Developer's Guide > BEST/2 Function Primer > 5. Library functions
ifsireset
Remarks This function switches on the service interval relay of the interface for the specified time.
Return value -
See also -
Result -
EDIABAS BEST Developer's Guide > BEST/2 Function Primer > 5. Library functions
iftype
Return value -
iftype(typ);
Result -
file:///C:/Users/sgtma/AppData/Local/Temp/~hhF948.htm 7/16/2020
EDIABAS BEST Developer's Guide Page 111 of 161
EDIABAS BEST Developer's Guide > BEST/2 Function Primer > 5. Library functions
ifvers
long ifvers()
See also -
versionsnr = ifvers();
EDIABAS BEST Developer's Guide > BEST/2 Function Primer > 5. Library functions
incProgressPos
void incProgressPos(long n)
Remarks This function increases the current progress position by the value specified. It only has affect when the
progress counter has been previously initialized in a job with setProgressRange.
Return value -
Example
setProgressRange(500);
incProgressPos(100); // 20 percent
: // processed
incProgressPos(300); // 80 percent
: // processed
// processed
file:///C:/Users/sgtma/AppData/Local/Temp/~hhF948.htm 7/16/2020
EDIABAS BEST Developer's Guide Page 112 of 161
///////////////////////////////////////////////////
// state
Result -
EDIABAS BEST Developer's Guide > BEST/2 Function Primer > 5. Library functions
isDebugLevel
long isDebugLevel()
Remarks This function can be used to determine the setting of the EDIABAS configuration element
"BipDebugLevel". By means of this value, certain actions can only be performed during the ECU
description file test.
Corresponds to: getCfgInt("BipDebugLevel");
if(isDebugLevel() > 3)
SEND_TEL=tel;
send_and_receive(response,tel);
if(isDebugLevel() > 3)
RECV_TEL=response;
Result
EDIABAS BEST Developer's Guide > BEST/2 Function Primer > 5. Library functions
isSimulation
long isSimulation()
Remarks This function can be used to determine the setting of the EDIBAS configuration element "Simulation".
By means of this value, certain actions can only be performed during the ECU description file test.
Corresponds to: getCfgInt("Simulation");
file:///C:/Users/sgtma/AppData/Local/Temp/~hhF948.htm 7/16/2020
EDIABAS BEST Developer's Guide Page 113 of 161
if(isSimulation())
send_and_receive(response,tel_sim);
else
send_and_receive(response,tel);
Result
EDIABAS BEST Developer's Guide > BEST/2 Function Primer > 5. Library functions
itoad
Remarks itoad converts the number value to a string with decimal notation with a sign. No leading zeroes are
output.
Return value -
Example {
char destin[];
itoad(destin,1143);
...
Result destin="1143"
EDIABAS BEST Developer's Guide > BEST/2 Function Primer > 5. Library functions
itoax
file:///C:/Users/sgtma/AppData/Local/Temp/~hhF948.htm 7/16/2020
EDIABAS BEST Developer's Guide Page 114 of 161
Remarks itoax converts the number value to a string with hexadecimal notation with a sign. The output string
always has the format 0x########. All the positions are always output.
Return value -
Example {
char destin[];
itoax(destin,1143);
...
Result destin="0x00000477"
EDIABAS BEST Developer's Guide > BEST/2 Function Primer > 5. Library functions
itor
Return value -
Example {
real realzahl;
itor(realzahl,122);
...
EDIABAS BEST Developer's Guide > BEST/2 Function Primer > 5. Library functions
make_error
file:///C:/Users/sgtma/AppData/Local/Temp/~hhF948.htm 7/16/2020
EDIABAS BEST Developer's Guide Page 115 of 161
Remarks This function enters the trap number trapnumber in the Trap-Mask-Register and issues the
corresponding error in the runtime system.
Return value -
Example {
...
Result -
EDIABAS BEST Developer's Guide > BEST/2 Function Primer > 5. Library functions
new_set_of_results
void new_set_of_results()
Remarks The function new_set_of_results signals the start of a new result set to the runtime system. The results
of a job can be split up into several sets. The result information can be grouped in this way. For
instance, the results ERROR_NAME and ERROR_VALUE can be returned for each error contained
in the control unit without always having to use a new result name.
Return value -
Example ...
x = 1;
x = 2;
new_set_of_results();
x = 1;
...
Result set 2: x = 1;
EDIABAS BEST Developer's Guide > BEST/2 Function Primer > 5. Library functions
open_channel
file:///C:/Users/sgtma/AppData/Local/Temp/~hhF948.htm 7/16/2020
EDIABAS BEST Developer's Guide Page 116 of 161
Remarks This function opens a communication channel to the interface driver. The opened interface channel
becomes the active channel. Optionally the default interface channel can be used (useDefaultChannel
<> 0). In that case just does a switch to the default interface channel. The opened interface channel or
the default interface channel becomes the active channel.
channel=open_channel(0);
Result -
EDIABAS BEST Developer's Guide > BEST/2 Function Primer > 5. Library functions
open_communication
void open_communication()
Remarks This function opens the interface driver. This function must be called before all other that access the
interface, and it is advisable to write it as the first function in the job INITIALISIERUNG. The
function open_communication automatically opens a default interface channel to the interface. It is
recommended to call this function as first function in the job INITIALISIERUNG. If
open_communication has not been called yet, then all communication and interface commands are
answered by error message IFH_0019.
Return value -
Example open_communication();
Result -
EDIABAS BEST Developer's Guide > BEST/2 Function Primer > 5. Library functions
parcount
long parcount()
Remarks Identifies the number of parameters sent as parameter 3 in apiJob or apiJobData. It always counts all the
parameters including the ones that are not valid, i.e. blank, so parcount returns the value 5 with
apiJob("...","...",";;;;","..."). It even returns 1 when a parameter exists that cannot be evaluated.
Example {
long x;
file:///C:/Users/sgtma/AppData/Local/Temp/~hhF948.htm 7/16/2020
EDIABAS BEST Developer's Guide Page 117 of 161
x=parcount();
EDIABAS BEST Developer's Guide > BEST/2 Function Primer > 5. Library functions
real_to_data
void real_to_data(char destin[], real source, long pos, long double, long byteorder);
Remarks The real_to_data function converts the real number source into 4 (double=0) or 8 data bytes
(double=1). The data bytes are copied to the target buffer destin as of the position pos.
In case of single-precision (double=0), the error BIP_0011 is triggered if the real number value is not
within the range 3.4E±38.
Return value -
Example {
real realzahl;
realzahl = atof("123.45");
real_to_data(buffer,realzahl,0,0,0);
...
file:///C:/Users/sgtma/AppData/Local/Temp/~hhF948.htm 7/16/2020
EDIABAS BEST Developer's Guide Page 118 of 161
EDIABAS BEST Developer's Guide > BEST/2 Function Primer > 5. Library functions
realadd
Remarks This function adds the real variables source and destin and writes the result to destin.
destin = destin + source
Return value -
Example {
real real1;
real real2;
ator(real1,"1234e15");
ator(real2,"5678e13");
realadd(real1,real2);
real2 = 5.678e16
EDIABAS BEST Developer's Guide > BEST/2 Function Primer > 5. Library functions
realcomp
Remarks The function compares the real variables value1 and value2. The comparison to be carried through must
be defined with operator.
file:///C:/Users/sgtma/AppData/Local/Temp/~hhF948.htm 7/16/2020
EDIABAS BEST Developer's Guide Page 119 of 161
See also -
Example {
int cmp;
real real1;
real real2;
ator(real1,"1.00");
ator(real2,"2.00");
if (realcomp(real1,"<",real2))
cmp=1;
else
cmp=0;
Result cmp = 1
EDIABAS BEST Developer's Guide > BEST/2 Function Primer > 5. Library functions
realdiv
Remarks This function divides the real variables source and destin and writes the result to destin.
destin = destin / source
Return value -
Example {
real real1;
real real2;
ator(real1,"1234e15");
ator(real2,"5678e13");
realdiv(real1,real2);
file:///C:/Users/sgtma/AppData/Local/Temp/~hhF948.htm 7/16/2020
EDIABAS BEST Developer's Guide Page 120 of 161
real2 = 5.678e16
EDIABAS BEST Developer's Guide > BEST/2 Function Primer > 5. Library functions
realmul
Remarks This function multiplies the real variables source and destin and writes the result to destin.
destin = destin * source
Return value -
Example {
real real1;
real real2;
ator(real1,"1234e15");
ator(real2,"5678e13");
realmul(real1,real2);
real2 = 5.678e16
EDIABAS BEST Developer's Guide > BEST/2 Function Primer > 5. Library functions
realresult
Remarks This function generates a real result with result name name and the value value / adjust.
Return value -
file:///C:/Users/sgtma/AppData/Local/Temp/~hhF948.htm 7/16/2020
EDIABAS BEST Developer's Guide Page 121 of 161
realresult("x",12345678,1000);
Result x = 12345,678
EDIABAS BEST Developer's Guide > BEST/2 Function Primer > 5. Library functions
realsub
Remarks This function subtracts the real variables source and destin and writes the result to destin.
destin = destin - source
Return value -
Example {
real real1;
real real2;
ator(real1,"1234e15");
ator(real2,"5678e13");
realsub(real1,real2);
real2 = 5.678e16
EDIABAS BEST Developer's Guide > BEST/2 Function Primer > 5. Library functions
receive
Remarks This function checks if a control unit response to a previous call to the function send was received. If
there is a response, the received data are copied to the receive buffer response[] and the number of
copied bytes is returned. If there is no response, the function returns 0 (the content of the receive
buffer response[] is reset as in the function dataclear). The return value is always the size of the
receive buffer, i.e. return value = datalen(response).
file:///C:/Users/sgtma/AppData/Local/Temp/~hhF948.htm 7/16/2020
EDIABAS BEST Developer's Guide Page 122 of 161
long len;
send(request);
len = 0;
while (len == 0)
len=receive(response);
Result -
EDIABAS BEST Developer's Guide > BEST/2 Function Primer > 5. Library functions
recv_frequent
Remarks If repeat send and receive (frequent mode) has been started, the current control unit answer can be
requested from the interface with the recv_frequent function.
Return value -
send_frequent(request);
recv_frequent(response);
Result -
EDIABAS BEST Developer's Guide > BEST/2 Function Primer > 5. Library functions
recv_keybytes
Remarks This function reads out the keybytes from a concept 2, concept 3 or concept 4 control unit. The control
unit is woken up automatically if it has not already done so.
Return value -
See also -
recv_keybytes(keybytes);
Result -
EDIABAS BEST Developer's Guide > BEST/2 Function Primer > 5. Library functions
file:///C:/Users/sgtma/AppData/Local/Temp/~hhF948.htm 7/16/2020
EDIABAS BEST Developer's Guide Page 123 of 161
rtoa
count Number of positions to be converted (without decimal point and minus character)
Remarks The rtoa function converts a real number into a string. In case of too few positions, the value is rounded
off. In case of too many positions, the string is filled with zeroes.
If 0 is used as count, the real number is converted into a string in exponential notation. With DOS,
there is NO conversion into exponential notation, but the value for count is internally set at 10.
Return value Number of the converted characters including terminated zero character.
Example {
char destin[];
real realzahl;
int len;
ator(realzahl,"1.234";
...
len=rtoa(destin,realzahl,3);
...
Result destin="1.23";
len=5
EDIABAS BEST Developer's Guide > BEST/2 Function Primer > 5. Library functions
rtoi
Example {
long destin[];
file:///C:/Users/sgtma/AppData/Local/Temp/~hhF948.htm 7/16/2020
EDIABAS BEST Developer's Guide Page 124 of 161
real realzahl;
ator(realzahl,"5.234";
...
destin=rtoi(realzahl);
...
Result destin=5;
EDIABAS BEST Developer's Guide > BEST/2 Function Primer > 5. Library functions
send
Remarks This function sends a telegram to the control unit. The control unit’s response has to be retrieved using
the function receive.
Return value -
send(request);
Result -
EDIABAS BEST Developer's Guide > BEST/2 Function Primer > 5. Library functions
send_and_receive
Remarks This function sends a telegram to the control unit and receives the answer.
file:///C:/Users/sgtma/AppData/Local/Temp/~hhF948.htm 7/16/2020
EDIABAS BEST Developer's Guide Page 125 of 161
Return value -
send_and_receive(response, request);
Result -
EDIABAS BEST Developer's Guide > BEST/2 Function Primer > 5. Library functions
send_frequent
Remarks This function repeatedly sends the transmitted telegram to the control unit (frequent mode). In this mode
a further call of send_frequent or send_and_receive is answered by the error message IFH_0006.
The frequent mode is terminated with stop_frequent (send_frequent and send_and_receive can
now be called again).
Return value -
send_frequent(request);
recv_frequent(response);
recv_frequent(response);
Result -
EDIABAS BEST Developer's Guide > BEST/2 Function Primer > 5. Library functions
set_answer_length
file:///C:/Users/sgtma/AppData/Local/Temp/~hhF948.htm 7/16/2020
EDIABAS BEST Developer's Guide Page 126 of 161
Remarks To send a telegram, the interface needs telegram parameters. These parameters either control the
establishment of the connection to the control unit or transmit the information concerning the
expected response length and the response offset. During communication with the control unit, the
telegram parameters are generally identical for all control unit telegrams. They can be set by the user
with the function set_answer_length so that they do not have to be transmitted with each telegram.
During transmission of a telegram, the telegram parameters are always automatically set at the
beginning of the telegram. If the user indicates no telegram parameters, the default values that were
used to set the communication parameters will be used here as well. If only telegram parameters are
to be transferred to the interface, they must first be set with set_answer_length and then transmitted
to the interface with send_and_receive. In this case, the telegram to be sent is empty (buffer emptied
with dataclear).
telparam[0] Control code/response length:
In connection with the BMW protocols concept 1, concept 2, concept 3, concept 4, DS1 and DS2,
telparam[0] is interpreted as response length.
The response length supplies the length of the anticipated control unit response.
Concept 1, DS1, DS2 and Concept 3:
Return value -
set_answer_length(awlen);
file:///C:/Users/sgtma/AppData/Local/Temp/~hhF948.htm 7/16/2020
EDIABAS BEST Developer's Guide Page 127 of 161
Result
EDIABAS BEST Developer's Guide > BEST/2 Function Primer > 5. Library functions
set_communication_pars
Remarks This function sets the communication parameters needed to communicate with the control unit. The
parameters have an interface-independent format. Once the parameters have been set with this
function, the user software does not have to be changed for an interface change. The concept
0x0000FF00 constitutes an exception. This concept is an identifier which informs the interface
driver that the subsequent parameters are transferred to the interface unchanged (raw data).
The parameters for a concept consist of a sequence of either character, integer or long values. The
more significant byte in the concept parameter (param[0]) determines the parameter format.
The number and content of the parameters for a concept depend on the concept.
The function set_communication_pars must be called before a new control unit is addressed. As well as
the communication parameters the telegram header is assigned default values in EDIABAS according
to the preset concept. See set_answer_length for more details about the telegram header.
file:///C:/Users/sgtma/AppData/Local/Temp/~hhF948.htm 7/16/2020
EDIABAS BEST Developer's Guide Page 128 of 161
file:///C:/Users/sgtma/AppData/Local/Temp/~hhF948.htm 7/16/2020
EDIABAS BEST Developer's Guide Page 129 of 161
= 0x00 to 0x0B
param[48] = 0x00 reserved
param[49..59] ACK Request
file:///C:/Users/sgtma/AppData/Local/Temp/~hhF948.htm 7/16/2020
EDIABAS BEST Developer's Guide Page 130 of 161
Bit 6 TesterPresent
=0 TersterPresent request ist sent by the interface
automatically.
=1 TesterPresent will not by sent by the interface
Bit 7 Baud Rate Setting
=0 Baud Rate is set to 9600 baud.
=1 Baud rate is set according to the values of
param[32] and param[33].
param[6] Block-Timeout - low byte
param[7] - high byte
Timing, timeout [0.1 ms] for ECU to respond to a request
block.
param[8] Byte-Timeout - low byte
param[9] - high byte
Timing, inter byte time [0.1 ms] for response blocks from
the ECU
param[10] Regeneration Time - low byte
param[11] - high byte
Timing, time [0.1 ms] between a response block and the
next request block sent by the interface.
param[12] Inter Byte Time - low byte
param[13] - high byte
Timing, inter byte time [0.1 ms] for request blocks from the
interface.
param[14] ACKCycleTime - low byte
param[15] - high byte
Timing, time [ms] between the last response block and the
transmission of an ACK block by the interface.
param[16] BusyWait - low byte
param[17] - high byte
Timing, time [0.1 ms] between the reception of a busy block
and retransmission of the request block.
param[18] ACK block Length
0 up to 10 bytes
= 0x00 The default block „Keep up
Diagnostic Session“ is sent.
param[19..28] ACK Block
file:///C:/Users/sgtma/AppData/Local/Temp/~hhF948.htm 7/16/2020
EDIABAS BEST Developer's Guide Page 131 of 161
file:///C:/Users/sgtma/AppData/Local/Temp/~hhF948.htm 7/16/2020
EDIABAS BEST Developer's Guide Page 132 of 161
0 up to 10 bytes
param[17..26] ACK Block
file:///C:/Users/sgtma/AppData/Local/Temp/~hhF948.htm 7/16/2020
EDIABAS BEST Developer's Guide Page 133 of 161
0 up to 10 bytes
param[27..36] ACK Block
file:///C:/Users/sgtma/AppData/Local/Temp/~hhF948.htm 7/16/2020
EDIABAS BEST Developer's Guide Page 134 of 161
Concept 3
Concept 2 DDE
Concept DS1
Concept DS2
Concept 2 Zuheizer
param[0] Concept
Concept 1 = 1
Concept 2 ISO 9141 = 2
Concept 3 = 3
Concept 2 DDE = 4
Concept DS1 = 5
Concept DS2 = 6
Concept 2 Zuheizer = 0x0E
param[1] baud rate
Evaluated with Concept 1, DS1, DS2 only
param[2] Wakeup address
Only evaluated by the interface for Concept 2, 3 and 4 but is needed for EDIABAS
param[3] Wakeup
Time in ms, 0 ms means no WakeUp
(Concept 1 only)
param[4] IdleTime
Time in ms between WakeUp and the start of the first telegram (Concept 1 with WakeUp only)
param[5] Timeout time
Time in ms in which the SG must have responded to a telegram from the interface
param[6] Regeneration time
Time in ms that must elapse after the answer from the control unit before another telegram can be
sent
param[7] Telegram end time
Time in ms by which the telegram end is decided
param[8] Byte to byte time (optional)
Byte to byte time for DS2 in ms
param[9] Checksum (optional)
Indicates how the telegram checksum must be created and checked. If nothing is specified the
checksum of the telegram to be sent is formed automatically by the interface and the checksum of the
received telegram is formed. Checksum handling is bit-coded.
Bit 0 = 0: The checksum of the telegram to be sent must be created by the user.
Bit 0 = 1: The checksum of the telegram to be sent is created by the interface (default).
Bit 1 = 0: The checksum of the received telegram is checked.
Bit 1 = 1: The checksum of the received telegram is not checked.
file:///C:/Users/sgtma/AppData/Local/Temp/~hhF948.htm 7/16/2020
EDIABAS BEST Developer's Guide Page 135 of 161
file:///C:/Users/sgtma/AppData/Local/Temp/~hhF948.htm 7/16/2020
EDIABAS BEST Developer's Guide Page 136 of 161
must be 0.
param[33] Checksum (optional)
= 1 (default)
Information on how the telegram checksum is to be calculated and checked. If nothing is indicated,
the checksum of the telegram to be transmitted is automatically calculated by the interface and the
checksum of the received telegram is checked. Checksum handling is bit-coded.
Bit 0 = 0: The checksum of the telegram to be transmitted must be calculated by the user.
Bit 0 = 1: The checksum of the telegram to be transmitted must be calculated by the interface.
Bit 1 = 0: The checksum of the received telegram is checked.
Bit 1 = 1: The checksum of the received telegram is not checked.
file:///C:/Users/sgtma/AppData/Local/Temp/~hhF948.htm 7/16/2020
EDIABAS BEST Developer's Guide Page 137 of 161
param[2] Settings
Checksum:
Bit 0:
0: The checksum byte is not generated by the interface during transmission but must be
part of the request telegram.
1: The checksum byte is generated by the interface during transmission and may not be part
of the request telegram.
Bit 1:
0: The checksum byte is checked by the interface. A faulty checksum is considered an
error.
1: A faulty checksum is ignored.
Header Format:
Bit 2 to 4 (0,1,2,3,4)
The value must be set in any case.
The parameter determines which header is used when the header is generated by the interface.
0: CARB header
1: 1-Byte header
2: 1-byte header with length byte
3: 3-Byte header
4: 3-byte header with length byte
Addressing:
Bit 5:
0: physical addressing
1: functional addressing
TesterPresent Handling:
Bit 6:
0: The TesterPresent Request is transmitted according to the settings of TimeTesterPresent
and Tester Present Message.
1: TesterPresent is not transmitted automatically.
Reserved
Bit 7
param[3] BusyRepeatRequest repetitions (0 to 1000)
Max. number of repetitions if the control unit answers a request with
“BusyRepeatRequest“ (response code $21)
= 0: There is no repetition; the response is forwarded to the host.
<> 0: The request is repeated after P3max-5ms until either no BusyRepeatRequest is signalled
by the control unit anymore or until the maximum number of repetitions is reached.
The last response is forwarded to the host.
param[4] ErrorRepeat (0 to 1000)
Number of repetitions if a communication error occurs
= 0: There is no repetition; the error message is forwarded to the host.
<> 0: After a communication error, the communication process is repeated until either no
communication error occurs anymore or the maximum number of repetitions is
reached. If no communication error occurs anymore, the received response is
forwarded to the host; otherwise, an error message is transmitted.
param[5] P3max (10 to 65500)
Maximum waiting time between two requests; used with activated handling after ”Busy-
RepeatRequest“ (P3max-5ms) and “RequestCorrectlyReceived-ResponsePending” (P3max).
param[6] ResponsePending Repetitions (0 to 65535)
Maximum number of repetitions if the control unit answers a request with
“RequestCorrectlyReceived-ResponsePending“ (response code $78).
=0: The tester does not wait for the actual response; RequestCorrectlyReceived-
ResponsePending is forwarded as a response to the host.
file:///C:/Users/sgtma/AppData/Local/Temp/~hhF948.htm 7/16/2020
EDIABAS BEST Developer's Guide Page 138 of 161
file:///C:/Users/sgtma/AppData/Local/Temp/~hhF948.htm 7/16/2020
EDIABAS BEST Developer's Guide Page 139 of 161
file:///C:/Users/sgtma/AppData/Local/Temp/~hhF948.htm 7/16/2020
EDIABAS BEST Developer's Guide Page 140 of 161
param[38] to
param[48] Characters of the StartCommunication Message
Characters of the StartCommunication message. If the telegram has less than 11 characters, the
remaining characters must have the value 0.
The checksum must always be indicated, independently of the setting for checksum generation
(param[2]).
Example of physical addressing:
81H, <phys. control unit address>,<tester address>, 81H,
<8-bit addition checksum>,
00H,00H,00H,00H,00H,00H
param[49] Settings (0,1)
0: Acceptance of all parameters from SetECUPars. If SetECUPars is transmitted during
ongoing control unit communication, communication is interrupted and then re-
established.
1: Acceptance of all parameters relevant during ongoing communication
param[50] Settings
Arbitration Handling
Bit 0:
Arbitration handling (only with functional addressing)
0: Arbitration handling switched off. In case of transmission errors during response
reception, the tester does not wait whether the control units repeat transmission.
1: Arbitration handling activated. In case of transmission errors during response reception,
the tester waits for TimeArbitrationIdle until the reception is restarted.
5Baud Address Parity
Bit 1 and Bit 2 (0,1,2)
Setting the parity bit in the 5-baud stimulation address
0: The 5-baud address is transmitted without alteration (data format 8N1).
1: In the 5-baud address, the 8th bit (MSB) has odd parity (data format 7O1).
2: In the 5-baud address, the 8th bit (MSB) has even parity (data format 7E1).
DataSegmentation
Bit 3
DataSegmentation handling (only with physical addressing of the request). With functional request
addressing, all responses will be received.
0: DataSegmentation handling activated. After the reception of each response, P2 is
started. If no additional response is received during P2, all responses to the
transmitted request have been received and will be signalled to the host.
1: DataSegmentation handling deactivated. After reception of the first response, P3 is
started immediately instead of P2. The tester does not wait for additional responses
but the received response is signaled to the host.
TesterPresent Handling
Bit 4
Setting the behaviour in case of communication errors during Tester Present
0: Error or timeout during reception of the response(s) are ignored; communication with
the control unit is not interrupted.
1: In case of errors or timeout during reception of the response(s), communication with the
control unit is interrupted and will be re-established during the next request by the
host.
Recommended setting: 0
Header Generation
Bit 5
0: The header is not generated by the interface but the data in the command SendTelegram
must contain the entire header information.
1: The header is generated by the interface. The data in the command SendTelegram may
not contain any header information.
Recommended setting: 0
file:///C:/Users/sgtma/AppData/Local/Temp/~hhF948.htm 7/16/2020
EDIABAS BEST Developer's Guide Page 141 of 161
file:///C:/Users/sgtma/AppData/Local/Temp/~hhF948.htm 7/16/2020
EDIABAS BEST Developer's Guide Page 142 of 161
application.
param[11] Timing Es [ms]
Timeout for reception of a Flow Control Frame after reception of a Flow Control:WAIT Frame.
param[12] Timing Er [ms]
Time to wait before transmission of a Flow Control:Wait Frame.
param[13] Maximum number of Flow Control:Wait Frames received from an ECU.
param[14] Timing STminUsedByInterface [ms]
0x00 – 0x7F: 0 to 127 ms
0x80-0xF0: 127 ms
0xF1-0xF9: 100 to 900 µs
0xFA-0xFF: 127 ms
Fix value for the interface to use as wait time between the transmission of Consecutive Frames. This
parameter is only used in case param[15] == 1.
param[15] STmin Handling
= 0: The value STmin from the received Flow Control Frame from the ECU is used.
= 1: The value specified by “STminUsedByInterface” (param[14]) is used.
param[16] Timing TesterPresent [ms]
= 0: The interface does not send TesterPresent messages automatically.
> 0: The interface sends TesterPresent messages at intervals specified by this parameter
param[17] Length of the TesterPresent message defined below
0 to 11 Bytes
param[18] to
param[28] TesterPresent message. Bytes not used have to be initialized with 0x00.
param[29] TesterPresent Response Handling
= 0: No response expected.
= 1: Response expected.
Return value -
Example unsigned int parameter[] = {1, 9600, 0x0D, 0, 0, 500, 100, 500};
set_communication_pars(parameter);
set_communication_pars(parameter);
Result -
EDIABAS BEST Developer's Guide > BEST/2 Function Primer > 5. Library functions
set_program_voltage
file:///C:/Users/sgtma/AppData/Local/Temp/~hhF948.htm 7/16/2020
EDIABAS BEST Developer's Guide Page 143 of 161
Remarks This function switches the programming voltage on and off. The programming voltage level is specified
in millivolts (0 - 33000 mV). Voltage = 0 Volts means programming voltage is "off".
Return value -
See also -
Result -
EDIABAS BEST Developer's Guide > BEST/2 Function Primer > 5. Library functions
set_repeat_counter
Remarks If an error occurs during control unit communication (IFH_0010 or IFH_0009) the communication
command to the interface handler is automatically repeated. The number of repeats can be set with
the set_repeat_counter function. 2 is default.
Return value -
Example {
set_repeat_counter(0); // no repeat
send_and_receive(...)
send_and_receive(...)
Result -
EDIABAS BEST Developer's Guide > BEST/2 Function Primer > 5. Library functions
set_trap_mask
Remarks The trap mask register decides which error messages will be reported to the runtime system and which
will be evaluated by the description file. A bit is reserved in the trap mask register for some error
messages. If this bit is 0, the error is reported to the runtime system. If it is 1 then the error can be
file:///C:/Users/sgtma/AppData/Local/Temp/~hhF948.htm 7/16/2020
EDIABAS BEST Developer's Guide Page 144 of 161
evaluated in the description file with get_error. set_trap_mask sets all bits of the trap mask register with the bit pattern of the
parameter mask at the same time. The default for all bits is 0, and the original status can be restored
at any time using set_trap_mask(0).
Return value The value of the trap mask register before it is called
Example {
set_trap_mask(0x00180000);
send_and_receive(.....);
if(get_error(19))
job_status="DIAGNOSE-FEHLER";
else
job_status="OKAY";
EDIABAS BEST Developer's Guide > BEST/2 Function Primer > 5. Library functions
set_variable_result
file:///C:/Users/sgtma/AppData/Local/Temp/~hhF948.htm 7/16/2020
EDIABAS BEST Developer's Guide Page 145 of 161
1: long
2: real
3: string
4: data
Remarks This function can be used to return a variable result independent of the job sequence. The result name
and the result type must not be defined in the job header; it is determined only at runtime.
Return value -
Example {
real x;
set_variable_result("RESULT",3,0,x,value,y);
EDIABAS BEST Developer's Guide > BEST/2 Function Primer > 5. Library functions
setProgressRange
Remarks This function specifies a progress range. The current progress position can vary in this range. The
progress position is still undefined after called setProgressRange. It must subsequently be initialized
with incProgressPos. If the progress position exceeds the progress range, it is automatically
shortened to the maximum value.
Return value -
file:///C:/Users/sgtma/AppData/Local/Temp/~hhF948.htm 7/16/2020
EDIABAS BEST Developer's Guide Page 146 of 161
Example
setProgressRange(500);
incProgressPos(100); // 20 percent
: // processed
incProgressPos(300); // 80 percent
: // processed
// processed
///////////////////////////////////////////////////
setProgressRange(0); // Reset
// processing mode
Result -
EDIABAS BEST Developer's Guide > BEST/2 Function Primer > 5. Library functions
shdataget
Summary Copies the contents of the global data memory into a destination buffer.
Remarks This function copies the entire contents of the global data memory into the destination buffer. The
destination buffer is cleared prior to copying the contents. The ID (name) of the data memory is an
Asciiz string (C-string) which has a maximum of 32 characters. Even an empty string is a valid ID. If
an empty string is used as ID, the contents of the data memory are always copied into the destination
buffer. Otherwise only the data memory is copied when the same ID has been used for the filling.
Return value TRUE (1) if the global data memory has been found and the contents have been copied.
FALSE (0) if the global data memory has not been found and the contents have not been copied.
shdataget("myID",local);
Result -
file:///C:/Users/sgtma/AppData/Local/Temp/~hhF948.htm 7/16/2020
EDIABAS BEST Developer's Guide Page 147 of 161
EDIABAS BEST Developer's Guide > BEST/2 Function Primer > 5. Library functions
shdataset
Summary Fills the global data memory with the contents of the source buffer.
Remarks This function copies the entire contents of the destination buffer into the global data memory. The global
data memory is cleared prior to copying the contents. The ID (name) of the data memory is an Asciiz
string (C-string) with a maximum length of 32 characters. Even an empty string is a valid name.
When the data memory is subsequently read, either the passed ID or an empty string must be used.
The source buffer must not contain more than 1023 characters, otherwise the call will cause a runtime
error BIP_0001.
Return value -
shdataset("myID",source);
Result -
EDIABAS BEST Developer's Guide > BEST/2 Function Primer > 5. Library functions
stop_frequent
void stop_frequent()
Remarks This function terminates the repeat sending and receiving of telegrams.
Return value -
Example -
Result -
EDIABAS BEST Developer's Guide > BEST/2 Function Primer > 5. Library functions
strcat
Remarks The strcat function appends the string source to the existing zero-terminated string destin. Only so many
characters are appended so that destin including the zero character can fit in a string register, i.e.
maximum string register size – 1 characters. Both strings can have the length 0. The source string is
not changed.
file:///C:/Users/sgtma/AppData/Local/Temp/~hhF948.htm 7/16/2020
EDIABAS BEST Developer's Guide Page 148 of 161
Return value -
See also get_token, strcat, strcmp, strcpy, strcut, strerase, strinsert, strlen, strncpy, strrevers
Example {
char destin[]="01234";
char source[]="56789";
strcat(destin,source);
EDIABAS BEST Developer's Guide > BEST/2 Function Primer > 5. Library functions
strcmp
s1 String1 (V)
s2 String2
Remarks This function compares the two strings s1 and s2. If both strings are the same length and identical in all
characters, then the system decides they are equal, otherwise not equal.
See also get_token, strcat, strcmp, strcpy, strcut, strerase, strinsert, strlen, strncpy, strrevers
Example {
char s1[]="ABC";
x=strcmp(s1,"ABC");
y=strcmp(s1,"ABCD");
z=strcmp(s1,"abc");
EDIABAS BEST Developer's Guide > BEST/2 Function Primer > 5. Library functions
strcpy
file:///C:/Users/sgtma/AppData/Local/Temp/~hhF948.htm 7/16/2020
EDIABAS BEST Developer's Guide Page 149 of 161
Remarks strcpy copies the string source to destin. All characters of source up to the zero character are copied.
The target string destin is cleared first.
Return value -
See also get_token, strcat, strcmp, strcpy, strcut, strerase, strinsert, strlen, strncpy, strrevers
Example {
char destin[]="ABC";
strcpy(destin,"XD");
EDIABAS BEST Developer's Guide > BEST/2 Function Primer > 5. Library functions
strcut
Remarks strcut shortens string s by count characters. The string cannot be less than 0 characters long.
Return value -
See also get_token, strcat, strcmp, strcpy, strcut, strerase, strinsert, strlen, strncpy, strrevers
Example {
char buffer[]="ABCDF";
strcut(buffer,3);
EDIABAS BEST Developer's Guide > BEST/2 Function Primer > 5. Library functions
strerase
Remarks strerase erases any desired number of characters from a string. The remaining parts of the string are
joined together. count characters are erased from position pos. The operation stops when the string
end is reached, leaving just the string up to pos.
file:///C:/Users/sgtma/AppData/Local/Temp/~hhF948.htm 7/16/2020
EDIABAS BEST Developer's Guide Page 150 of 161
Return value -
See also get_token, strcat, strcmp, strcpy, strcut, strerase, strinsert, strlen, strncpy, strrevers
Example {
char buffer[]="ABCDEFGHIJKLM";
strerase(buffer,3,3);
Result buffer="ABCGHIJKLM"
EDIABAS BEST Developer's Guide > BEST/2 Function Primer > 5. Library functions
strinsert
Remarks strinsert inserts the string source into the string destin. The characters are inserted from position pos. If
the string destin is longer than a string register, i.e. string register size - 1 characters, the rest is cut
off.
Return value -
See also get_token, strcat, strcmp, strcpy, strcut, strerase, strinsert, strlen, strncpy, strrevers
Example {
char buffer[]="ABCGHIJKLM";
strinsert(buffer,"DEF",3);
EDIABAS BEST Developer's Guide > BEST/2 Function Primer > 5. Library functions
strlen
Remarks strlen identifies the length of a string. The length of a string is the number of characters it contains,
except the terminating zero.
See also get_token, strcat, strcmp, strcpy, strcut, strerase, strinsert, strlen, strncpy, strrevers
Example {
file:///C:/Users/sgtma/AppData/Local/Temp/~hhF948.htm 7/16/2020
EDIABAS BEST Developer's Guide Page 151 of 161
char string[]="ABCDEF"
long x;
x=strlen(string);
Result x=6
EDIABAS BEST Developer's Guide > BEST/2 Function Primer > 5. Library functions
strncpy
Remarks strncpy copies the string source to destin. If the string destin is longer than count, then only the first
count characters are copied. The target string is not cleared.
Return value -
See also get_token, strcat, strcmp, strcpy, strcut, strerase, strinsert, strlen, strncpy, strrevers
Example {
char destin[]="ABCDEFGH";
strncpy(destin,"XYZABCDEF",3);
EDIABAS BEST Developer's Guide > BEST/2 Function Primer > 5. Library functions
strrevers
Remarks strrevers turns the string round, i.e. the last character become the first and so on.
Return value -
See also get_token, strcat, strcmp, strcpy, strcut, strerase, strinsert, strlen, strncpy, strrevers
Example {
char destin[]="ABCDEFGH";
file:///C:/Users/sgtma/AppData/Local/Temp/~hhF948.htm 7/16/2020
EDIABAS BEST Developer's Guide Page 152 of 161
strrevers(destin);
EDIABAS BEST Developer's Guide > BEST/2 Function Primer > 5. Library functions
switch_channel
Remarks This function switches to the interface channel, which was given by channel and previously opened by
open_channel. The given interface channel becomes the active channel.
Return value -
channel=open_channel(0);
switch_channel(channel);
Result -
EDIABAS BEST Developer's Guide > BEST/2 Function Primer > 5. Library functions
tab_suche_index
Summary Searches in a table column for a value with the form 0x##
Remarks The function tab_suche_index converts value to a string with the form "0x##" and searches for it in the
column column. The search always begins with the second table line. If the search is successful the
function returns TRUE (<>0), otherwise FALSE (0). If the value is found, then the read pointer for
the table is on the line with the found value, if not it is on the last line in the table (important for
default values). The elements of this line can now be read using tabget. If the column does not exist
the error BIP_0010 (constant data access error) [4] is returned.
file:///C:/Users/sgtma/AppData/Local/Temp/~hhF948.htm 7/16/2020
EDIABAS BEST Developer's Guide Page 153 of 161
char buffer[];
tabset("TST");
tab_suche_index("NUMBER",3);
tabget(buffer,"NAME");
EDIABAS BEST Developer's Guide > BEST/2 Function Primer > 5. Library functions
tab_suche_unsigned
Remarks The function tab_suche_unsigned searches the unsigned value in the column. As value, an unsigned
value must be passed; otherwise, an internal arithmetical conversion (if necessary, with sign
extension) is carried through. The table elements of the column are internally converted into
numerical values and compared with the unsigned-long value. If a table element starts with the
characters "0x" or "0X", it is interpreted as a hexadecimal number. In all other cases, the table
element is interpreted as a decimal number. The searching process always starts in the second table
row. After a successful search, the function returns TRUE (<>0); otherwise, FALSE (0). If the value
was found, the reading pointer for the table points to the line where the value is located; if not, it
points to the last table row (this is important for default values). The elements in this row can then be
read out with tabget. If the column does not exist, the error BIP_0010 (Constant Data Access Error)
[4] is triggered.
char buffer[];
tabset("TST");
index=0x300;
tab_suche_unsigned("NUMMER",index);
tabget(buffer,"NAME");
file:///C:/Users/sgtma/AppData/Local/Temp/~hhF948.htm 7/16/2020
EDIABAS BEST Developer's Guide Page 154 of 161
EDIABAS BEST Developer's Guide > BEST/2 Function Primer > 5. Library functions
tab2fix
Summary Reads the values from the current table line and converts them into a number
Remarks The function tab2fix reads a value from the current table line defined with tabseek or tab_suche_index
and converts it into a number. The text of column indicates from which column the value must be
taken. If the column does not exist the error BIP_0010 (constant data access error)[4] is returned.
Return value -
tabset("FUmweltMatrix");
tab_suche_index("ORT", errorNo)
tab2fix(uw1, "UW1_NR");
Result -
EDIABAS BEST Developer's Guide > BEST/2 Function Primer > 5. Library functions
tabcolumns
long tabcolumns()
Remarks The function tabcolumns determines the number of the columns of the current table. The table
processing must have been initialized previously by tabset or tabsetext (otherwise a count of 0 will
be returned).
{ "NAME", "WERT" },
{ "EINS", "1000" },
long n;
tabset("TST");
n=tabcolumns(); // n = 2
EDIABAS BEST Developer's Guide > BEST/2 Function Primer > 5. Library functions
file:///C:/Users/sgtma/AppData/Local/Temp/~hhF948.htm 7/16/2020
EDIABAS BEST Developer's Guide Page 155 of 161
tabget
Remarks tabget reads a value from the current table line defined with tabseek or tab_suche_index. The value of
column indicates from which column value must be taken. If the column does not exist the error
BIP_0010 (constant data access error) [4] is returned.
Return value -
EDIABAS BEST Developer's Guide > BEST/2 Function Primer > 5. Library functions
tabline
Remarks tabline positions the read pointer on the specified line. The first line is numbered 0. If there is a line
which the number matches, the function return TRUE (!0), otherwise FALSE (0). If there is no line
which the number matches, the pointer is on the last line in the table (important for default values).
The elements of this line can now be read using tabget.
EDIABAS BEST Developer's Guide > BEST/2 Function Primer > 5. Library functions
tabrows
long tabrows()
Remarks The function tabrows determines the number of the rows (including header) of the current table. The
table processing must have been initialized previously by tabset or tabsetext (otherwise a count of 0
will be returned).
{ "NAME", "WERT" },
{ "EINS", "1000" },
file:///C:/Users/sgtma/AppData/Local/Temp/~hhF948.htm 7/16/2020
EDIABAS BEST Developer's Guide Page 156 of 161
long n;
tabset("TST");
n=tabrows(); // n = 3
EDIABAS BEST Developer's Guide > BEST/2 Function Primer > 5. Library functions
tabseek
Remarks The function tabseek searches for the string value in the column column. The search always begins with
the second table line. If the search is successful the function returns TRUE (!0), otherwise FALSE
(0). If the value is found, then the read pointer for the table is on the line with the found value, if not
it is on the last line in the table (important for default values). The elements of this line can now be
read using tabget. If the column does not exist the error BIP_0010 (constant data access error) [4] is
returned.
EDIABAS BEST Developer's Guide > BEST/2 Function Primer > 5. Library functions
tabset
Remarks Tables are constant two-dimensional arrays of strings. The values in the first line name the columns. A
value can be searched in each column (tabseek, tab_suche_index). Each column can be read out of
the line in which the value was found (tabget). Table processing must be initialized, and this is done
with tabset which sets processing to a certain table. The name of the table must be defined as a
string. After tabset, tabseek or tab_suche_index must be called first before tabget can be used. If
the table does not exist the error BIP_0010 (constant data access error) [4] is returned.
Return value -
See also tab_suche_index, tabget, tabseek, tabset, tabsetext
char buffer[];
tabset("TST");
file:///C:/Users/sgtma/AppData/Local/Temp/~hhF948.htm 7/16/2020
EDIABAS BEST Developer's Guide Page 157 of 161
tabseek("NAME","ONE");
tabseek("NUMBER","3");
Result -
EDIABAS BEST Developer's Guide > BEST/2 Function Primer > 5. Library functions
tabsetext
Remarks Tables are constant two-dimensional arrays of strings. The values in the first line name the columns.
Table processing must be initialized, and this is done with tabset which sets processing to a certain
table. Is the table located in a different SGBD tabsetext has to be used. The parameters determine the
name of the SGBD and the name of the table. If the table resides in the same SGBD set an empty
string for tabfile (same functionality as tabset).
The search for tabfile starts in ECU directory, first for a variant SGBD. If it fails, a group SGBD is
searched for.
After tabsetext, tabseek or tab_suche_index must be called first before tabget can be used. A value can
be searched in each column (tabseek, tab_suche_index). Each column can be read out of the line in
which the value was found (tabget). The function call of tabsetext and the function calls for table
access have to be in the same job.
Return value -
See also tab_suche_index, tabget, tabseek, tabset
Example tabsetext("file","TST"); // file.prg/grp
Result -
EDIABAS BEST Developer's Guide > BEST/2 Function Primer > 5. Library functions
uitoad
Remarks uitoad converts the number value to a string with decimal notation without a sign. No leading zeroes are
output.
Return value -
Example {
file:///C:/Users/sgtma/AppData/Local/Temp/~hhF948.htm 7/16/2020
EDIABAS BEST Developer's Guide Page 158 of 161
char destin[];
uitoad(destin,4294967295);
...
Result destin="4294967295"
EDIABAS BEST Developer's Guide > BEST/2 Function Primer > 5. Library functions
updateInfo
Remarks This function produces a string result which already can be interrogated as the job is being processed.
Return value -
See also -
Result -
EDIABAS BEST Developer's Guide > BEST/2 Function Primer > 5. Library functions
userbreak
void userbreak()
Remarks The function produces the error message "BIP-0008: BEST BREAK".
Return value -
Example userbreak();
Result -
EDIABAS BEST Developer's Guide > BEST/2 Function Primer > 5. Library functions
var_result_data
Remarks The function produces a data result with the result name name and the value value. The result name
name is determined first at runtime.
Return value -
file:///C:/Users/sgtma/AppData/Local/Temp/~hhF948.htm 7/16/2020
EDIABAS BEST Developer's Guide Page 159 of 161
var_result_data(resultname,resultvalue);
Result -
EDIABAS BEST Developer's Guide > BEST/2 Function Primer > 5. Library functions
var_result_long
Remarks The function produces a long result with the result name name and the value value. The result name
name is determined first at runtime.
Return value -
var_result_long(resultname,resultvalue);
Result -
EDIABAS BEST Developer's Guide > BEST/2 Function Primer > 5. Library functions
var_result_real
Remarks The function produces a real result with the result name name and the value value. The result name name
is determined first at runtime.
Return value -
real resultvalue;
file:///C:/Users/sgtma/AppData/Local/Temp/~hhF948.htm 7/16/2020
EDIABAS BEST Developer's Guide Page 160 of 161
ator(resultvalue,"1.23");
var_result_real(resultname,resultvalue);
Result -
EDIABAS BEST Developer's Guide > BEST/2 Function Primer > 5. Library functions
var_result_string
Remarks The function produces a string result with the result name name and the value value. The result name
name is determined first at runtime.
The value of the string result mustn’t contain more than 1023 characters, otherwise the call will cause a
runtime error BIP_0001.
Return value -
var_result_string(resultname,resultvalue);
Result -
EDIABAS BEST Developer's Guide > BEST/2 Function Primer > 5. Library functions
wait
Remarks The wait function waits time seconds. wait waits for a maximum of time seconds and a minimum of
time-1 seconds. If time = 0, there is no waiting.
Return value -
Example {
wait(1);
EDIABAS BEST Developer's Guide > BEST/2 Function Primer > 5. Library functions
waitex
file:///C:/Users/sgtma/AppData/Local/Temp/~hhF948.htm 7/16/2020
EDIABAS BEST Developer's Guide Page 161 of 161
Remarks The waitex function waits time milliseconds. If time = 0, there is no waiting. The precision depends on
the operating system.
Under Win16 waitex is based on an internal counter which can overrun after 2^32 milliseconds after
system start. In case of a counter overrun waitex is cancelled.
Example {
waitex(1000);
LIST OF REFERENCES
[1] EDIABAS: BEST/1 Language and Interpreter
file:///C:/Users/sgtma/AppData/Local/Temp/~hhF948.htm 7/16/2020