Intrinsic Functions And Statements; Program Flow Control - HP E1419A User Manual

Measurement and control module
Table of Contents

Advertisement

Intrinsic Functions
and Statements
Program Flow
Control
Conditional Constructs
Exiting the Algorithm
128 The Algorithm Language and Environment
The result of a comparison operation is a boolean value. It is still a type
float but its value is either 0 (zero) if false, or 1 (one) if true. You may test
any variable with the if statement. A value of zero tests false, if any other
value it tests true. For example:
/* if my_var is other than 0, increment count_var */
if(my_var) count_var=count_var+1;
The following functions and statements are provided in the HP E1419A's
Algorithm Language:
Functions:
abs(expression)
max(expression1,expression2)
min(expression1,expression2)
Statements:
interrupt()
writeboth(expression,cvt_loc)
writecvt(expression,cvt_loc)
writefifo(expression)
Program flow control is limited to the conditional execution construct using
if and else, and return. Looping inside an algorithm function is not
supported. The only "loop" is provided by repeatedly triggering the
HP E1419A. Each trigger event (either external, or internal Trigger Timer)
executes the main() function which calls each defined and enabled
algorithm function. There is no goto statement.
The HP E1419A Algorithm Language provides the if-else construct in the
following general form:
if (expression) statement1 else statement2
If expression evaluates to non-zero statement1 is executed. If expression
evaluates to zero, statement2 is executed. The else clause with its associated
statement2 is optional. Statement1 and/or statement2 can be compound
statement. That is { statement; statement; statement; ... }.
The return statement allows terminating algorithm execution before
reaching the end by returning control to the main() function. The return
return absolute value of expression
return largest of the two expressions
return smallest of the two expressions
sets VXI interrupt
write expression result to FIFO
and CVT element specified.
write expression result to CVT
element specified.
write expression result to FIFO.
Chapter 4

Advertisement

Table of Contents
loading

Table of Contents