From e6d39f3ac87df7e6e2ab57a3eafc240528fcdacf Mon Sep 17 00:00:00 2001 From: cvs Date: Fri, 14 Feb 2003 13:02:09 +0000 Subject: [PATCH] - Added a couple of forgotten files --- ecbdriv.h | 45 ++++++++++++++++++++++++++++++++++++++++++ nxsupport.tcl | 54 +++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 99 insertions(+) create mode 100644 ecbdriv.h create mode 100644 nxsupport.tcl diff --git a/ecbdriv.h b/ecbdriv.h new file mode 100644 index 00000000..eda63b58 --- /dev/null +++ b/ecbdriv.h @@ -0,0 +1,45 @@ +/*------------------------------------------------------------------------ + this is a motor driver for the Risoe motor controllers within the + ECB system. The motor is controlled through functions invoked in the + Z80 processor of the ECB system which is connected through a GPIB + bus to the wider world. This driver has to do a lot of extra things: + - it has to convert from physical values to motor steps. + - Quite a few parameters, such as ramping parameters, + have to be downloaded to the ECB + - Risoe motors may have a virtual encoder or a real encoder. + - The motor may have to control air cushions as well. + - Tricky backlash handling. Backlash handling ensures that a position is + always arrived at from a defined direction. If backlash is applied + a restart flag is set in ECBRunTo. ECBGetStatus checks for that and + causes the motor to drive back to the position actually desired. + + This driver support only P2048a motor controllers, as these are the + only ones which seem to have arrived at PSI. The P1648 and Tridynamic + things are not supported. + + Multiplexed motors: Originally the ECB supported 24 motors. This did + prove to be not enough. Therefore another device called P2234e was + introduced which allowed to run 8 motors from one controller port. In this + case the motor parameters have to be copied to the ECB before + driving the motor. Multiplexing is selected through the parameter MULT. + MULT 0 means no multiplexing, MULT > 0 makes MULT the number of the + motor in the multiplexer. MULT is now also used to flag a download of + parameters to the ECB. In such a case MULT is -1. + + + Some of this code was taken from the tascom driver for the ECB. + + copyright: see file COPYRIGHT + + Mark Koennecke, January 2003 + +--------------------------------------------------------------------------*/ +#ifndef ECBDRIV +#define ECBDRIV + +MotorDriver *CreateECBMotor(SConnection *pCon, int argc, char *argv[]); +void KillECBMotor(void *driver); + +#endif + + diff --git a/nxsupport.tcl b/nxsupport.tcl new file mode 100644 index 00000000..a4f8f5e4 --- /dev/null +++ b/nxsupport.tcl @@ -0,0 +1,54 @@ +#=========================================================================== +# Support routines for scripting NeXus files with nxscript. +# +# Mark Koennecke, February 2003 +#========================================================================== +proc makeFileName args { + sicsdatanumber incr + set num [SplitReply [sicsdatanumber]] + set p [string trim [SplitReply [sicsdatapath]]] + set pre [string trim [SplitReply [sicsdataprefix]]] + set po [string trim [SplitReply [sicsdatapostfix]]] + return [format "%s%s%5.5d2003%s" $p $pre $num $po] +} +#========================================================================== +proc writeFloatVar {alias var} { + set ret [catch {set val [SplitReply [$var]]} val] + if { $ret != 0} { + clientput [format "ERROR: failed to read %s, %s" $var $val] + return + } else { + nxscript putfloat $alias [expr $val * 1.0 ] + } +} +#========================================================================= +proc writeTextVar {alias var} { + set ret [catch {set val [SplitReply [$var]]} val] + if { $ret != 0} { + clientput [format "ERROR: failed to read %s" $var] + return + } else { + nxscript puttext $alias $val + } +} +#======================================================================== +proc writeTextAttribute {attName var} { + set ret [catch {set val [SplitReply [$var]]} val] + if { $ret != 0} { + clientput [format "ERROR: failed to read %s" $var] + return + } else { + nxscript putglobal $attName $val + } +} +#======================================================================= +proc writeStandardAttributes {fileName} { + nxscript putglobal file_name $fileName + nxscript putglobal file_time [sicstime] + writeTextAttribute instrument instrument + writeTextAttribute owner user + writeTextAttribute owner_telephone_number phone + writeTextAttribute owner_fax_number fax + writeTextAttribute owner_email email + writeTextAttribute owner_address adress +}