1)  abs

Syntax             int abs(int num);
long abs(long num);
 double abs(double num);
Function         This function returns the absolute value of a signed number.
Note                This Function is not necessary for the unsigned byte type.
Parameter      Number to be converted.
Returns          Integer, long integer, or double. Return type matches the parameter type.
int one = -1;
long two = -2;
double three = -3.0;
write(“%d %d %lf”, abs(one), abs(two), abs(three));
This prints “1 2 3.000000” in the Write window.

2)  atol

Syntax             long atol(string s);
Function         This function converts the string “s” to a long number. The number base is Decimal. If the string starts with “0x”, base 16 is used. Leading blanks are discarded.
Parameter      String to be converted
Returns          Long integer
long z1;
long z2;
z1 = atol(“200”);
z2 = atol(“0xFF”);
Result: z1 = 200, z2 = 255

3)  beep

Syntax             beep(int freq, int duration);
Function         Output a tone to the computer’s speaker.
Parameters     freq = integer for tone pitch.
duration = integer for tone duration
In the Windows version, the parameters freq defines the tone output.
Different sounds are defined in the section [SOUND] in the file WIN.INI:
freq = 0x0000 (SystemDefault)
freq = 0x0010 (SystemHand)
freq = 0x0020 (SystemQuestion)
freq = 0x0030 (SystemExclamation)
freq = 0x0040 (SystemAsterisk)
freq = 0xFFFF Standard Beep
Note                If you do not have a sound card installed in your computer, Windows will generate a                                normal system beep. In this case, the freq parameter has no effect.
Returns          none
void sound() {
// with soundcard: 400 Hz beep
// without soundcard: standard system beep
beep (400,0);

4)  callAllOnEnvVar

Syntax             callAllOnEnvVar();
Function         Calls all event procedures for environment variables (onEnvVar). This can be necessary at the start of measurement to initialize environment variables, to start timers activated in response to changes of environment variables, or to send messages on the bus with the start values of the environment variables.
Parameters     none
Returns          none
on start
See also putValue

5)  cancelTimer

Syntax                        cancelTimer(msTimer t);
cancelTimer(timer t);
Function         Stops an active timer that has been set with setTimer(). This prevents the timer event procedure from being executed. If called on a timer that is not set, this function has no effect.
Parameter      timer or msTimer variable
Returns          none
variables {
msTimer msgTimer;
message dataMsg dMsg;
on timer msgTimer {
setTimer(msgTimer, 200);
on key F1 {
cancelTimer(msgTimer); // cancel timer
write(“msgTimer canceled”);
on key F2 {
setTimer(msgTimer, 200); // set timer to 200 ms
write(“msgTimer started”);
See also setTimer

No comments:

Post a Comment