Defining algorithms (alg:def), Alg:define in the programming sequence, Alg:define's three data formats – VXI VT1422A User Manual

Page 198

Advertising
background image

196 Creating and Running Algorithms

Chapter 6

Defining Algorithms (ALG:DEF)

This section discusses how to use the ALG:DEFINE command to define
algorithms. Later sections will discuss "what to define."

Note for

VXIplug&play Users

While the following discussion of algorithm definition is useful for
plug&play users with regards to the coding of an algorithm or global
variable definition, generating an algorithm code and actually downloading
it to the VT1422A is much easier because of the plug&play hps1422.exe
Soft Front Panel program and hpe1422_downloadAlg(...) plug&play driver
function.

Using the SFP "Algorithm Panel," an algorithm can be created and tested
and then stored to a file. The hpe1422_downloadAlg(...) plug&play driver
function was created specifically to download algorithms from files into the
VT1422A as part of the application program.

ALG:DEFINE in the

Programming

Sequence

*RST erases all previously defined algorithms. All algorithms must be
erased before beginning to re-define them (except in the special case
described in "Changing a Running Algorithm" on page 197 later in this
section).

ALG:DEFINE's

Three Data Formats

The ALG:DEFINE '<alg_name>','<source_code>' command sends an
algorithm's source code to the VT1422A's driver for translation to
executable code. The <source_code> parameter can be sent in one of two
forms:

1. SCPI Quoted String: For short segments (single lines) of code,

enclose the code string within single (apostrophes) or double quotes.
Because of string length limitations within SCPI and some
programming platforms, it is recommend that the quoted string length
not exceed a single program line. Example:

ALG:DEF 'ALG1','if(First_loop) O108=0; O108=O108+.01;'

2. SCPI Indefinite Length Block Program Data: This form terminates

the data transfer when it receives an End Identifier with the last data
byte. Use this form only when it is certain that the controller platform
will include the End Identifier. If it is not included, the ALG:DEF
command will "swallow" whatever data follows the algorithm code.
The syntax for this parameter type is:

#0<data byte(s)><null byte with End Identifier>

Example from "Quoted String" above:
ALG:DEF 'ALG1',#0O108=I100;

∅ (where "∅" is a null byte)

Advertising
This manual is related to the following products: