madc

Name

madc -- Acquire events from Mesytec MADC32 ADC.

Synopsis

madc create name ?options?

madc config name ?options?

madc cget name

DESCRIPTION

The madc command provides scripted support for the Mesytec 32 channel peak sensing adc module. For scaler support for this module's dead time counters, see the madcscaler command.

As with all VM-USB module support commands, madc is a command ensemble with subcommands that create and configure modules as well as cget which introspects a module configuration.

create creates an object with the specified name. Additional options are treated like configuration options. config configures an existing module, and cget returns a list of configuration name/value pairs that describe the configuration of the module.

It is important to note that the module configuration does not actually get loaded until the run is initialized. The order in which configuration parameter are supplied is therefore unimportant. Think of the configuration options as being accumulated and then applied as the run starts. Only modules that are in stack are configured.

OPTIONS

-base address

address must be the module base address as configured in its rotary switches. This base address is used to access the module's register and event memory.

Each module must be programmed and hardware configured with a different base address. The address used will be an A32 VME address.

-id vsn

vsn will be used as the module's identifier or virtual slot number. The vsn will be encoded into the event data that is returned by the module. This, in turn is normally used by event decoders to determine which parameters the channels of the module should be unpacked into.

Each module should be given a unique vsn.

-ipl irqlevel

If the module will be used to trigger an interrupt driven stack, the irqlevel parameter must be programmed to a valid non zero interrupt priority level (1 through 7). This must match the interrupt priority level used to trigger the stack.

The default value of 0 disables module interrupts.

-vector statusId

If the module will be used to trigger an interrupt driven stack, the statusId must be programmed to a non zero 8 bit status id, or vector (between 1 and 255

The value used must match the value of the -vector configuration parameter used to trigger the stack.

-timestamp onoff

This option controls whether or not the module tags each event with a trigger number or with a timestamp (see also the -timingsource and -timingdivisor options).

The onoff is a boolean value. If true, the module tags events with a timestamp. If false, with a trigger number.

-gatemode mode

The MADC32 has a pair of gate inputs. The inputs may be used either as separate gates, where each gate controlls 16 of the 32 channels, or as common where either input will gate all 32 channels.

The value mode should be either separate or common.

-gategenerator onoff

The module can either use the gates as provided or can insert a gate and delay generator between the gate inputs and the actual gates seen by the ADCs. Since in most cases, gate must be stretched and timed to match the ADC inputs, this feature can reduce the external electronics needed to properly gate the adc.

The onoff is a boolean that if true enables this gate generator, if false, disables it. See also the -holddelays and -holdwidths configuration parameters that control the gate and delay parameters for each of these resources.

-holddelays delayList

If the gate generators are enabled (see -gategenerator above), the delayList is a Tcl list consisting of the two delay parameters, one for each of the gate and delay generators. See the MADC32 manual for a description of the meaning of these values, which are just the values programmed into the module registers.

-holdwidths widthList

If the gate generators are enabled (see -gategenerator above), the widthList is a Tcl l ilst consisting of the two gate and delay generator width parameters. See the MADC32 manual for a description of the meaning of these values, which are just the values programmed into the module registers.

-inputrange rangeSelector

Programs the input range for the module. The rangeSelector must 4v, 8v, or 10v. Where the selector represents the input range in volts.

-ecltermination onoff

This parameter when true enables the ECL input termination. If disabled, the termination is off. If you are bussing the ECL inputs, only the final module in the bus should have terminatinon enabled, all other modules, should have termination turned off.

-ecltiming onoff

This parameter, when true enables tge gate1 ECL input to to be a clock source for the timestamp if true. If false, The ECL G1 input is an ECL gate1.

-nimtiming onoff

If true, enables the NIM Gate1 input to be a clock source for the timestamp. If not, the NIM Gate1 input is an adc gate.

-timingsource sourceName

Specifies the source of the clock for timestamps. If external, whichever of the NIM or ECL GATE1 inputs are enabled is the clock source. If vme the VME 16Mhz backplane clock is the clockk.

-timingdivisor log2

Specifies a scale-down value for the timestamp clock. At the time I'm typing this, this value is log base 2 of the scale down, that is the final scale down is 1 << log2. By the time we get installed, I am supposed to have some firwmare that will allow this to be a 16 bit direct scaledown (e.g. the scaledown would be between 1 and 65535).

-thresholds valueList

Supplies the per channel thresholds for the adc. Channels which convert below their threshold are suppressed from the data stream reducing both data volume and dead-time. The valueList is a 32 element Tcl list of the integer thresholds.

Note that at the time I'm typing this, channel thresholds have not yet been implemented in the firmware. The firmware I bring with me at installation time will hopefully implement this feature.

-nimbusy busyselect

This option selects which signal is presented at the NIM busy output lemo connector. By default, this will be the module busy. The busyselect can be any of the following strings:

busy

The module busy is output. This is the default.

gate0

The Gate0 signal is output. If the internal gate and delay generator is enabled for Gate0, the output will be the output of the gate and delay generator. This provides a mechanism to check the gate timing on a scope if you are using the internal gate and delay generators.

gate1

The Gate1 signal is output. If the internal gate and delay generator is enabled for Gate1, the output will be the output of the gate and delay generator. This provides a mechanism to check the gate timing on a scope if you are using the internal gate and delay generators.

It is not clear to me what happens if you are using module common gates.

cbus

The CBUS output is reflected here.

-multievent boolean

Allows the module to be used in multi-event mode. This is normally done in conjunction with the madcchain configuration command. It also usually requires a custom SpecTcl version to handle the data from this device.

the default value for this parameter is false which runs the module in single event mode.

-irqthreshold integer

Sets the interrupt threshold. When a number of complete events have put at least this number of longwords in the fifo, if interupts are enabled, the module will interrupt.

-resolution 2k|4k|4khires|8k|8khires

Sets the resolution of the module. This has an impact on the conversion time.

EXAMPLES

Example 1. Sample use of madc command


set madcTimeDivisor 14

madc create adc -base 0x40000000 -id 5 -ipl 0             (1)
madc config adc -gatemode common -gategenerator disabled
madc config adc -inputrange 8v
madc config adc -timestamp on -timingsource vme -timingdivisor $madcTimeDivisor  (2)

for {set i 0} {$i < 32} {incr i} {
    lappend thresholds 0                                 (3)
}
madc config adc -thresholds $thresholds                  (4)

            
(1)
This command creates an object to manage an MADC 32 whose base address is 0x40000000. The module will be referred to by the symbolic name: adc
(2)
This line illustrates substitution of a Tcl variable for a parameter value. Tcl variable substition is textual, so you can also use varibles to hold option names, though that may be a bit odd.
(3)
This highlights the fact that the configuration file is really a configuration program. The loop creates a varaiable named thresholds that contains a list of 32 zeroes. This list will be used to program the adc thresholds. Normally these values will neither be zero nor uniform from channel to channel. It may be best to read them from some external file.
(4)
This command uses the thresholds variable and programs the channel thresholds of the ADC.