Specifications

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±dd, ddd.dddedd
or ddd.dddEdd where d is a decimal digit.
Flow Control conditional construct if(){ } else { }
Intrinsic Functions
Return absulute value; abs(<expr1>)
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>)
Example Language
Usage
Here are examples of some Algorithm Language elements assembled to show how
they are used in context. Later sections will explain any unfamiliar elements seen
here:
Example 1
/*** get input from channel 8, calculate output, check limits, output to ch 40 & 41
***/
static float output_max = .020; /* 20 mA max output */
static float output_min = .004; /* 4 mA min output */
static float input_val, output_val; /* intermediate I/O vars */
input val_ = I108; /* get value from input buffer channel 8*/
output_val = 12.5 * input_val; /* calculate desired output */
if ( output_val > output_max ) /* check output greater than limit */
output_val = output_max; /* if so, output max limit */
else if( output_val < output_min) /* check output less than limit */
output_val = output_min; /* if so, output min limit */
O140 = output_val / 2; /* split output_val between two SCP */
O141 = output_val / 2; /* channels to get up to 20 mA max */
Example 2
/*** same function as example 1 above but shows a different approach ***/
static float max_output = .020; /* 20 mA max output */
static float min_output = .004; /* 4 mA min output */
/* following lines input, limit output between min and max_output and outputs. */
/* output is split to two current output channels wired in parallel to provide 20 mA */
O140 = max( min_output, min( max_output, (12.5 * I108)/2));
O141 = max( min_output, min( max_output, (12.5 * I108)/2));
The Algorithm Language and Environment
Overview of the Algorithm Language
Chapter 4 107
Artisan Technology Group - Quality Instrumentation ... Guaranteed | (888) 88-SOURCE | www.artisantg.com