VXi VT1422A 사용자 설명서

다운로드
페이지 529
Programming the VT1422A for Data Acquisition and Control   125
Defining C Language Algorithms
This section is an overview of how to write and download C algorithms into 
the VT1422A's memory. It is assumed that the user has some programming 
experience in C, but since the VT1422A's version of C is limited, just about 
any experience with a programming language will suffice. See “Creating 
and Running Algorithms” on page 181 
for a complete discussion of the 
VT1422A's C language algorithm functionality.
Arithmetic Operators: add 
+
, subtract 
-
, multiply 
*
, divide 
/
Assignment Operator: 
=
Comparison Functions: less than 
<
, less than or equal 
<=
, greater than 
>
greater than or equal 
>=
, equal to 
==
, not equal to 
!=
Boolean Functions: and 
&&
 or 
||
, not 
!
Variables: scalars of type 
static float
 and single dimensioned arrays 
of type 
static float
 limited to 1024 elements.
Constants:
32-bit decimal integer; 
Dddd...
 where 
D
 and 
d
 are decimal digits but 
D
 is 
not zero. No decimal point or exponent specified.
32-bit octal integer; 
0oo...
 where 
0
 is a leading zero and 
o
 is an octal digit. 
No decimal point or exponent specified.
32-bit hexadecimal integer; 
0Xhhh...
 or 
0xhhh...
 where 
h
 is a hex digit.
32-bit floating point; 
ddd.
,  
ddd.ddd
,  
ddde±dd
dddE±d
ddd.ddde±dd
 
or 
ddd.dddE±dd
 where d is a decimal digit.
Flow Control: conditional construct 
if(){ } else { }
Intrinsic Functions:
Return the absolute value; 
abs(
<expr>
)
Return minimum; 
min(
<expr1>
,
<expr2>
)
Return maximum; 
max(
<expr1>
,
<expr2>
)
User defined function; <user_name>
(
<expr>
)
Write value to CVT element;  
writecvt(
<expr>
,
<expr>
)
Write value to FIFO buffer; 
writefifo(
<expr>
)
Write value to both CVT and FIFO; 
writeboth(
<expr>
,
<expr>
)
 Note for
VXIplug&play users
While the following discussion of algorithm definition is useful for 
plug&play users as regards the coding of an algorithm or global variable 
definition, the method of generating an algorithm code and actually 
downloading it to the VT1422A becomes much easier because of plug&play 
VT1422A.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.