FCScript Expression Functions
FCScript Expression Functions
FCScript Expression Functions
FCScript
Expression Functions
Revision 1.7
MotionPRO Page 1 of 42
11429 Grand River Road • P.O. Box 748 • Brighton, Michigan 48116 • (810) 229-9334 • FAX (810) 229-8125
E-Mail Address: promess@promessinc.com • Web Site: www.promessinc.com
Copyright © 2014 Promess Incorporated. All rights reserved.
®
Table of Contents
................................................................................................................................................................ 1
Overview ............................................................................................................................................................. 5
Expression Step Functions .............................................................................................................................. 6
Axis Related Functions ........................................................................................................................... 6
axis_abort ...........................................................................................................................................................6
axis_imm_abort ..................................................................................................................................................6
axis_stop .............................................................................................................................................................7
axis_imm_stop....................................................................................................................................................7
axis_disable ........................................................................................................................................................8
axis_imm_disable ...............................................................................................................................................9
axis_get_position............................................................................................................................................. 10
axis_set_position ............................................................................................................................................. 10
axis_get_temperature ..................................................................................................................................... 11
Curve Related Functions ...................................................................................................................... 12
curve_x_cross .................................................................................................................................................. 12
curve_y_cross .................................................................................................................................................. 13
curve_grad_cross............................................................................................................................................. 14
curve_tooth_analyze ....................................................................................................................................... 15
curve_tooth_info ............................................................................................................................................. 16
Delay Related Functions ...................................................................................................................... 17
Delay ................................................................................................................................................................ 17
Encoder Related Functions .................................................................................................................. 18
encoder_read .................................................................................................................................................. 18
ext_encoder_read ........................................................................................................................................... 18
Fieldbus Related Functions .................................................................................................................. 19
fb_read_input_bit ........................................................................................................................................... 19
fb_read_output_bit ......................................................................................................................................... 19
fb_write_output_bit ........................................................................................................................................ 19
fb_read_input_integer .................................................................................................................................... 20
fb_read_output_integer .................................................................................................................................. 20
MotionPRO Page 2 of 42
11429 Grand River Road • P.O. Box 748 • Brighton, Michigan 48116 • (810) 229-9334 • FAX (810) 229-8125
E-Mail Address: promess@promessinc.com • Web Site: www.promessinc.com
Copyright © 2014 Promess Incorporated. All rights reserved.
®
fb_write_output_integer................................................................................................................................. 20
fb_read_input_number ................................................................................................................................... 21
fb_read_output_number ................................................................................................................................ 21
fb_write_output_number ............................................................................................................................... 21
fb_read_input_string....................................................................................................................................... 22
fb_read_output_string .................................................................................................................................... 22
fb_write_output_string ................................................................................................................................... 22
Math Related Functions ........................................................................................................................ 23
acos .................................................................................................................................................................. 23
asin................................................................................................................................................................... 23
atan .................................................................................................................................................................. 23
cos.................................................................................................................................................................... 24
exp ................................................................................................................................................................... 24
ln ...................................................................................................................................................................... 24
log10 ................................................................................................................................................................ 25
pow .................................................................................................................................................................. 25
sin .................................................................................................................................................................... 25
sqrt................................................................................................................................................................... 26
tan .................................................................................................................................................................... 26
Message Related Functions ................................................................................................................. 27
msg .................................................................................................................................................................. 27
Sensor Related Functions .................................................................................................................... 27
sensor_read ..................................................................................................................................................... 27
String Related Functions ...................................................................................................................... 28
string_add ........................................................................................................................................................ 28
string_append.................................................................................................................................................. 28
string_length.................................................................................................................................................... 28
TCP Client Related Functions .............................................................................................................. 29
tcp_getserialnum............................................................................................................................................. 29
tcp_setserialnum ............................................................................................................................................. 29
tcp_getvariable ................................................................................................................................................ 30
tcp_setvariable ................................................................................................................................................ 30
Timer Related Functions ...................................................................................................................... 31
MotionPRO Page 3 of 42
11429 Grand River Road • P.O. Box 748 • Brighton, Michigan 48116 • (810) 229-9334 • FAX (810) 229-8125
E-Mail Address: promess@promessinc.com • Web Site: www.promessinc.com
Copyright © 2014 Promess Incorporated. All rights reserved.
®
timer_read ....................................................................................................................................................... 31
timer_reset ...................................................................................................................................................... 31
timer_start ....................................................................................................................................................... 31
timer_stop ....................................................................................................................................................... 32
Type Related Functions ........................................................................................................................ 33
boolean_to_string ........................................................................................................................................... 33
integer_to_string ............................................................................................................................................. 33
number_to_string............................................................................................................................................ 33
Live Expression Resource Functions ........................................................................................................... 34
Axis Related Functions ......................................................................................................................... 34
axis_get_position............................................................................................................................................. 34
axis_imm_stop................................................................................................................................................. 34
Delay Related Functions ...................................................................................................................... 35
delay_value...................................................................................................................................................... 35
Encoder Related Functions .................................................................................................................. 36
encoder_read .................................................................................................................................................. 36
ext_encoder_read ........................................................................................................................................... 36
Sensor Related Functions .................................................................................................................... 37
sensor_read ..................................................................................................................................................... 37
Timer Related Functions ...................................................................................................................... 38
timer_read ....................................................................................................................................................... 38
Variable Related Functions .................................................................................................................. 39
var_set_int ....................................................................................................................................................... 39
Live Expression Examples ............................................................................................................................. 40
Example 1 ............................................................................................................................................. 40
Example 2 ............................................................................................................................................. 41
Revision History .............................................................................................................................................. 42
MotionPRO Page 4 of 42
11429 Grand River Road • P.O. Box 748 • Brighton, Michigan 48116 • (810) 229-9334 • FAX (810) 229-8125
E-Mail Address: promess@promessinc.com • Web Site: www.promessinc.com
Copyright © 2014 Promess Incorporated. All rights reserved.
®
Overview
This document describes the custom functions for both the Expression Step and the Live Expression
Resource.
MotionPRO Page 5 of 42
11429 Grand River Road • P.O. Box 748 • Brighton, Michigan 48116 • (810) 229-9334 • FAX (810) 229-8125
E-Mail Address: promess@promessinc.com • Web Site: www.promessinc.com
Copyright © 2014 Promess Incorporated. All rights reserved.
®
Expression Step Functions
Axis Related Functions
axis_abort
This function aborts the specified axis once this task is reached in the motion task queue, putting the
axis in a halt state. Aborting an axis is the same as stopping an axis but the AbortRate is used instead.
Description The axis is also deadened or disabled after a controlled stop is finished. For all practical purposes, this
is like an E-Stop. If you don't want to wait for previous motion tasks to complete first then call
immAbort() instead - it acts immediately. Returns true if the function was successful else false.
axis_abort 1
axis_imm_abort
This function aborts the specified axis immediately, putting the axis in a halt state. All motion tasks are
Description discarded from the motion taskqueue and a controlled emergency stop is performed as described for
the axis_abort function. Returns true if the function was successful else false.
axis_imm_abort 1
MotionPRO Page 6 of 42
11429 Grand River Road • P.O. Box 748 • Brighton, Michigan 48116 • (810) 229-9334 • FAX (810) 229-8125
E-Mail Address: promess@promessinc.com • Web Site: www.promessinc.com
Copyright © 2014 Promess Incorporated. All rights reserved.
®
axis_stop
This function stops the specified axis once this task is reached in the motion task queue. Stopping an
axis involves ramping the velocity down to zero at a rate defined by StopRate. If in torque mode it
Description simply releases all torque (current = 0 Amperes). The axis stays alive (Enabled) however. This means
if positioning mode then it continues to hold the current position. Returns true if the function was
successful else false.
axis_stop 1
axis_imm_stop
This function stops the specified axis immediately. All motion tasks are discarded from the motion task
Description queue and a controlled stop is performed as described for axis_stop function. Returns true if the
function was successful else false.
axis_imm_stop 1
MotionPRO Page 7 of 42
11429 Grand River Road • P.O. Box 748 • Brighton, Michigan 48116 • (810) 229-9334 • FAX (810) 229-8125
E-Mail Address: promess@promessinc.com • Web Site: www.promessinc.com
Copyright © 2014 Promess Incorporated. All rights reserved.
®
axis_disable
This function disables the specified axis once this task is reached in the motion task queue. Returns
true if the function was successful else false.
Description NOTE: If the axis_disable is executed when the axis is not stopped the drive will
generate an internal E-Stop which will cause the part program to suspend or stop. In
order for this not to occur an axis_stop followed by a short 20-30 millisecond delay
should be executed before the axis_disable.
axis_stop 1
delay 30
axis_disable 1
axis_stop 1
delay 30
Examples set disabled_var [axis_disable axis_var]
axis_stop 1
delay 30
if ( [axis_disable 1] ) {
msg "Axis disabled successfully"
}
MotionPRO Page 8 of 42
11429 Grand River Road • P.O. Box 748 • Brighton, Michigan 48116 • (810) 229-9334 • FAX (810) 229-8125
E-Mail Address: promess@promessinc.com • Web Site: www.promessinc.com
Copyright © 2014 Promess Incorporated. All rights reserved.
®
axis_imm_disable
This function disables the specified axis immediately. All motion tasks are discarded from the motion
task queue and axis is disabled as described in the axis_disable function. Returns true if the function
was successful else false.
Description
NOTE: If the axis_imm_disable is executed when the axis is not stopped the drive will
generate an internal E-Stop which will cause the part program to suspend or stop. In
order for this not to occur an axis_ imm_stop followed by a short 20-30 millisecond
delay should be executed before the axis_ imm_disable.
axis_imm_stop 1
delay 30
axis_imm_disable 1
axis_imm_stop 1
delay 30
Examples set disabled_var [axis_imm_disable axis_var]
axis_imm_stop 1
delay 30
if ( [axis_imm_disable 1] ) {
msg "Axis disabled successfully"
}
MotionPRO Page 9 of 42
11429 Grand River Road • P.O. Box 748 • Brighton, Michigan 48116 • (810) 229-9334 • FAX (810) 229-8125
E-Mail Address: promess@promessinc.com • Web Site: www.promessinc.com
Copyright © 2014 Promess Incorporated. All rights reserved.
®
axis_get_position
This function gets the current actual position of the specified axis and puts the value in the variable
Description specified by the second argument pos:number_ref. Returns true if the function was successful else
false.
axis_get_position 1, axis1_pos_var
axis_get_position 2 axis2_pos_var
if ([axis_get_position 1, axis1_pos_var] ) {
msg "Axis 1 position was read successfully"
}
axis_set_position
This function sets the current actual position of the specified axis with the value specified by the second
Description
argument new_pos:number. Returns true if the function was successful else false.
axis_set_position 1, 50.5
axis_set_position 1, axis1_pos_var
axis_set_position 2 axis2_pos_var
Examples
set return_var [axis_set_position axis_index_var, axis_index_pos_var]
if ([axis_set_position 1, axis1_pos_var] ) {
msg "Axis 1 position was set successfully"
}
MotionPRO Page 10 of 42
11429 Grand River Road • P.O. Box 748 • Brighton, Michigan 48116 • (810) 229-9334 • FAX (810) 229-8125
E-Mail Address: promess@promessinc.com • Web Site: www.promessinc.com
Copyright © 2014 Promess Incorporated. All rights reserved.
®
axis_get_temperature
This function gets the current temperature in degrees celsius of the specified temprarture sensor of the
specified axis. Returns true if the function was successful else false.
axis_get_temperature 1, 1, axis1_internal_temp_var
axis_get_temperature 1, 2, axis1_heatsink_temp_var
axis_get_temperature 1, 3, axis1_motor_temp_var
Examples
set return_var [axis_get_temperature axis_index_var, sensor_index_var, temp_var]
MotionPRO Page 11 of 42
11429 Grand River Road • P.O. Box 748 • Brighton, Michigan 48116 • (810) 229-9334 • FAX (810) 229-8125
E-Mail Address: promess@promessinc.com • Web Site: www.promessinc.com
Copyright © 2014 Promess Incorporated. All rights reserved.
®
Curve Related Functions
The FCScript language supports five different curve analysis functions. The curve_grad_cross, curve_x_cross,
and curve_y_cross functions can be used to look at a specified curve and determine where the curve crosses a
certain value. The curve_tooth_analyze and curve_tooth_info functions are used in conjunction to acquire
information about teeth in a curve.
curve_x_cross
This function is used to determine where a specified curve crosses a certain x-axis value. The
curve_id argument is the Monitor Name of curve to be analyzed (must be in quotation marks and is
case sensitive). The x_location argument is the x-axis value that specifies the desired location of the
Description
crossing point of the curve. The at_y argument (returned parameter value) is the global variable name
where the crossing point of the curve at the x_location will be returned. Returns true if the function was
successful else false.
MotionPRO Page 12 of 42
11429 Grand River Road • P.O. Box 748 • Brighton, Michigan 48116 • (810) 229-9334 • FAX (810) 229-8125
E-Mail Address: promess@promessinc.com • Web Site: www.promessinc.com
Copyright © 2014 Promess Incorporated. All rights reserved.
®
curve_y_cross
This function is used to determine where a specified curve crosses a certain y-axis value. The
curve_id argument is the Monitor Name of curve to be analyzed (must be in quotation marks and is
case sensitive). The y_level argument is the y-axis value that specifies the desired location of the
crossing point of the curve. The x_start argument is the x-axis value that specifies the starting point to
Description find the crossing point of the curve. The search_direction argument is the direction in which the
software will search, from the x_start, to find the crossing point. Entering +1 will search in the positive
x-direction; entering -1 will search in the negative x-direction. The at_y (returned parameter value)
argument is the global variable name where the crossing point of the curve at the y_level will be
returned. Returns true if the function was successful else false.
MotionPRO Page 13 of 42
11429 Grand River Road • P.O. Box 748 • Brighton, Michigan 48116 • (810) 229-9334 • FAX (810) 229-8125
E-Mail Address: promess@promessinc.com • Web Site: www.promessinc.com
Copyright © 2014 Promess Incorporated. All rights reserved.
®
curve_grad_cross
This function compares a curve specified by name to a gradient line defined by the user. It determines
whether the curve crosses the gradient line and, if so, the X and Y coordinate where this crossing
occurs. It does not perform limit comparison or affect the part status in any way. The user is
responsible for taking the information from this function and performing additional actions. The
curve_id argument is the Monitor Name of curve to be analyzed (must be in quotation marks and is
Description
case sensitive). The x0 argument specifies the origin of the gradient line along the X axis. The line is
infinite in length. The k_slope argument specifies the slope of the gradient line in Y units over X units.
The at_x (Returned parameter value) argument specifies the point along the X axis where curve
crosses the gradient line. The at_y (Returned parameter value) argument specifies the point along the
Y axis where curve crosses the gradient line. Returns true if the function was successful else false.
MotionPRO Page 14 of 42
11429 Grand River Road • P.O. Box 748 • Brighton, Michigan 48116 • (810) 229-9334 • FAX (810) 229-8125
E-Mail Address: promess@promessinc.com • Web Site: www.promessinc.com
Copyright © 2014 Promess Incorporated. All rights reserved.
®
curve_tooth_analyze
This function performs all the data analysis on a specified curve that has been acquired. The curve_id
argument is the Monitor Name of curve to be analyzed (must be given in quotation marks and is case
sensitive). The options argument is not used at this time and its value is ignored. The begin argument
is used to tell where in the curve to start processing. The tooth_width is the total width of the of the
tooth (wave period). The number_teeth argument is to tell how many teeth to analyze from the
Description
beginning location. There is a maximum limit of 1000 teeth that can be analyzed. If you specify more
than 1000 teeth, the extra teeth will not be analyzed and the information will not be available. The
function returns the actual number of teeth analyzed.
When this function is called, it performs all the analysis and sets the results aside for querying by the
curve_tooth_info function.
MotionPRO Page 15 of 42
11429 Grand River Road • P.O. Box 748 • Brighton, Michigan 48116 • (810) 229-9334 • FAX (810) 229-8125
E-Mail Address: promess@promessinc.com • Web Site: www.promessinc.com
Copyright © 2014 Promess Incorporated. All rights reserved.
®
curve_tooth_info
This function queries the information about a curve from a previously ran curve_tooth_analyze
function call. The curve_id argument is the Monitor Name of the curve previously analyzed from which
you are extracting information (must be supplied in quotation marks and is case sensitive). The query
argument is the keyword that specifies what information that will be returned. The following is a list of
supported keywords:
MotionPRO Page 16 of 42
11429 Grand River Road • P.O. Box 748 • Brighton, Michigan 48116 • (810) 229-9334 • FAX (810) 229-8125
E-Mail Address: promess@promessinc.com • Web Site: www.promessinc.com
Copyright © 2014 Promess Incorporated. All rights reserved.
®
Delay
This function delays for delay_number of milliseconds. Returns true if the function was successful else
Description
false.
delay 100
MotionPRO Page 17 of 42
11429 Grand River Road • P.O. Box 748 • Brighton, Michigan 48116 • (810) 229-9334 • FAX (810) 229-8125
E-Mail Address: promess@promessinc.com • Web Site: www.promessinc.com
Copyright © 2014 Promess Incorporated. All rights reserved.
®
Encoder Related Functions
encoder_read
This function gets the current encoder reading of the specified encoder and puts the value in the
Description variable specified by the second argument reading:number_ref. Returns true if the function was
successful else false.
encoder_read 1, encoder1_var
encoder_read 2 encoder2_var
ext_encoder_read
This function gets the current encoder reading of the specified encoder and puts the value in the
Description variable specified by the second argument reading:number_ref. Returns true if the function was
successful else false.
ext_encoder_read 1, ext_encoder1_var
ext_encoder_read 2 ext_encoder2_var
MotionPRO Page 18 of 42
11429 Grand River Road • P.O. Box 748 • Brighton, Michigan 48116 • (810) 229-9334 • FAX (810) 229-8125
E-Mail Address: promess@promessinc.com • Web Site: www.promessinc.com
Copyright © 2014 Promess Incorporated. All rights reserved.
®
Fieldbus Related Functions
fb_read_input_bit
This function reads a fieldbus input bit at position index specified by the input_number argument (1
Description
through N). Returns a boolean value representing the bit’s state.
fb_read_output_bit
This function reads a fieldbus output bit at position index specified by the output_number argument (1
Description
through N). Returns a boolean value representing the bit’s state.
fb_write_output_bit
This function writes a fieldbus output bit at position index specified by the output_number argument (1
Description
through N) with a value specified by the new_value argument. Returns nothing.
fb_write_output_bit 1, 0
Examples
fb_write_output_bit 5 1
MotionPRO Page 19 of 42
11429 Grand River Road • P.O. Box 748 • Brighton, Michigan 48116 • (810) 229-9334 • FAX (810) 229-8125
E-Mail Address: promess@promessinc.com • Web Site: www.promessinc.com
Copyright © 2014 Promess Incorporated. All rights reserved.
®
fb_read_input_integer
This function reads a fieldbus input integer at position index specified by the input_number argument (1
Description
through N). Returns the fieldbus integer value.
fb_read_output_integer
This function reads a fieldbus output integer at position index specified by the output_number argument
Description
(1 through N). Returns the fieldbus integer value.
fb_write_output_integer
This function writes a fieldbus output integer at position index specified by the output_number
Description
argument (1 through N) with a value specified by the new_value argument. Returns nothing.
fb_write_output_integer 1, 948
Examples
fb_write_output_integer 5 362
MotionPRO Page 20 of 42
11429 Grand River Road • P.O. Box 748 • Brighton, Michigan 48116 • (810) 229-9334 • FAX (810) 229-8125
E-Mail Address: promess@promessinc.com • Web Site: www.promessinc.com
Copyright © 2014 Promess Incorporated. All rights reserved.
®
fb_read_input_number
This function reads a fieldbus input number at position index specified by the input_number argument
Description
(1 through N). Returns the fieldbus number value.
fb_read_output_number
This function reads a fieldbus output number at position index specified by the output_number
Description
argument (1 through N). Returns the fieldbus number value.
fb_write_output_number
This function writes a fieldbus output number at position index specified by the output_number
Description
argument (1 through N) with a value specified by the new_value argument. Returns nothing.
fb_write_output_number 1, 136.948
Examples
fb_write_output_number 1 7.285
MotionPRO Page 21 of 42
11429 Grand River Road • P.O. Box 748 • Brighton, Michigan 48116 • (810) 229-9334 • FAX (810) 229-8125
E-Mail Address: promess@promessinc.com • Web Site: www.promessinc.com
Copyright © 2014 Promess Incorporated. All rights reserved.
®
fb_read_input_string
This function reads a fieldbus input string at position index specified by the input_number argument (1
Description through N). Returns the fieldbus string.
Note: only input_number = 1 is supported as of this writing.
fb_read_output_string
This function reads a fieldbus output string at position index specified by the output_number argument
Description (1 through N). Returns the fieldbus string.
Note: only output_number = 1 is supported as of this writing.
fb_write_output_string
This function writes a fieldbus output string at position index specified by the output_number argument
Description (1 through N) with a value specified by the new_value argument. Returns nothing.
Note: only output_number = 1 is supported as of this writing.
fb_write_output_string 1, "Test"
Examples
fb_write_output_string 1 "Test"
MotionPRO Page 22 of 42
11429 Grand River Road • P.O. Box 748 • Brighton, Michigan 48116 • (810) 229-9334 • FAX (810) 229-8125
E-Mail Address: promess@promessinc.com • Web Site: www.promessinc.com
Copyright © 2014 Promess Incorporated. All rights reserved.
®
Math Related Functions
acos
Description This function computes the arc-cosine of the x argument (specified in radians). Returns the result.
asin
Description This function computes the arc-sine of the x argument (specified in radians). Returns the result.
atan
Description This function computes the arc-tangent of the x argument (specified in radians). Returns the result.
MotionPRO Page 23 of 42
11429 Grand River Road • P.O. Box 748 • Brighton, Michigan 48116 • (810) 229-9334 • FAX (810) 229-8125
E-Mail Address: promess@promessinc.com • Web Site: www.promessinc.com
Copyright © 2014 Promess Incorporated. All rights reserved.
®
cos
Description This function computes the cosine of the x argument (specified in radians). Returns the result.
exp
Description This function computes the natural exponential of the x argument. Returns the result.
ln
Description This function computes the natural logarithm of the x argument. Returns the result.
MotionPRO Page 24 of 42
11429 Grand River Road • P.O. Box 748 • Brighton, Michigan 48116 • (810) 229-9334 • FAX (810) 229-8125
E-Mail Address: promess@promessinc.com • Web Site: www.promessinc.com
Copyright © 2014 Promess Incorporated. All rights reserved.
®
log10
Description This function computes the base-10 logarithm of the x argument. Returns the result.
pow
Description This function computes the x argument raised to the power of the y argument. Returns the result.
sin
Description This function computes the sine of the x argument (specified in radians). Returns the result.
MotionPRO Page 25 of 42
11429 Grand River Road • P.O. Box 748 • Brighton, Michigan 48116 • (810) 229-9334 • FAX (810) 229-8125
E-Mail Address: promess@promessinc.com • Web Site: www.promessinc.com
Copyright © 2014 Promess Incorporated. All rights reserved.
®
sqrt
Description This function computes the square-root of the x argument. Returns the result.
tan
Description This function computes the tangent of the x argument (specified in radians). Returns the result.
MotionPRO Page 26 of 42
11429 Grand River Road • P.O. Box 748 • Brighton, Michigan 48116 • (810) 229-9334 • FAX (810) 229-8125
E-Mail Address: promess@promessinc.com • Web Site: www.promessinc.com
Copyright © 2014 Promess Incorporated. All rights reserved.
®
Message Related Functions
msg
Description This function logs a message text to the event log for debugging or display purposes. Returns nothing.
sensor_read
This function gets the current sensor reading of the specified sensor and puts the value in the variable
Description specified by the second argument reading:number_ref. Returns true if the function was successful else
false.
sensor_read 1, sensor1_var
sensor_read 2 sensor2_var
MotionPRO Page 27 of 42
11429 Grand River Road • P.O. Box 748 • Brighton, Michigan 48116 • (810) 229-9334 • FAX (810) 229-8125
E-Mail Address: promess@promessinc.com • Web Site: www.promessinc.com
Copyright © 2014 Promess Incorporated. All rights reserved.
®
String Related Functions
string_add
Description This function computes the combined string of string1 followed by string2. Returns the resulting string.
string_append
Description This function appends the string append_string to the string variable to_string. Returns nothing.
string_length
Description This function computes the total character length of string string1. Returns the result.
MotionPRO Page 28 of 42
11429 Grand River Road • P.O. Box 748 • Brighton, Michigan 48116 • (810) 229-9334 • FAX (810) 229-8125
E-Mail Address: promess@promessinc.com • Web Site: www.promessinc.com
Copyright © 2014 Promess Incorporated. All rights reserved.
®
TCP Client Related Functions
tcp_getserialnum
This funciton sends a getserialnum Command Server command via an ethrnet TCP message to a
remote MotionPRO. The remote MotionPRO is specified by the IP address and port number specified.
Description This function gets the remote MotionPRO’s current part serial number and puts it in the expression
string variable specified by the argument serialnum:string_ref. Returns true if the function was
successful else false.
var serialnum:string
tcp_ getserialnum "192.168.1.107" "9750" serialnum
tcp_setserialnum
This funciton sends a setserialnum Command Server command via an ethrnet TCP message to a
remote MotionPRO. The remote MotionPRO is specified by the IP address and port number specified.
Description
This function sets the remote MotionPRO’s current part serial number with the string specified by the
argument serialnum:string. Returns true if the function was successful else false.
var serialnum:string
set serialnum “ABC123”
tcp_ setserialnum "192.168.1.107" "9750" serialnum
tcp_ setserialnum "192.168.1.108" "9750" “XYZ789”
Examples
if (not [tcp_ setserialnum "192.168.1.107" "9750" serialnum ] )
{
msg "tcp_setserialnum failed."
}
MotionPRO Page 29 of 42
11429 Grand River Road • P.O. Box 748 • Brighton, Michigan 48116 • (810) 229-9334 • FAX (810) 229-8125
E-Mail Address: promess@promessinc.com • Web Site: www.promessinc.com
Copyright © 2014 Promess Incorporated. All rights reserved.
®
tcp_getvariable
This funciton sends a getvariable Command Server command via an ethrnet TCP message to a
remote MotionPRO. The remote MotionPRO is specified by the IP address and port number specified.
Description This function gets the current value of the remote variable specified by variablename and puts the
value in the local variable specified by the fourth argument value:number_ref. Returns true if the
function was successful else false.
tcp_setvariable
This funciton sends a setvariable Command Server command via an ethrnet TCP message to a
remote MotionPRO. The remote MotionPRO is specified by the IP address and port number specified.
Description This function sets the current value of the remote variable specified by variablename and puts the
value specified by a constent number or a local variable specified by the fourth argument
value:number_ref. Returns true if the function was successful else false.
MotionPRO Page 30 of 42
11429 Grand River Road • P.O. Box 748 • Brighton, Michigan 48116 • (810) 229-9334 • FAX (810) 229-8125
E-Mail Address: promess@promessinc.com • Web Site: www.promessinc.com
Copyright © 2014 Promess Incorporated. All rights reserved.
®
Timer Related Functions
timer_read
This function gets the current timer reading of the specified timer and puts the value in the variable
Description specified by the second argument reading:number_ref. Returns true if the function was successful else
false.
timer_read 1 timer1_var
timer_read 2 timer2_var
timer_reset
This function resets the specified timer timer_number, numbered 1-4. The corresponding timer must be
Description
enabled on the Setup tab of the System Setup screen. Returns nothing.
Examples timer_reset 1
timer_start
This function starts the specified timer timer_number, numbered 1-4. The corresponding timer must be
Description
enabled on the Setup tab of the System Setup screen. Returns nothing.
Examples timer_start 1
MotionPRO Page 31 of 42
11429 Grand River Road • P.O. Box 748 • Brighton, Michigan 48116 • (810) 229-9334 • FAX (810) 229-8125
E-Mail Address: promess@promessinc.com • Web Site: www.promessinc.com
Copyright © 2014 Promess Incorporated. All rights reserved.
®
timer_stop
This function stops the specified timer timer_number, numbered 1-4. The corresponding timer must be
Description
enabled on the Setup tab of the System Setup screen. Returns nothing.
Examples timer_stop 1
MotionPRO Page 32 of 42
11429 Grand River Road • P.O. Box 748 • Brighton, Michigan 48116 • (810) 229-9334 • FAX (810) 229-8125
E-Mail Address: promess@promessinc.com • Web Site: www.promessinc.com
Copyright © 2014 Promess Incorporated. All rights reserved.
®
Type Related Functions
boolean_to_string
This function converts a boolean value v to a string as either “true” or “false”. Returns the resulting
Description
string.
integer_to_string
Description This function converts an integer value v to a string. Returns the resulting string.
number_to_string
This function converts a number value v to a string formatted with dec_places number of decimal
Description
places. Returns the resulting string.
MotionPRO Page 33 of 42
11429 Grand River Road • P.O. Box 748 • Brighton, Michigan 48116 • (810) 229-9334 • FAX (810) 229-8125
E-Mail Address: promess@promessinc.com • Web Site: www.promessinc.com
Copyright © 2014 Promess Incorporated. All rights reserved.
®
axis_get_position
This function gets the current actual position of the specified axis and puts the value in the variable
Description specified by the second argument pos:number_ref. Returns true if the function was successful else
false.
axis_get_position 1, axis1_pos_var
axis_get_position 2 axis2_pos_var
if ([axis_get_position 1, axis1_pos_var] ) {
# Do something here
}
axis_imm_stop
This function stops the specified axis immediately. All motion tasks are discarded from the motion task
Description queue and a controlled stop is performed as described for axis_stop function. Returns true if the
function was successful else false.
axis_imm_stop 1
MotionPRO Page 34 of 42
11429 Grand River Road • P.O. Box 748 • Brighton, Michigan 48116 • (810) 229-9334 • FAX (810) 229-8125
E-Mail Address: promess@promessinc.com • Web Site: www.promessinc.com
Copyright © 2014 Promess Incorporated. All rights reserved.
®
Delay Related Functions
delay_value
Description
This function delays for delay_number of milliseconds before it returns the input_number.
MotionPRO Page 35 of 42
11429 Grand River Road • P.O. Box 748 • Brighton, Michigan 48116 • (810) 229-9334 • FAX (810) 229-8125
E-Mail Address: promess@promessinc.com • Web Site: www.promessinc.com
Copyright © 2014 Promess Incorporated. All rights reserved.
®
Encoder Related Functions
encoder_read
This function gets the current encoder reading of the specified encoder and puts the value in the
Description variable specified by the second argument reading:number_ref. Returns true if the function was
successful else false.
encoder_read 1, encoder1_var
encoder_read 2 encoder2_var
ext_encoder_read
This function gets the current encoder reading of the specified encoder and puts the value in the
Description variable specified by the second argument reading:number_ref. Returns true if the function was
successful else false.
ext_encoder_read 1, ext_encoder1_var
ext_encoder_read 2 ext_encoder2_var
MotionPRO Page 36 of 42
11429 Grand River Road • P.O. Box 748 • Brighton, Michigan 48116 • (810) 229-9334 • FAX (810) 229-8125
E-Mail Address: promess@promessinc.com • Web Site: www.promessinc.com
Copyright © 2014 Promess Incorporated. All rights reserved.
®
Sensor Related Functions
sensor_read
This function gets the current sensor reading of the specified sensor and puts the value in the variable
Description specified by the second argument reading:number_ref. Returns true if the function was successful else
false.
sensor_read 1 sensor1_var
sensor_read 2 sensor2_var
MotionPRO Page 37 of 42
11429 Grand River Road • P.O. Box 748 • Brighton, Michigan 48116 • (810) 229-9334 • FAX (810) 229-8125
E-Mail Address: promess@promessinc.com • Web Site: www.promessinc.com
Copyright © 2014 Promess Incorporated. All rights reserved.
®
Timer Related Functions
timer_read
This function gets the current timer reading of the specified timer and puts the value in the variable
Description specified by the second argument reading:number_ref. Returns true if the function was successful else
false.
timer_read 1 timer1_var
timer_read 2 timer2_var
MotionPRO Page 38 of 42
11429 Grand River Road • P.O. Box 748 • Brighton, Michigan 48116 • (810) 229-9334 • FAX (810) 229-8125
E-Mail Address: promess@promessinc.com • Web Site: www.promessinc.com
Copyright © 2014 Promess Incorporated. All rights reserved.
®
Variable Related Functions
var_set_int
This function sets an integer type global variable with the name specified by the string to the specified
integer constant. Returns true if the function was successful else false.
Description
NOTE: This function is used to set a variable in a Live Expression without making a link to the
variable in the Signal Plane. This is needed to avoid cycles in the Signal Plane graph.
var_set_int “variable1” 0
var_set_int “variable2” 1
MotionPRO Page 39 of 42
11429 Grand River Road • P.O. Box 748 • Brighton, Michigan 48116 • (810) 229-9334 • FAX (810) 229-8125
E-Mail Address: promess@promessinc.com • Web Site: www.promessinc.com
Copyright © 2014 Promess Incorporated. All rights reserved.
®
Example 1
Live Expression that calculates rate of change.
sensor_read 1 Force_A
axis_get_position 1 Position_A
set Force_B [ delay_value 100 Force_A ]
set Position_B [ delay_value 100 Position_A ]
set Force_Delta ( Force_B - Force_A )
set Position_Delta ( Position_B - Position_A )
set Rate_Of_Change ( Force_Delta / Position_Delta )
MotionPRO Page 40 of 42
11429 Grand River Road • P.O. Box 748 • Brighton, Michigan 48116 • (810) 229-9334 • FAX (810) 229-8125
E-Mail Address: promess@promessinc.com • Web Site: www.promessinc.com
Copyright © 2014 Promess Incorporated. All rights reserved.
®
Example 2
Live Expression that calculates rate of change and checks it against a limit then stops the axis when it reaches
the target force.
sensor_read 1 Force_A
axis_get_position 1 Position_A
set Force_B [ delay_value 100 Force_A ]
set Position_B [ delay_value 100 Position_A ]
set Force_Delta ( Force_B - Force_A )
set Position_Delta ( Position_B - Position_A )
set Rate_Of_Change ( Force_Delta / Position_Delta )
if (CheckROC == 1) {
if (Rate_Of_Change > ROC_Limit) {
sensor_read 1 Start_Force
axis_get_position 1 Start_Position
set Target_Force ( Start_Force + Force_Offset )
set CheckROCDone 1
set PressToForce 1
var_set_int "CheckROC" 0
}
}
if (PressToForce == 1) {
sensor_read 1 force
if ( force >Target_Force) {
axis_imm_stop 1
set PressToForceDone 1
var_set_int "PressToForce" 0
}
}
MotionPRO Page 41 of 42
11429 Grand River Road • P.O. Box 748 • Brighton, Michigan 48116 • (810) 229-9334 • FAX (810) 229-8125
E-Mail Address: promess@promessinc.com • Web Site: www.promessinc.com
Copyright © 2014 Promess Incorporated. All rights reserved.
®
Revision History
Revision Date Author Changes
1.0 03-18-2010 RCM Created.
1.1 04-16-2010 RCM Added Live Expression functions axis_imm_stop and
var_set_int. Added Example 2 and did some reformatting.
1.2 05-14-2010 RCM Changed the format of the Expression function timer_read.
Added Live Expression functions timer_read, encoder_read,
and ext_encoder_read.
1.3 09-02-2010 RCM Changed the format of the Expression function curve_y_cross
by changing argument search_forward: boolean to
search_direction: number.
1.4 11-17-2010 RCM Added TCP Client related functions tcp_getserialnum,
tcp_setserialnum, tcp_getvariable, and tcp_setvariable.
1.5 02-01-2012 RCM Added notes to the descriptions of axis_disable and
axis_imm_disable.
1.6 06-11-2013 SWP Added notes to the descriptions of curve_tooth_analyze and
curve_tooth_info.
1.7 01-10-2014 RCM Added Axis function axis_get_temperature.
MotionPRO Page 42 of 42
11429 Grand River Road • P.O. Box 748 • Brighton, Michigan 48116 • (810) 229-9334 • FAX (810) 229-8125
E-Mail Address: promess@promessinc.com • Web Site: www.promessinc.com
Copyright © 2014 Promess Incorporated. All rights reserved.