External Gathering; Configuration; Description; Tcl Code - Newport XPS-Q8 Manual

Universal high-performance motion controller/driver
Table of Contents

Advertisement

XPS-Q8
EDH0307En1041 — 10/17
7.5

External gathering

7.5.1

Configuration

Group type
Single axis
7.5.2

Description

This example opens a TCP connection, kills the single axis group, then initializes and
homes the group. The program then configures the parameters for the external gathering
(data to be collected: ExternalLatchPosition and GPIO2.ADC1 value). It defines an
action (ExternalGatheringRun) to an event (Immediate). Each time the trigger in
receives a signal, the data is gathered (with a divisor equal to 1, gathering takes place
every signal on the trigger input). Every second, the current number of gathered data
points is displayed. At the end, the external gathering is stopped and saved in a text file
(ExternalGathering.dat in Admin/Public directory of the controller). Finally, the
program ends by closing the socket.
Please see Section 6, Proposed function for error handling.
7.5.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 "SINGLE_AXIS"
set
Positioner "SINGLE_AXIS.MY_STAGE"
set
Type1 "SINGLE_AXIS.MY_STAGE.ExternalLatchPosition"
set
Type2 "GPIO2.ADC1"
set
Event "Immediate"
set
Action "ExternalGatheringRun"
set
NbPoints
set
Div 1
set
0
Current
set
0
code
# Open TCP 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
if
{$code != 0} {
Number
Group name
1
SINGLE_AXIS
20
"OpenConnection $TimeOut socketID"]
[catch
"GroupKill $socketID $Group"]
34
Tcl Manual
Positioner name
SINGLE_AXIS.MY_STAGE

Hide quick links:

Advertisement

Table of Contents
loading

Table of Contents