VXi VT1422A 사용자 설명서

다운로드
페이지 529
Programming the VT1422A for Data Acquisition and Control   101
A limited and simplified version of C was created since most applications 
need only basic operations: add, subtract, multiply, divide, scalar variables, 
arrays, and programming constructs. The programming constructs are 
limited to if-then-else to allow conditional evaluation and response to input 
changes. Since all algorithms have an opportunity to execute after each 
time-base trigger, the if-then-else constructs permit conditional skipping of 
cycle intervals so that some code segments or algorithms can execute at 
multiples of the cycle time instead of every cycle.
Looping constructs such as for or while are purposely left out of the 
language so that user programs are deterministic. Note that looping is not 
really needed for most applications since the cycle interval execution (via 
the trigger system) of every algorithm has inherent repeat looping. With no 
language looping constructs, the VT1422A's C compiler can perform a 
worst-case branch analysis of user programs and return the execution time 
for determining the minimum time-base interval. Making this timing query 
available allows the programmer to know exactly how much time may 
be required to execute any/all phases before attempting to set up physical 
test conditions.
Note the darker shaded portion at the end of the Execute Algorithms Phase 
in Figure 4-2. The conditional execution of code can cause the length of this 
phase to move back and forth and vary considerably. This can cause 
undesirable output jitter when the beginning of the output phase starts 
immediately after the last user algorithm executes. The VT1422A's design 
allows the user to specify when output signals begin relative to the start of 
the trigger cycle. Outputs then always occur at the same time, every time.
The programming task is further simplified with this design because all the 
difficult structure of handling input and output channels is done automatically. 
This is not true of many other products that may have several ways to 
acquire measurement data or write results to its I/O channels. When the 
VT1422A's user-written C algorithms are compiled, input channels and 
output channels are detected in the algorithms and are automatically 
grouped and configured for the Input and Output phases as seen in 
Figure 4-2. Each algorithm simply accesses input channels as variables and 
writes to output channels as variables. The rest is handled and optimized by 
the Input and Output phases. This allows for more time to solve the 
application in terms of input and output value variables rather than dealing 
with the individual differences of each SCP.