XPS-Q8
Tcl Manual
7.6
Position Compare
7.6.1
Configuration
Group type Number
Group name
Positioner name
Single axis
1
SINGLE_AXIS
SINGLE_AXIS.MY_STAGE
7.6.2
Description
This example opens a TCP connection, kills the single axis group, then initializes and
homes the group. With an absolute move, the positioner moves to the start position –15.
Then, the program configures the parameters for the position compare (enabled from -
10 to +10 with step position of 1 unit). It enables the position compare functionality and
executes a relative move of 25 (final position will be –15+25 = +10). During this move,
between the positions –10 and +10, pulses are sent by the trigger output for each 1 unit
incremental position. The position compare mode is then disabled and the program ends
by closing the socket.
Please see the sections:
4 Principle of a Tcl script redirection to a telnet session
.
6 Proposed function for error handling.
7.6.3
Tcl Code
# Set channel’s name to be used for telnet.
# In this example we assume it is passed to the script as the
# first argument, if not specified output to stdio.
# Open the channel for read mode and get its id,
# this is the id that will be passed to puts function.
if
{$tcl_argv(
0
) !=
0
} {
set
telnetOut [ open "/dev/$tcl_argv(
0
)" r+]
}
else
{
set
telnetOut stdout
}
# Initialization
set
TimeOut
60
set
Group "SINGLE_AXIS"
set
Positioner "SINGLE_AXIS.MY_STAGE"
set
StartPosition
-15
set
Displacement
25
set
MinPos
-10
set
MaxPos
10
set
StepPos
1
set
code
0
# Open TCP socket
set
code [
catch
"
OpenConnection
$TimeOut socketID"]
if
{$code !=
0
} {
puts
$telnetOut "OpenConnection failed => $code"
# Force transfer to channel’s output buffer
flush
$telnetOut
}
else
{
# Kill group
set
code [
catch
"
GroupKill
$socketID $Group"]
if
{$code !=
0
} {
EDH0307En1041 — 10/17
37