background image

  

 

XPS-Q8 

Universal High-Performance 

Motion Controller/Driver 

Tcl Manual 

V1.4.x 

Содержание XPS-Q8

Страница 1: ...XPS Q8 Universal High Performance Motion Controller Driver Tcl Manual V1 4 x...

Страница 2: ...in commercial applications 2017 by Newport Corporation Irvine CA All rights reserved Original instructions No part of this document may be reproduced or copied without the prior written approval of N...

Страница 3: ...rouping before Substitution 6 2 2 6 3 Grouping Math Expressions with Braces 7 2 2 6 4 More Substitution Examples 7 2 2 7 Procedures 7 2 2 8 A Factorial Example 8 2 2 9 More about Variables 9 2 2 9 1 F...

Страница 4: ...ption 23 7 1 3 Tcl code 23 7 2 Using Digital I O for Motion 26 7 2 1 Configuration 26 7 2 2 Description 26 7 2 3 Tcl Code 26 7 3 GPIO1 Test 29 7 3 1 Description 29 7 3 2 Tcl Code 29 7 4 Gathering with...

Страница 5: ...scription 49 7 10 3 TCL Code 49 7 11 Backlash Compensation 51 7 11 1 Configuration 51 7 11 2 Description 51 7 11 3 TCL Code 51 7 12 Timer Event and Global Variables 53 7 12 1 Configuration 53 7 12 2 D...

Страница 6: ...XPS Q8 Tcl Manual EDH0307En1041 10 17 vi...

Страница 7: ...TCP IP protocol and uses a website approach for software tools and an FTP server for file transfers This makes the XPS controller mostly independent from the user s operating system When networked Un...

Страница 8: ...ng Value substitution of nested commands variables and backslash escapes Command invocation It is up to the command to interpret its arguments NOTE The Tcl gets from stdio command is not supported 2 2...

Страница 9: ...Substitution The second form of substitution is command substitution A nested command is delimited by square brackets The Tcl interpreter takes everything between the brackets and evaluates it as a co...

Страница 10: ...evaluator supports a number of built in math functions Example 1 6 computes the value of pi Example 1 6 Built in math functions set pi expr 2 asin 1 0 3 1415926535897931 The implementation of expr is...

Страница 11: ...aping newlines First if you are grouping an argument as described in the next section then you do not need to escape newlines the newlines are automatically a part of the group and will not terminate...

Страница 12: ...the whole nested command as part of the group puts stdout string length s The following is a redundant use of double quotes puts stdout expr x y 2 2 6 2 Grouping before Substitution The Tcl parser mak...

Страница 13: ...bstitutions without white space between them you can avoid grouping with quotes The following command concat applied to variables a b and c will concatenate them set concat a b c Again if you want to...

Страница 14: ...acing the curly braces around the procedure body is to delay any substitutions in the body until the procedure is called For example the variables a b and c are not defined until the procedure is call...

Страница 15: ...t a positive or negative integer by which to change the value of the variable In this form it is possible to eliminate the loop variable i and just modify the parameter x The loop body can be written...

Страница 16: ...iable names contain only letters digits and the underscore The construct foo o represents a concatenation of the value of foo and the literal o If the variable reference is not delimited by punctuatio...

Страница 17: ...rounding digit 0 33333333333333331 In Tcl 8 0 and later versions the overhead of conversions is eliminated in most cases by the built in compiler Nevertheless Tcl was not designed to support math inte...

Страница 18: ...it still in the comment A surprising property of Tcl comments is that curly braces inside comments are still counted for the purposes of finding brace pairs This inconvenient feature was probably int...

Страница 19: ...extra substitutions 2 2 13 Fine Points A common error is to forget a space between arguments when grouping with braces or quotes This is because white space is used as the separator while the braces o...

Страница 20: ...Carriage return 0xd t Tab 0x9 v Vertical tab 0xb newline Replace the newline and the leading white space on the next line with a space Backslash ooo Octal specification of character code 1 2 or 3 dig...

Страница 21: ...g3 arg4 arg5 BootScriptFileName is the file name of the Tcl script This file must be stored in the Admin Public Scripts folder of the XPS controller BootScriptArguments defines the list of arguments o...

Страница 22: ...ol information in an 8 bit byte oriented data connection over the Transmission Control Protocol TCP This is a useful common protocol used to dialog with a remote machine A telnet connection is opened...

Страница 23: ...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 display hello world message puts telnetOu...

Страница 24: ...XPS Q8 Tcl Manual 4 2 3 Tcl script execution result The Tcl script execution result is shown on the opened telnet session window EDH0307En1041 10 17 18...

Страница 25: ...ngGet socketID code strError puts telnetOut GetLibraryVersion Not OK error code strError Force transfer to channel s output buffer flush telnetOut else puts telnetOut Library Version strVersion Force...

Страница 26: ...e2 catch ErrorStringGet socketID code strError If error occurred with the API ErrorStringGet if code2 0 Display API name error code and ErrorStringGet error code in the telnet window when using APIs T...

Страница 27: ...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 Open socket set TimeOut 60 s...

Страница 28: ...lowing code is used Operation set ErrorCode catch GroupInitialize socketID S Error management if ErrorCode 0 DisplayErrorAndClose socketID code GroupInitialize return If an error occurs the script ret...

Страница 29: ...alue of the analog input When the GPIO2 input voltage is equal to or less han the limit of 0 2 volt the final move and display occurs Finally the program ends by closing the socket If the voltage is l...

Страница 30: ...set var 0 var 5 incr var set code catch GroupMoveRelative socketID group 1 1 if code 0 DisplayErrorAndClose socketID code GroupMoveRelative telnetOut return Get analog value set code catch GPIOAnalogG...

Страница 31: ...telnetOut return Move axis 2 set code catch GroupMoveAbsolute socketID axis2 move2 if code 0 DisplayErrorAndClose socketID code GroupMoveAbsolute telnetOut return Wait 1 second and close socket after...

Страница 32: ...s 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...

Страница 33: ...D code GroupMoveRelative telnetOut return Get digital value set code catch GPIODigitalGet socketID digitalin value if code 0 DisplayErrorAndClose socketID code GPIODigitalGet telnetOut return Test if...

Страница 34: ...roupMoveAbsolute telnetOut return else after 100 after 1000 Wait 1 second and close socket after 1000 puts telnetOut End of program Force transfer to channel s output buffer flush telnetOut TCP_CloseS...

Страница 35: ...sed 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 pas...

Страница 36: ...et telnetOut return Get value of output of GPIO1 and store it in OC set code catch GPIODigitalGet socketID output OC if code 0 DisplayErrorAndClose socketID code GPIODigitalGet telnetOut return else p...

Страница 37: ...end the gathering is stopped and saved in a text file Gathering dat in Admin Public directory of the controller Finally the program ends by closing the socket Please see sections 4 Principle of a Tcl...

Страница 38: ...DisplayErrorAndClose socketID code GroupInitialize telnetOut return Home group set code catch GroupHomeSearch socketID Group if code 0 DisplayErrorAndClose socketID code GroupHomeSearch telnetOut ret...

Страница 39: ...catch GatheringStopAndSave socketID if code 0 DisplayErrorAndClose socketID code GatheringStopAndSave telnetOut return Close TCP socket set code catch TCP_CloseSocket socketID When pressing the Gather...

Страница 40: ...ectory 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 exampl...

Страница 41: ...GatheringExternalConfigurationSet telnetOut return Add an event set code catch EventAdd socketID Positioner Event 0 Action NbPoints Div 0 if code 0 DisplayErrorAndClose socketID code EventAdd telnetOu...

Страница 42: ...de GatheringExternalStopAndSave telnetOut return Close TCP socket set code catch TCP_CloseSocket socketID This is what gets displayed in a Telnet window for the above example and when the trigger in r...

Страница 43: ...e 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...

Страница 44: ...s set code catch PositionerPositionCompareSet socketID Positioner MinPos MaxPos StepPos if code 0 DisplayErrorAndClose socketID code PositionerPositionCompareSet telnetOut return Enable position compa...

Страница 45: ...ogram 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 7 3 TCL Code Set channel s name to be used...

Страница 46: ...nitialize XY group set code catch GroupInitialize socketID XYGroup if code 0 DisplayErrorAndClose socketID code XY GroupInitialize telnetOut return Home XY group set code catch GroupHomeSearch socketI...

Страница 47: ...oupMoveRelative socketID MasterPositioner Displacement if code 0 DisplayErrorAndClose socketID code GroupMoveRelative telnetOut return Disable master slave mode set code catch SingleAxisSlaveModeDisab...

Страница 48: ...telnet session 6 Proposed function for error handling 7 8 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 specifie...

Страница 49: ...set code catch GroupJogParametersSet socketID Positioner Velocity1 Acceleration if code 0 DisplayErrorAndClose socketID code GroupJogParametersSet telnetOut return Wait 3 seconds after 3000 Set jog p...

Страница 50: ...isition number of data types 1000000 4 250000 It defines an action GatheringRun to an event Immediate When the jog mode is enabled it changes the jog speed and acceleration At the end the jog mode is...

Страница 51: ...teur if code 0 DisplayErrorAndClose socketID code GroupInitialize telnetOut return Home group set code catch GroupHomeSearch socketID Moteur if code 0 DisplayErrorAndClose socketID code GroupHomeSearc...

Страница 52: ...if code 0 DisplayErrorAndClose socketID code GroupJogModeEnable telnetOut return Wait 2 seconds after 2000 puts telnetOut Jog moves and data acquisition Force transfer to channel s output buffer flush...

Страница 53: ...playErrorAndClose socketID code GroupJogParametersSet telnetOut return puts telnetOut X positioner going in negative direction during 2 sec flush telnetOut puts telnetOut Y positioner going in positiv...

Страница 54: ...500 Disable jog mode set code catch GroupJogModeDisable socketID Moteur if code 0 DisplayErrorAndClose socketID code GroupJogModeDisable telnetOut return Stop gathering and save data set code catch G...

Страница 55: ...cl script redirection to a telnet session 6 Proposed function for error handling 7 10 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 fi...

Страница 56: ...tID code PositionerAnalogTrackingPositionParametersSet telnetOut return Enable analog position tracking mode group must be ready set code catch GroupAnalogTrackingModeEnable socketID Group TrackingTyp...

Страница 57: ...eter in the stages ini file must be greater than zero To apply any modifications of the stages ini the controller must be rebooted after the modification is made Please see the sections 4 Principle of...

Страница 58: ...e GroupInitialize telnetOut return Home group set code catch GroupHomeSearch socketID Group if code 0 DisplayErrorAndClose socketID code GroupHomeSearch telnetOut return Modify Backlash value Caution...

Страница 59: ...ipt tcl The StartScript tcl script sets a global variable and closes the socket The timer is a permanent event The frequency of the timer is set by the divisor in this example 20000 which means that t...

Страница 60: ...set Divisor expr int Divisor puts telnetOut Divisor troncated in integer Divisor flush telnetOut Configure a timer set code catch TimerSet socketID TimerName Divisor if code 0 DisplayErrorAndClose so...

Страница 61: ...cket set code catch OpenConnection TCPTimeOut socketID if code 0 puts OpenConnection failed code else Read global variable set code catch GlobalArrayGet socketID GlobalVarNumber ReadValue if code 0 Di...

Страница 62: ...Arguments 7 13 1 Configuration Group type Number Group name Positioner name Single axis 1 SINGLE_AXIS SINGLE_AXIS MY_STAGE 7 13 2 Description This example opens a TCP connection kills the single axis...

Страница 63: ...ut Initialization set TimeOut 20 set code 0 set group SINGLE_AXIS Open TCP socket set code catch OpenConnection TimeOut socketID if code 0 puts telnetOut OpenConnection failed code flush telnetOut els...

Страница 64: ...etOut return Loop until the number of cycles for set i 0 i cycles incr i Move group to start position set code catch GroupMoveAbsolute socketID group startpos if code 0 DisplayErrorAndClose socketID c...

Страница 65: ..._____________________________________________________________________________________________________ __________________________________________________________________________________________________...

Страница 66: ...mail tech newport com Service RMAs Returns Tel 800 222 6440 e mail service newport com Europe MICRO CONTROLE Spectra Physics S A S 9 rue du Bois Sauvage 91055 vry CEDEX France Sales Tel 33 0 1 60 91 6...

Отзывы: