Chapter 52. Tcl CAENet package

CAENet is a serial proprietary device control network developed by CAEN to control power supplies and NIM amplifiers. CAENet should not be confused with CANnet which is a completely different device control network.

This chapter describes how to incorporate a pure Tcl package caennet built on top of the the TCL Vme package that provides access to the CAEN VME CAENet controller (V288). For reference information see caenet(3tcl)

Incorporating the package into your Tcl scripts requires that you

  1. Add the NSCLDAQ Tcl package repository to the Tcl directory searc list.

  2. Explicitly load the package.

  3. Optionally import the commands fromt he caennet namespace.

The remainder of this chapter describes how to perform these steps.

You can incorporate the NSCL DAQ Tcl pacakge repository in the Tcl package search list either by setting an environment variable, or by adding it to the list of directories in the Tcl global variable auto_path.

Suppose you have defined the environment variable DAQROOT to point to the top level directory in which NSCLDAQ has been installed. To add the DAQ Tcl package repository to the search path via an environment variable with the bash shell:


export TCLLIBPATH="$TCLLIBPATH $DAQROOT/TclLibs"
                

The Tcl global variable auto_path specifies a list of directories that are also searched for packages. The same effect can be gotten via:


global env
global auto_path
lappend auto_path [file join $env(DAQROOT) TclLibs]
                

Once the path to the NSCLDAQ Tcl library directory has been established, you must load the package. This is done via the package require command:


package require caennet
                

All of the caennet commands are located in the caennet namespace. You can use these commands directly e.g.:


set cn [caennet::create 0x200000];    # Talk to the controller a 0x200000
...
                

You can also import these commands so that you con't have to qualify them with the caennet:: prefix:


namespace import caennet::*
...
set cn [create 0x200000];    # caennet::create
reset $cn;                   # caennet::reset
...                          # Other caennet ops.
delete $cn;                  # caennet::delete