The Operations Symbols; Conditional Execution - HP VXI 75000 C Series User's And Scpi Programming Manual

Algorithmic closed loop controller
Table of Contents

Advertisement

The Operations
Symbols
The Arithmetic Operators
Unary Arithmetic
Operator
The Comparison
Operators
The Logical Operators
Conditional
Execution
148 Algorithm Language Reference
Many of the operation symbols are the same, and are used the same way as
those in BASIC. However there are differences, and they can cause
programming errors until you get used to them.
The arithmetic operators available to the HP E1415 are the same as those
equivalents in BASIC:
+
(addition)
*
(multiplication)
Again same as BASIC:
-
(unary minus)
+
(unary plus)
Here there are some differences.
BASIC
=
(is equal to)
<> or # (is not equal to)
>
(is greater than)
<
(is less than)
>=
(is greater than or equal to) >=
<=
(is less than or equal to)
A common 'C' programming error for BASIC programmers is to
inadvertently use the assignment operator "=" instead of the comparison
operator "==" in an if statement. Fortunately, the HP E1415 will flag this as
a Syntax Error when the algorithm is loaded.
There are three operators. They are very different from those in BASIC.
BASIC
Examples
AND
IF A=B AND B=C
OR
IF A=B OR A=C
NOT
IF NOT B
The HP E1415 Algorithm Language provides the if - else construct for
conditional execution. The following figure compares the elements of the 'C'
if - else construct with the BASIC if - then - else - end if construct. The
general form of the if - else construct is:
if(expression) statement1 else statement2
where statement1 is executed if expression evaluates to non-zero (true), and
statement2 is executed if expression evaluates to zero (false). Statement1
and/or statement2 can be compound statements. That is, multiple simple
statements within curly braces. See Figure 5-1
-
(subtraction)
/
(division)
Examples:
a = b + (-c)
a = c + (+b)
'C'
Notes
==
Different (hard to remember)
!=
Different but obvious
>
Same
>
Same
Same
<=
Same
'C'
Examples
&&
if( ( a == b )&&( b == c ) )
| |
if( ( a == b ) | | ( a == c ) )
!
if ( ! b )
Chapter 5

Advertisement

Table of Contents
loading

This manual is also suitable for:

Vxi e1415a

Table of Contents