Creating and Running Algorithms 197
Chapter 6
NOTE
For Block Program Data, the Algorithm Parser requires that the
source_code
data end with a null (0) byte. The null byte must be appended to the end of
the block's
<data byte(s)>
. If the null byte is not included within the block,
the error "Algorithm Block must contain termination '\0'" will be generated.
Indefinite Length Block Data Example
Retrieve algorithm source code from file and send to VT1422A in indefinite
length format using VTL/VISA instrument I/O libraries:
int byte_count, file_handle;
char source_buffer[8096], null = 0;
file_handle = open( "<
filename
>", O_ O_BINARY);
byte_count = read( file_handle, source_buffer, sizeof( source_buffer ) );
close( file_handle );
source_buffer[ byte_count ] = 0; /* null to terminate source buffer string */
viPrintf( VT1422A, "ALG:DEF 'ALG8',#0%s%c\n", source_buffer, null );
See the section "Running the Algorithm" later in this chapter for more
information on loading algorithms from files.
Changing a
Running Algorithm
The VT1422A has a feature that allows for a given algorithm to be swapped
with another even while it is executing. This is useful if, for instance, it is
necessary to alter the function of an algorithm that is currently controlling a
process and it would be undesirable for that process to be uncontrolled. In
this case, when the original algorithm is defined, enable it to be swapped.
Defining an
Algorithm for Swapping
The ALG:DEF command has an optional parameter that is used to enable
algorithm swapping. The command's general form is:
ALG:DEF '<
alg_name
>'[,<
swap_size
>],'<
source_code
>'
Note the parameter <
swap_size
>. With <
swap_size
>, the amount of
algorithm memory is specified to allocate for algorithm <
alg_name
>. Make
sure to allocate enough space for the largest algorithm expected to be
defined for <
alg_name
>. Here is an example of defining an algorithm for
swapping:
define ALG3 so it can be swapped with an algorithm as large as 1000 words
ALG:DEF 'ALG3',1000,#41698<1698char_alg_source>
NOTE
The number of characters (bytes) in an algorithm's <
source_code
>
parameter is not well related to the amount of memory space the algorithm
requires. Remember this parameter contains the algorithm's source code, not
the executable code it will be translated into by the ALG:DEF command.
The algorithm's source might contain extensive comments, none of which
will be in the executable algorithm code after it is translated.
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...