CAPL8

46)  setMsgTime

Syntax            setMsgTime(message m1, NOW);
                        setMsgTime(message m1, message m2);
Function         Assigns to the message m1 the capture time of message m2 or the current time. This                                  function is obsolete and only serves to establish compatibility with older versions.
Parameters     Variable of type message and another variable of type message or “now”.
Returns          none
Note                This function has been made obsolete by the TIME message selector. See the section on message selectors for more information.

47) setOcr

Syntax                        setOcr(long channel, byte ocr);
Function         Sets the CAN controller’s Output Control Register. The values do not become active until the next call of the function resetCan(). It should be noted that these values depend on the                       CAN platform used.
Parameters     CAN-Channel: 0 = both controllers
                                               1 = Channel 1
                                               2 = Channel 2
                        OCR: Value of the Output Control Registers
Returns          none
Example
...
setOcr(0, 0x02); // set
resetCan(); // activate
...
See also resetCan, setBtr
Compatibility This function has restricted compatibility. Please see the function compatibility chart for more details.

48) setPostTrigger

Syntax               setPostTrigger(long preTriggerTime);
Function         Set the posttrigger of the logging. The posttrigger set with this function is valid until the end of the measurement or until the next call of this function.
Parameters     New posttrigger value in milliseconds. If a value of -1 is supplied, the prosttrigger will be   set to infinity.
Returns          1, if the posttrigger is set to the given value, 0 else.
Example
// Set the posttrigger time of the logging to 2.5 seconds.
...
setPostTrigger(2500);
...
// Set the posttrigger of the logging to infinity.
...
setPostTrigger(-1);
...
See also setPreTrigger, trigger
Compatibility This function has restricted compatibility. Please see the function compatibility chart for more details.

49)  setPreTrigger

Syntax             setPreTrigger(long preTriggerTime);
Function         Set the pretrigger of the logging. The pretrigger set with this function is valid until the                               end of the measurement or until the next call of this function.
Parameters     New pretrigger value in milliseconds.
Returns          1, if the pretrigger is set to the given value, 0 else.
Example
...
setPreTrigger(25);
...
Set the pretrigger time of the logging to 25 milliseconds.
See also setPostTrigger, trigger
Compatibility This function has restricted compatibility. Please see the function compatibility chart for more details.

50) setTimer

Syntax             setTimer(msTimer t, long duration);
                        setTimer(timer t, long duration);
Function         Set a timer, which can be either Timer type or msTimer type.
Parameters     Variable of type Timer or msTimer and the duration of the timer in units of seconds or                              milliseconds, respectively.
Returns          None
Example
variables {
Timer t1;
}
on start {
setTimer(t1, 5); // Initialize a 5-second cyclic timer
}
on timer t1 {
. . .
setTimer(t1, 5); // Reset timer for another 5 seconds
}

51) sin

Syntax             double sin(double x);
Function         Calculate sine of x.
Parameters     Value in radians whose sine is to be calculated.
Note                To convert degrees to radians, multiply degrees by PI/180.
Returns          Sine of x
Example
double x;
x = sin(PI); // x equals 0, PI is a built-in
constant
double tangent(double x) {
return sin(x) / cos(x);
}
See also cos, exp, sqrt

52)  snprintf

Syntax                long snprintf(string dest, long len, string format, ...);
Function         This function corresponds to the C function sprintf. In addition, the parameter len                                    indicates the maximum length of the array dest. The overall length of the resulting string dest may not exceed 100.
Parameters     Similar to the write() function, this function can take a variable number of arguments.                           There should be an additional parameter after the format parameter for each of the                            string formatting expressions used in the format string. The string formatting                                         expressions  are the same used for the write() function and are listed here:
                        Legal String Formatting Expressions
                        "%ld" or "%d" decimal display
                        "%lx" or "%x" hexadecimal display
                        "%lX" or "%X" hexadecimal display (with upper case letters)
                        "%lu" or "%u" unsigned display
                        "%lo" or "%o" octal display
                        "%s" displays a string
                        "%g" or "%lf" floating point display
                        "%c" displays a character
                        "%%" display %-character
Returns The length of the destination string.
Example
char infoStr[100];
int vol = 55;
byte bal = 3;
long res;
res = snprintf(infoStr, 100, “Volume = %d, Balance = %u”, vol, bal);
Result: res = 24, infoStr = “Volume = 55, Balance = 3”
See also write
Compatibility This function has restricted compatibility. Please see the function compatibility chart for more details.

53)  sqrt
Syntax             double sqrt(double x);
Function         Calculate the square root of the parameter
Parameter      Value whose square root is to be calculated
Example
double x;
x = sqrt(4.0); // Result 2.0
See also cos, sin, exp

54)  stop

Syntax             stop();
Function         Programmed interrupt of the ongoing measurement
Parameters     none
Returns          none
Example
...
if( isExtId(this) )
stop(); // End measurement if we find an extended
ID
...

See also trigger

No comments:

Post a Comment