Tcl Code - Newport XPS-Q8 Manual

Universal high-performance motion controller/driver
Table of Contents

Advertisement

XPS-Q8
Please see the sections:
4 Principle of a Tcl script redirection to a telnet session.
6 Proposed function for error handling.
7.13.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
20
TimeOut
set
0
code
set
group "SINGLE_AXIS"
# Open TCP socket
set
code
[catch
if
{$code != 0} {
puts
$telnetOut "OpenConnection failed => $code"
flush
$telnetOut
else
}
{
# Recover the input arguments entered by the user
# In this case argument 0 is used for Telnet channel identifier
if
{$tcl_argc == 4} {
set
set
set
else
}
puts
flush
set
return
}
# Kill group
set
code
if
{$code != 0} {
DisplayErrorAndClose $socketID $code "GroupKill" $telnetOut
return
"OpenConnection $TimeOut socketID"]
startpos $tcl_argv(1)
endpos $tcl_argv(2)
cycles $tcl_argv(3)
{
$telnetOut "Wrong number of parameters, argument
1, 2 and 3 are needed"
$telnetOut
code
[catch
"TCP_CloseSocket $socketID"]
[catch
"GroupKill $socketID $group"]
57
Tcl Manual
EDH0307En1041 — 10/17

Hide quick links:

Advertisement

Table of Contents
loading

Table of Contents