CAPL4

18)  fileWriteString

Syntax             long fileWriteString(string section, string entry, string value, string filename);
Function         Opens the file filename, finds the section “section” and writes the variable entry with the value “value”. If entry already exists, the old value is overwritten. The functional result is the number of characters written, or 0 for an error.
Parameters     section = section of file
entry = name of variable
value = string to write
filename = name of data file (backslashes should be doubled, i.e. C:\\TEMP\\DATA.LOG”)
Returns          Number of written characters of 0 if an error has occurred.
Example
if(!fileWriteString(“Device”, “DeviceName”, “LPT1”, “test.ini”))
write(“File error”);
...
This call writes the following entry in the file TEST.INI: [Device]
DeviceName=LPT1
See also fileReadArray, fileReadInt, fileReadFloat, fileReadString, fileWriteInt, fileWriteFloat
Compatibility This function has restricted compatibility. Please see the function compatibility chart for more details.

19)  getCardType

Syntax             long getCardType();
Function         Determines the type of CAN platform being used. Is needed e.g. to program the BTR (Bit Timing Register) and OCR (Output Control Register) values.
Parameters     None
Returns          Type of board as one of the following values:
0 DBB196 - Daimler-Benz Board with FullCAN
1 DBB196B – Daimler-Benz Board with BasicCAN
2 CANIB - Bosch CANIB
3 DEMO - Demo driver
6 CANAC2 - Softing AC2/200/ANA
7 CANAC2X - Softing AC 2/527/ANA
8 CPC/PP - EMS wish module
9 INDIGO - Silicon Graphics Indigo2
10 CANCARD - PCMCIA 11 Bit
11 CANCARDX - PCMCIA 29 Bit
12 CANAC2B - Softing AC2/527 11 Bit
13 VAN462 - NSI VAN card
14 VANDEMO - VAN Demo driver
Additional types may be added in future versions of CAPL.
Example
...
switch(getCardType()) {
case 6: setOcr(0,0x02); // CANAC2
break;
case ...
default:
write(“Unknown driver %d”, getCardType());
break;
}
...
See also getChipType

20)  getChipType

Syntax             long getChipType(long channel);
Function         Determines the type of CAN controller used.
Parameter      channel:           0 = both controllers
1 = Channel 1
2 = Channel 2
Returns          Type of controller with the following values:  5 NEC 72005, 200 Philips PCA82C200,                              462 MHS29C462 VAN Controllers, 526 Intel 82526, 527 Intel 82527.
Other types may occur. Demo versions return the result 0 or simulate one of the existing types. If an attempt is made to access a nonexistent channel (e.g. Channel 2 for CPC/PP) or if the driver used does not support this function, the functional result is 0.
Example
...
switch(getChipType( )) {
case 200: setOcr(0,0x02); // Philips PCA82C200
break;
case ...
default:
write(“Unknown CAN chip type: %d”,
getChipType());
break;
}
...
See also getCardType

21)  getLocalTime

Syntax              getLocalTime(long timeArray[]);
Function         Fills an array of type long with details of the date and time. The entries of the array will be filled with the following information:
Array entry Meaning Range of values
            timeArray[0] Seconds 0 – 59
            timeArray[1] Minutes 0 – 59
            timeArray[2] Hours 0 – 23
            timeArray[3] Day of the month 1 – 31
            timeArray[4] Month of year 0 – 11 (January is 0, etc.)
            timeArray[5] Year (since 1900) 0...
            timeArray[6] Day of week 0 – 6 (Sunday is 0, etc.)
            timeArray[7] Day of year 0 – 365
            timeArray[8] Daylight Savings Time 0 = Not Daylight Savings Time
               1 = Daylight Savings Time
Parameters     An array of type long with at least 9 entries.
Returns          Nothing
Example
long timeArray[9]; // Array to hold time information
getLocalTime(timeArray);
write(“It is %d:%d:%d on %d/%d/%d.”,
timeArray[2], timeArray[1], timeArray[0],
timeArray[4] + 1, timeArray[3], timeArray[5]);
Above code prints:
It is 16:23:31 on 8/25/99.
See also getLocalTimeString
Compatibility This function can only be used in P-Blocks located in the analysis branch of CANalyzer’s Measurement Setup window or in P-Blocks in CANoe’s Measurement Setup window.

22)  getLocalTimeString

Syntax              getLocalTimeString(char timeBuffer[]);
Function         Copies a string representation of the current date and time into the supplied character buffer. The format of the string is ddd mmm dd hh:mm:ss yyyy (e.g., “Fri Aug 21 15:22:24 1998"). The string is null-terminated.
Parameters     The buffer in which the string will be written. This buffer must be at least 26 characters long. Unpredictable results will occur if the buffer is not at least 26 characters long.
Returns          none
Example ...
char timeBuffer[64];
getLocalTimeString(timeBuffer);
// The timeBuffer will now contain, for
// example, Fri Aug 21 15:22:24 1998
...
See also getLocalTime
Compatibility This function can only be used in P-Blocks located in the analysis branch of CANalyzer’s Measurement Setup window or in P-Blocks in CANoe’s Measurement Setup window.

23)  getThisMessage

Syntax             etThisMessage(pg pg_variable, int length);
Function       Transfers the parameter group to the indicated parameter group pg. The number of bytes of the transmitted parameter group data is given by length. This function must be used exclusively within the program block, and is only used with J1939 buses.
Parameters     Variable of the type “pg”,
Length entry of the type “int”
Return            None
Example
pg TC1 pg_tc1; // Definition of a parameter group
on pg * { // Event procedure for all parameter
// groups
if (pg.pgn == TC1) {// If the received parameter group is
// TC1
// Transfer the received parameter group to the variable
GetThisMessage(pg_tc1, pg_tc1.dlc);
}

24)  getValue

Syntax             int getValue(EnvVarName);
float getValue(EnvVarName);
void getValue(EnvVarName, char buffer[]);
Function         Determines the value of the environment variable with identifier EnvVarName. The type of the return value is based on the type of environment variable (int for discrete (Form 1), float for continuous environment variables (Form 2)). For character string environment variables (Form 3) the active value is saved to a buffer which you identify in the function call.
Parameters     Environment Variable name for Forms 1 and 2. Environment variable name and return buffer for Form 3.
Returns          Active value of the environment variable for Forms 1 and 2. No return value for Form 3.
Example
int val;
float fval;
char buff[25];
...
// Assign to val the value of the environment
// variable “Switch”
val = getValue(Switch);
// Assign to fval the value of
// the environment variable “Temperature”
val = getValue(Temperature);
// Read the value of environment variable
“NodeName”
val = getValue(NodeName, buff);
See also putValue

Compatibility This function has restricted compatibility. Please see the function compatibility chart for more details.

No comments:

Post a Comment