218 Creating and Running Algorithms
Chapter 6
The Operations
Symbols
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 the differences become familiar.
The Arithmetic Operators
The arithmetic operators available to the VT1422A are the same as those
equivalents in BASIC:
+
(addition)
-
(subtraction)
*
(multiplication)
/
(division)
Unary Arithmetic
Operator
Again same as BASIC:
-
(unary minus)
Examples:
a = b + (-c)
+
(unary plus)
a = c + (+b)
The Comparison
Operators
Here there are some differences.
BASIC
'C'
Notes
=
(is equal to)
==
Different (hard to remember)
<> or #
(is not equal to)
!=
Different but obvious
>
(is greater than)
>
Same
<
(is less than)
>
Same
>=
(is greater than or equal to)
>=
Same
<=
(is less than or equal to)
<=
Same
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 VT1422A will flag this as
a Syntax Error when the algorithm is loaded.
The Logical Operators
There are three operators. They are very different from those in BASIC.
BASIC
Examples
'C'
Examples
AND
IF A=B AND B=C
&&
if( ( a == b )&&( b == c ) )
OR
IF A=B OR A=C
| |
if( ( a == b ) | | ( a == c ) )
NOT
IF NOT B
!
if ( ! b )
Conditional
Execution
The VT1422A 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 6-5).
Summary of Contents for VT1422A
Page 2: ...This page is blank...
Page 8: ...8 Notes...
Page 22: ...22 Support...
Page 57: ...Field Wiring 57 Chapter 2...
Page 58: ...58 Field Wiring Chapter 2...
Page 96: ...94 Programming the VT1422A VT1529A B for Remote Strain Measurement Chapter 3...
Page 162: ...160 Programming the VT1422A for Data Acquisition and Control Chapter 4...
Page 224: ...222 Creating and Running Algorithms Chapter 6...
Page 419: ...VT1422A Command Reference 417 Chapter 7 Notes...
Page 420: ...418 VT1422A Command Reference Chapter 7 Notes...
Page 425: ...Specifications 423 Appendix A Thermocouple Type E 200 800 C SCPs VT1501 02 03A...
Page 426: ...424 Specifications Appendix A Thermocouple Type E 200 800 C SCPs VT1508 09A...
Page 427: ...Specifications 425 Appendix A Thermocouple Type E 0 800 C SCPs VT1501A 02A 03A...
Page 428: ...426 Specifications Appendix A Thermocouple Type E 0 800 C SCPs VT1508A 09A...
Page 429: ...Specifications 427 Appendix A Thermocouple Type E Extended SCPs VT1501A 02A 03A...
Page 430: ...428 Specifications Appendix A Thermocouple Type E Extended SCPs VT1508A 09A...
Page 431: ...Specifications 429 Appendix A Thermocouple Type J SCPs VT1501A 02A 03A...
Page 432: ...430 Specifications Appendix A Thermocouple Type J SCPs VT1508A 09A...
Page 433: ...Specifications 431 Appendix A Thermocouple Type K SCPs VT1501A 02A 03A...
Page 434: ...432 Specifications Appendix A Thermocouple Type R SCPs VT1501A 02A 03A...
Page 435: ...Specifications 433 Appendix A Thermocouple Type R SCPs VT1508A 09A...
Page 436: ...434 Specifications Appendix A Thermocouple Type S SCPs VT1501A 02A 03A...
Page 437: ...Specifications 435 Appendix A Thermocouple Type S SCPs VT1508A 09A...
Page 438: ...436 Specifications Appendix A Thermocouple Type T SCPs VT1501A 02A 03A...
Page 439: ...Specifications 437 Appendix A Thermocouple Type T SCPs VT1508A 09A...
Page 440: ...438 Specifications Appendix A 5k Thermistor Reference SCPs VT1501A 02A 03A...
Page 441: ...Specifications 439 Appendix A 5k Thermistor Reference SCPs VT1508A 09A...
Page 442: ...440 Specifications Appendix A RTD Reference SCPs VT1501A 02A 03A...
Page 443: ...Specifications 441 Appendix A RTD SCPs VT1501A 02A 03A...
Page 444: ...442 Specifications Appendix A RTD SCPs VT1508A 09A...
Page 445: ...Specifications 443 Appendix A 2250 Thermistor SCPs VT1501A 02A 03A...
Page 446: ...444 Specifications Appendix A 2250 Thermistor SCPs VT1508A 09A...
Page 447: ...Specifications 445 Appendix A 5k Thermistor SCPs VT1501A 02A 03A...
Page 448: ...446 Specifications Appendix A 5k Thermistor SCPs VT1508A 09A...
Page 449: ...Specifications 447 Appendix A 10k Thermistor SCPs VT1501A 02A 03A...
Page 450: ...448 Specifications Appendix A 10k Thermistor SCPs VT1508A 09A...
Page 454: ...452 Specifications Appendix A...
Page 480: ...478 VT1529A B Verification Calibration Appendix C...
Page 484: ...482 Glossary Appendix D Notes...