Using Digital I/O For Motion; Configuration; Description; Tcl Code - Newport XPS-Q8 Manual

Universal high-performance motion controller/driver
Table of Contents

Advertisement

XPS-Q8
EDH0307En1041 — 10/17
7.2

Using Digital I/O for Motion

7.2.1

Configuration

Group type
XY
7.2.2

Description

This example opens a TCP connection, kills the XY group, then initializes and homes
the group. Five relative moves of 1 unit each are commanded to the group. Then, the
value of the GPIO1 digital input is read in a continuous loop and sent to the redirected
stdout as long as the value of the input is not 255 (Refer to Section 4, Principle of a
Tcl script redirection to a telnet session ). When the value of the digital GPIO1 input is
equal to 1, absolute moves are commanded to both axes: the X positioner moves to the
absolute position 1 and the Y positioner moves to the absolute position -1. When the
value of 255 is obtained, the last display occurs. Finally, the program ends by closing
the socket. If the GPIO1 input value is 255 during the first reading, the program goes to
the end without displaying the digital input value.
Please see the Section 6, Proposed function for error handling.
7.2.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
60
TimeOut
set
group "alignstation"
set
axis1 "alignstation.middle"
set
axis2 "alignstation.base"
set
digitalin "GPIO1.DI"
# Open socket
set
code
[catch
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} {
DisplayErrorAndClose $socketID $code "GroupKill" $telnetOut
return
}
Number
Group name
1
alignstation
"OpenConnection $TimeOut socketID"]
26
Tcl Manual
Positioner name
alignstation.middle and
alignstation.base

Hide quick links:

Advertisement

Table of Contents
loading

Table of Contents