stack -- Create and configure CC-USB stacks.


stack create name

stack config name option value...

stack cget name


Creates and configures CC-USB stacks. Stacks are lists of CAMAC operations that are loaded into the CC-USB for autonomous execution. There are two types of stacks; an event stack that is executed when a front panel trigger or a specified LAM is detected, and a scaler stack that can be periodically triggered.

Stacks contain lists of modules. The modules themselves determine the set of readout instructions that make up each stack.

The create subcommand creates a new stack. The name of the new stack is name. This name will be used to refer to this stack in future configuration commands.

The config subcommand configures the stack name. The configuration is specified as a set of option value pairs. The options are described in the section OPTIONS below.

The cget subcommand returns the configuration of the stack name as its command value. This subcommand is intended for advanced applications that may analyze the configuration of the stack. The configuration is returned as a properly formatted Tcl list. Each element of the list is itself a two element sublist (pair). The first element of each pair is the name of a configuration parameter the second, that configuration parameter's value. Note that the value may itself be a list.


Options are used to configure the stack. Each option has associated with it a keyword that selects it and a value. The option s supported by the stack command are subdivided into three groups:

  1. Options used for both event and scaler stacks.

  2. Options that are only used for event stacks and are ignored for scaler stacks

  3. Options that are only used for scaler stacks, and are ignored for event stacks.

Options for all stack types.

-type stack-type

Defines the type of stack that is being used. This can be one of the keywords event for event stacks or scaler for scaler stacks. The CC-USB only supports one scaler and one event stack. The current version of the configuration engine allows you to create more than one of each stack. In that case, it is not well defined which stacks are actually loaded.

The default -type is event.

-incremental bool

If true (the default), scaler ring items are marked as incremental. If not they are marked as non-incremental.

-modules module-list

This option defines the set of modules that are added to the stack. module-list is a properly formatted Tcl list of names of modules (ph7xxx's in this implementation) that will be read by this stack. See the EXAMPLES section below for more information.

The list defaults to empty which is not legal, making this a mandatory configuration parameter.

Event stack options.

-lams mask

Specifies the mask of LAMs that can trigger the list. I suggest leaving this value at zero (the default), and deriving a trigger signal for the NIM IN1 input as the readout trigger.

-lamtimeout microseconds

The ph7xxx command delays the read of the module until it is signalling a LAM. microseconds specifies the total number of microseconds the stack should wait for this LAM. The value should be on the order of the conversion time of the module. Defaults to zero.

-delay microseconds

Delays the execution of the stack for microseconds microseconds after the trigger condition is detected. This can be used to ensure the digitization hardware has sufficient time to complete its digitization prior to stack execution. Defaults to zero.

Note that in general this value is not suitable as CAMAC digitizers often require a significant amount of time to convert after their triggers.

Options only available for scalers stacks. The options below are only legal for stacks of -type scaler

-period seconds

Number of seconds between execution of the scaler stack. This defaults to 2.


The example below extends the example in the ph7xxx(3ccusb) command reference reading the defined modules in an event stack:

Example 1. Example of the stack command.

ph7xxx create adc1 -slot 6
ph7xxx create adc2 -slot 7                                  (1)

stack create events                                         (2)
stack config events -type event -modules [list adc1 adc2]   (3)
stack config events -delay 10 -lamtimeout 8                 (4)
These two lines define the modules that we will be using for the experimental setup.
Creates a new stack called events In subsequent lines I'm going to configure this stack to handle the event trigger.
The stack is configured to be the event stack, and the two modules we created adc1 and adc2 are added to the stack in that order. When the stack is loaded, it will contain the instructions to read out these two modules.
Configures the stack so that the CC-USB will start stack execution 10 microseconds after the IN1 trigger. Stack instructions that wait for a lam on their target module will wait at most 8 microseconds. Since the -lams option is left to default to zero, CAMAC lams will not be able to trigger the list.