Comment Lines; Overall Program Structure - HP VXI 75000 C Series User's And Scpi Programming Manual

Algorithmic closed loop controller
Table of Contents

Advertisement

Comment Lines

Overall Program
Structure
/*
Example Algorithm to show language elements in the context of a complete
custom algorithm.
Program variables:
Program Function:
Algorithm returns user_flag in CVT element 330 and another value in CVT element 331
each time the algorithm is executed.
When user_flag = 0, returns zero in CVT 331.
150 Algorithm Language Reference
Note that in 'C' "else" is part of the closest previous "if"statement. So the
example:
if( x ) if( y ) z = 1; else z = 2;
executes like:
if( x ){
if( y ){
z = 1;
}
else{
z = 2;
}
}
Probably the most important element of programming is the comment. In
older BASIC interpreters the comment line began with "REM" and ended at
the end-of-line character(s) (probably carriage return then linefeed). Later
BASICs allowed comments to also begin with various "shorthand"
characters such as "!", or "'". In all cases a comment ended when the
end-of-line is encountered. In 'C' and the Algorithm Language, comments
begin with the the two characters "/*" and continue until the two characters
"*/" are encountered. Examples:
/* this line is solely a comment line */
if ( a != b) c = d + 1; /* comment within a code line */
/* This comment is composed of more than one line.
The comment can be any number of lines long and
terminates when the following two characters appear
*/
About the only character combination that is not allowed within a comment
is "*/", since this will terminate the comment.
The preceding discussion showed the differences between individual
statements in BASIC and 'C'. Here we will show how the HP E1415's
Algorithm Language elements are arranged into a program.
Here is a simple example algorithm that shows most of the elements
discussed so far.
user_flag
Set this value with the SCPI command ALG:SCALAR.
user_value
Set this value with the SCPI command ALG:SCALAR.
not like:
if( x ){
if ( y ){
z = 1;
}
}
else{
z = 2;
}
Chapter 5

Advertisement

Table of Contents
loading

This manual is also suitable for:

Vxi e1415a

Table of Contents