Universal Remote User Manual

Creating and Running Algorithms 181Chapter 6
Chapter 6
Creating and Running Algorithms
Learning Hint This chapter builds upon the "VT1422A Programming Model" information
presented in Chapter 4. Reading Chapter 4 is recommended before moving
on to this chapter.
About This Chapter
This chapter describes how to write algorithms that apply the VT1422A's
measurement, calculation, and control resources. It describes these
resources and how to access them with the VT1422A's Algorithm Language.
This manual assumes that the user has programming experience already,
ideally, in the 'C' language since the VT1422A's Algorithm Language is
based on 'C'. Following the tutorial sections of this chapter is an Algorithm
Language Reference. The contents of this chapter are:
Overview of the Algorithm Language . . . . . . . . . . . . . . . . . page 182
The Algorithm Execution Environment . . . . . . . . . . . . . . . . page 184
Accessing the VT1422A's Resources . . . . . . . . . . . . . . . . . . page 185
-- Accessing I/O Channels . . . . . . . . . . . . . . . . . . . . . . . . . . page 186
-- Accessing Remote Scan Status Variables . . . . . . . . . . . . . page 187
-- Runtime Remote Scan Verification. . . . . . . . . . . . . . . . . . page 187
-- Defining and Accessing Global Variables. . . . . . . . . . . . . page 190
-- Determining First Execution (First_loop). . . . . . . . . . . . . page 190
-- Initializing Variables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . page 191
-- Sending Data to the CVT and FIFO . . . . . . . . . . . . . . . . . page 191
-- Setting a VXIbus Interrupt . . . . . . . . . . . . . . . . . . . . . . . . page 192
-- Determining An Algorithm's Identity (ALG_NUM) . . . . page 193
-- Calling User Defined Functions . . . . . . . . . . . . . . . . . . . . page 193
Operating Sequence . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . page 194
Defining Algorithms (ALG:DEF). . . . . . . . . . . . . . . . . . . . . page 196
A Very Simple First Algorithm. . . . . . . . . . . . . . . . . . . . . . . page 200
Modifying an Example PID Algorithm . . . . . . . . . . . . . . . . page 200
Algorithm to Algorithm Communication . . . . . . . . . . . . . . . page 201
Communication Using Channel Identifiers. . . . . . . . . . . . page 201
Communication Using Global Variables. . . . . . . . . . . . . . page 202
Non-Control Algorithms. . . . . . . . . . . . . . . . . . . . . . . . . . . . page 204
Process Monitoring Algorithm . . . . . . . . . . . . . . . . . . . . . page 204
Implementing Setpoint Profiles . . . . . . . . . . . . . . . . . . . . . . page 205
Algorithm Language Reference . . . . . . . . . . . . . . . . . . . . . . page 207
-- Standard Reserved Keywords . . . . . . . . . . . . . . . . . . . . . . page 207
-- Special VT1422A Reserved Keywords . . . . . . . . . . . . . . page 207