Summary Converts data bytes into a real number
void data_to_real(real destin, char source[], long pos, long double, long byteorder);
destin Real number for recording the conversion result (V) source Source buffer (V)
pos Position of the 1st data byte in the source buffer double Real number precision:
0 = single-precision (4 data bytes IEEE)
<> 0 = double-precision (8 data bytes IEEE) byteorder Memory format in the source buffer:
0 = Little Endian (Intel)
<> 0 = Big Endian (Motorola)
Note The data_to_real function converts 4 (double=0) or 8 data bytes (double=1) of the source buffer source into the real number destin as of the indicated buffer position.
Return value -
See also real_to_data
Example {
unsigned char buffer[];
real realzahl;
buffer = { 0x66, 0xe6, 0xf6, 0x42 };
data_to_real(realzahl,buffer,0,0,0);
... }
Result realzahl = 123.45
datacat
Summary Appends data bytes to a buffer
void datacat(unsigned char buffer[], unsigned char bytes[]) buffer Buffer to which the data bytes are appended (V) bytes Data bytes which are appended
Remarks This function appends data bytes to a buffer.
Return value -
See also dataclear, datacopy, datacmp, dataerase, datainsert, datalen, datarevers, dataset
Example
unsigned char buffer1[];
unsigned char buffer2[];
buffer1 = {0x01, 0x02, 0x03};
buffer2 = {0x04, 0x05, 0x06};
datacat(buffer1, buffer2);
Result buffer1 = {0x01, 0x02, 0x03, 0x04, 0x05, 0x06};
46
dataclear
Summary Clears a buffer
void dataclear(unsigned char buffer[]) buffer Data buffer (V)
Remarks This function clears a data buffer.
Return value -
See also datacat, datacopy, datacmp, dataerase, datainsert, datalen, datarevers, dataset
Example
unsigned char buffer[];
buffer = {0x01, 0x02, 0x03};
dataclear(buffer);
Result buffer = {};
datacmp
Summary Compares two data buffers long datacmp(char d1[],char d2[]) d1 Data buffer 1 (V) d2 Data buffer 2
Remarks The function compares the two data buffers d1 and d2. If the two buffer have the same length and contain identical characters, they are considered equal, otherwise unequal.
Return value 0 if both data buffers are equal, <> 0 if not equal.
See also datacat, dataclear, datacopy, dataerase, datainsert, datalen, datarevers
Example
{
int x; int y; int z;
unsigned char d1[];
d1 = {1,2,3}
x=datacmp(d1,{1,2,3});
y=datacmp(d1,{1,2,3,4});
z=datacmp(d1,{1,2,4});
}
Result x=0, y=1, z=1
48
datacopy
Summary Copies data from a source buffer to a target buffer void datacopy(char destin[], char source[], long pos, long count) destin Target buffer (V)
source Source buffer
pos Start position in source buffer count Number of characters to be copied
Remarks The datacopy function copies count characters from position pos from the source buffer source to the target buffer destin. Up to 1024 characters can be copied.
Value ranges: 0 <= pos < 1024
0 <= count <= 1024
pos+count < 1024
Exceeding the value range causes runtime error BIP_0001.
Return value -
See also datacat, dataclear, datacmp, dataerase, datainsert, datalen, datarevers, dataset
Example
{ char source[]= { 0x12, 0x34, 0x56, 0x78, 0x90 };
char destin[];
datacopy(destin,source,2,3);
...
}
Result destin={0x56,0x78,0x90}
dataerase
Summary Erase data from a buffer
void dataerase (char buffer[],int pos,int count);
buffer Buffer to be modified (V)
pos Position at which erasing is to begin count Number of characters to be erased (C)
Remarks The function dataerase erases an arbitrary number of characters from a buffer. The remaining parts of the buffer are combined. Count characters will be erased beginning at position pos. The process is aborted when the end-of-buffer is reached.
Only the buffer to pos then remains as the rest.
Return value -
See also datacat, dataclear, datacopy, datacmp, datainsert, datalen, datarevers, dataset
Example
{ char buffer[] = { 0x12,0x34,0xFF,0x56,0x78 };
dataerase(buffer,1,2);
...
}
Result destin={ 0x12,0x56,0x78 }
50
datainsert
Summary Inserts data in a buffern
void datainsert (char destin[],char source[],int pos);
destin Buffer to be modified (V) source Buffer to be inserted
pos Position to be inserted to
Remarks The function datainsert inserts the buffer source into the buffer destin. Insertion is made beginning with position pos. If the buffer destin becomes longer than a string register
(i.e., 1023 characters), this causes a runtime error BIP_0001.
Return value -
See also datacat, dataclear, datacopy, datacmp, dataerase, datalen, datarevers, dataset
Example
{ char source[] = { 0xF0,0xF1 };
char destin[] = { 0x12,0x34,0x56,0x78 };
datainsert(destin,source,3);
...
}
Result destin={ 0x12,0x34,0x56,0xF0,0xF1,0x78 }
datalen
Summary Identifies the buffer length long datalen(unsigned char buffer[])
buffer Buffer whose length is to be identified
Remarks This function identifies the length (number of characters) of a data buffer.
Return value Number of characters in the buffer.
See also datacat, dataclear, datacopy, datacmp, dataerase, datainsert, datarevers, dataset
Example
long length;
unsigned char buffer[];
buffer = {0x01, 0x02, 0x03, 0x04};
length = datalen(buffer);
Result length = 4
52
datarevers
Summary Reverses a data buffer void datarevers(unsigned char buffer[])
buffer Buffer whose data bytes are to be reversed (V)
Remarks This function reverses the sequence of data bytes in a buffer.
Return value -
See also datacat, dataclear, datacopy, datacmp, dataerase, datainsert, datalen, dataset
Example
unsigned char buffer[];
buffer = {0x01, 0x02, 0x03, 0x04};
datarevers(buffer);
Result buffer = {0x04, 0x03, 0x02, 0x01}
dataset
Summary Sets the bytes in a buffer to a defined value void dataset(char destin[],char data, long count)
destin Target buffer (V) data Character to be set
count Number of bytes to be set
Remarks This function sets the number of bytes specified by count to the value data in the target buffer destin.
Values ranges: 0 <= count < 1024
Exceeding the value range causes runtime error BIP_0001.
Return value -
See also datacat, dataclear, datacopy, datacmp, dataerase, datainsert, datalen, datarevers
Example
{ char buffer[]={ 0x12, 0x34, 0x56, 0x78, 0x90 };
dataset(buffer,0x41,2};
...
}
Result buffer ={ 0x41, 0x41, 0x56, 0x78, 0x90 }
54
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 -
enableIfhTrace
Summary Enable/disable the IFH-Trace void enableIfhTrace(long enable)
enable 0 = disable / <>0 = enable
Remarks This function either enables or disables the IFH-Trace. After changing the ECU description file, this setting is reset again to the application default.
Return value -
See also enableIgnitionHandling, enableUbattHandling, getCfgInt, getCfgString, IsDebugLevel, IsSimulation Example
unsigned char buffer[];
enableIfhTrace(1);
iftype(buffer);
enableIfhTrace(0);
Result -
56
enableIgnitionHandling
Summary Enable/disable ignition monitoring void enableIgnitionHandling(long enable) enable 0 = disable / <>0 = enable
Remarks This function either enables or disables the ignition monitoring. If monitoring is enabled, the error "IFH-0016: IGNITION ON/OFF ERROR" is issued after disabling the ignition at the next interface communication. The current value can be read with
"getCfgInt("IgnitionHandling"). After the ECU description file is changed, this setting is reset again to the application default.
Return value -
See also enableIfhTrace, enableUbattHandling, getCfgInt, getCfgString, IsDebugLevel, IsSimulation
Example
unsigned char buffer[];
enableIgnitionHandling(0);
iftype(buffer);
enableIgnitionHandling(1);
Result -
enableUbattHandling
Summary Enable/disable battery monitoring void enableUBattHandling(long enable) enable 0 = disable / <>0 = enable
Remarks This function either enables or disables the battery monitoring. If monitoring is enabled, the error "IFH-0015: UBATT ON/OFF ERROR" is issued after disabling the battery voltage at the next interface communicaiton. The current value can be read with
"getCfgInt("UBattHandling");". After the ECU description file is changed, this setting is reset again to the application default.
Return value -
See also enableIfhTrace, enableIgnitionHandling, getCfgInt, getCfgString, IsDebugLevel, IsSimulation
Example
unsigned char buffer[];
enableUbattHandling(0);
iftype(buffer);
enableUbattHandling(1);
Result -
58
fclose
Summary Closes a file void fclose(int handle)
handle Reference to a file opened by fopen (V)
Remarks The fclose function closes a file opened with fopen. No further file operations are possible after fclose. Error BIP_0006 is activated in the event of an error (failure by EDIABAS host file system) [4].
Return value -
See also fopen, fread, freadln, fseek, fseekln, ftell, ftellln Example
int { handle;
handle=fopen("\test\div\test.dat");
...
/* file operations */
...
fclose(handle);
}
Result -
fopen
Summary Opens a text file int fopen(char filename[])
filename Name of file to be opened
Remarks Opens the specified text file for reading. Up to 5 files can be opened at the same time. A so-called filehandle is returned if the open is successful. The filehandle refers to that and only that opened file and must be specified with all other file operations.
When opened, the file's read pointer is moved to the first character of the file. Error BIP_0006 is activated in the event of an error (failure by EDIABAS host file system) [4].
Return value Filehandle
See also fclose, fread, freadln, fseek, fseekln, ftell, ftellln Example
{
int handle;
handle=fopen("/usr2/test/test.dat");
...
/* file operations with handle */
...
fclose(handle);
}
Result -
60
fread
Summary Reads a single character from a file long fread(int handle)
handle Reference to a file opened with fopen (V).
Remarks The fread function reads a character from a file. It reads from the current position of the read pointer. The read pointer is incremented by 1 after the character is read. If an attempt was made to read at the end of a file, then -1 is returned as the value of the character and the read pointer is no longer incremented.
Return value The read character (0x00 - 0xff) or -1.
See also fclose, fopen, freadln, fseek, fseekln, ftell, ftellln Example
int { handle;
long c; long i=0;
handle=fopen("test.dat");
while((c=fread(handle)) != -1)
i++;
}
Result i = number of read characters
freadln
Summary Reads a line from a file long freadln(char line[],int handle)
line Buffer to accept the read line (V)
handle Reference to a file opened with fopen (V).
Remarks The freadln function reads a line from a file. A line is all characters up to an LF character. It reads from the current position of the read pointer. After the line is read the read pointer is incremented until it points to the beginning of the next line. The function returns the length of the line. If an attempt was made to read at the end of a file, then -1 is returned as the length of the line and the read pointer is no longer incremented. Error BIP_0006 is activated in the event of an error (failure by EDIABAS host file system) [4].
Up to 1024 characters per line are allowed!
Return value The number of characters in the read line.
See also fclose, fopen, fread, fseek, fseekln, ftell, ftellln Example
int { handle;
char line[]; long i=0;
handle=fopen("beispiel.txt");
while(freadln(line,handle) != -1 )
i++;
}
Result i = number of read lines
62
fseek
Summary Sets the position of the read pointer byte by byte long fseek(long pos,int handle)
pos New position of the read pointer in the file handle Reference to a file opened with fopen (V).
Remarks The fseek function positions the read pointer on a certain byte in a file. It is always positioned right at the start of the file. The position of the first character is 0. Error BIP_0006 is activated in the event of an error (failure by EDIABAS host file system) [4].
Return value The new position in the file.
See also fclose, fopen, fread, freadln, fseekln, ftell, ftellln
Example
int { handle;
int c;
handle=fopen("Filename");
c=fread(handle);
fseek(0,handle);
c=fread(handle);
...
}
Result The first character in the file is read twice.
fseekln
Summary Sets the position of the read pointer line by line long fseekln(long pos,int handle)
pos New line position of the read pointer in the file handle Reference to a file opened with fopen (V)
Remarks The fseekln function positions the read pointer on a certain line in a file. It is always positioned right at the start of the file. The number of the first line is 0. Error BIP_0006 is activated in the event of an error (failure by EDIABAS host file system) [4].
Return value The new line position in the file.
See also fclose, fopen, fread, freadln, fseek, ftell, ftellln Example
int { handle;
char line;
handle=fopen("test.txt");
fseekln(10,handle);
freadln(line,handle);
...
}
Result The 11th line of the file is read.
64
ftell
Summary Identifies the position of the read pointer long ftell(int handle)
handle Reference to a file opened with fopen (V)
Remarks The ftell function identifies the current position of the read pointer in bytes from the start of a file. The position of the first character is 0. Error BIP_0006 is activated in the event of an error (failure by EDIABAS host file system) [4].
Return value The current position in the file.
See also fclose, fopen, fread, freadln, fseek, fseekln, ftellln Example
int { handle;
long c:
handle=fopen("Filename");
c=fread(handle);
c=fread(handle);
...
c=ftell(handle);
}
Result c=2, 2 bytes were read.
ftellln
Summary Identifies the position of the read pointer in lines long ftellln(int handle)
handle Reference to a file opened with fopen (V)
Remarks The ftellln function identifies the current position of the read pointer in lines from the start of a file. The position of the first line is 0. Error BIP_0006 is activated in the event of an error (failure by EDIABAS host file system) [4].
Return value The current position in the file.
See also fclose, fopen, fread, freadln, fseek, fseekln, ftell Example
int { handle;
char line[];
handle=fopen("xxx.tst");
freadln(line,handle);
freadln(line,handle);
...
c=ftellln(handle);
}
Result c=2, 2 lines were read.
66
getasciitime
Summary Determines the current time as ASCII-String
void getasciitime(char time[])
time String buffer to take up the time string (v)
Remarks Determines the current time from the system time as a string of the following form:
"hh:mm:ss"
Return value -
See also getasciidate, getdate, gettime, wait
Example {
char time[];
getasciitime(time);
... }
Result time="12:51:15" (example)