184 Creating and Running Algorithms
Chapter 6
Example 2;
/*** same function as example 1 above but shows a different approach ***/
static float max_output = .020;
/* 20 mA max output */
static float min_output = .004;
/* 4 mA min output */
/* following lines input, limit output between min and max_output and outputs. */
/* output is split to two current output channels wired in parallel to provide 20 mA */
/* write cvt is just to show access to remote channel
O116 = max( min_output, min( max_output, (12.5 * I108) / 2 ) );
O117 = max( min_output, min( max_output, (12.5 * I108) / 2 ) );
writecvt(I14001,501);
The Algorithm Execution Environment
This section describes the execution environment that the VT1422A
provides for algorithms. Here, the relationship of algorithms to the
main()
function that calls it is described.
The Main Function
All 'C' language programs consist of one or more functions. A 'C' program
must have a function called
main()
. In the VT1422A, the
main()
function is
usually generated automatically by the driver when the INIT command is
executed. The
main()
function executes each time the module is triggered
and controls execution of algorithm functions. See Figure 6-1 for a partial
listing of
main()
.
How User
Algorithms Fit In
When the module is INITiated, a set of control variables and a function
calling sequence are created for all algorithms defined. The value of variable
"State_n" is set with the ALGorithm:STATe command and determines
whether an algorithm will be called. The value of "Ratio_n" is set with the
ALGorithm:SCAN:RATio command and determines how often an
algorithm will be called (relative to trigger events).
Since the function-calling interface to an algorithms is fixed in the
main()
function, the "header" of an algorithm function is also pre-defined. This
means that, unlike standard 'C' language programming, an algorithm
program (a function) need not (must not) include the function declaration
header, opening brace "{" and closing brace "}". Only the "body" of the
function is supplied; the VT1422A's driver supplies the rest.
Think of the program space in the VT1422A in the form of a source file with
any global variables first, then the
main()
function followed by as many
algorithms as defined. Of course, what is really contained in the VT1422A's
algorithm memory are executable codes that have been translated from the
downloaded source code. While not an exact representation of an algorithm
execution environment, Figure 6-1 shows the relationship between a normal
'C' program and two VT1422A algorithms.
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...