spec

Software for Diffraction

SIS3820

Struck SIS3820 VME Scaler

DESCRIPTION

The Struck SIS3820 VME Scaler has been supported by spec as a 32-channel counter/timer since spec release 5.04.03-5 from 2003. Multi-channel scaler (MCS) support was added in release 6.08.05.

spec can be configured to use the same module as both a regular timer/counter and as an MCS, although the module can be only be operated in one of the modes at a time. It is not necessary to change the hardware configuration to switch between modes. If active using tcount() or mcount(), for example, a call of mca_par("run") will result in an error. Likewise if the module is active as an MCS, the counting functions will generate an error. It is not possible to use the MCS in "auto_run" mode if the SIS3820 is also configured as a timer/counter or counter device.

In the sections that follow, items that apply to only one of the modes will be marked as COUNTERS or MCS.

COUNTERS: When used as timer, any of the counter inputs can be used as a preset. The recommended configuration is to leave the output mode at the default value of 1, which produces a 50 MHz clock on control output 7. That signal can then be connected to a counter channel (channel 0 is customary) to serve as the real-time counter. In addition, output mode 1 allows control output 6 to be used to gate other devices. If another frequency source or counter for the sec channel is available, then the hardware and parameters can be configured accordingly. The counter_par() "monitor" command can be used to set which counter will be used for the counting-to-monitor preset.

MCS: Although the SIS3820 can be used as a traditional MCS, it is specifically supported in spec with new standard flyscan macros. These macros do continuous scans with the MCS channel advance driven by pulses from a motor. The motor signal can connect to any counter, and the counts will be prescaled to match the fly-scan parameters. With motor pulses generating the channel advance, each multi-channel scaler channel can be associated with an accurate motor position. See the flyscan help for details.

In MCS mode, any or all of the 32 counters can be used as an MCS input. The MCS collection is divided into channels and passes. A normal MCS sums data in each channel over each pass. In the current spec implementation, the SIS3820 stores data from each channel and each pass into a separate memory word. The SIS3820 is available with either 64 or 512 megabytes of memory to store such data. The device has a FIFO capability to stream data, but that is not currently supported by spec.

A 64 Mbyte unit has room to collect 4-byte data from all 32 counters using 1024 channels over 512 passes. Using just one counter would allow the number of channels or passes to increase proportionally. In addition, the word size can be set to 1, 2 or 4 bytes. Smaller word sizes allow more data to be accumulated.

spec will allocate a memory buffer big enough to hold all the data from all the counters, channels and passes configured at the start of an MCS run. The data is actively read and can be viewed during collection. The raw data from all counters, channels and passes can be read at once or in segments. The MCS sums from multiple passes can be read one counter at a time, as described below.

CONFIGURATION (COUNTERS)

Use spec's configuration editor (edconf, normally invoked by the config macro) to select the timer and to configure the scaler channels. On the Devices screen choose one of the following configurations depending on whether you are using the SIS3820 as master timer or as just as counters:

 SCALERS DEVICE  ADDR <>MODE NUM                          <>TYPE U#
0  YES     0x38000000         32 Struck SIS3820 as Timer/Counter  0
1  YES          <0000         32      Struck SIS3820 as Counters  1

The ADDR field is set according to the rotary address switches on the SIS3820 board. The address shown above is the factory default.

On the Scaler screen of the configuration editor, choose SIS3820 for the controller type:

Scaler (Counter) Configuration

Num     Name  Mne <>Device Unit Chan <>Use As Scale Factor
  0  Seconds  sec  SIS3820    0    0 timebase     50000000
  1  Monitor  mon  SIS3820    0    1  monitor            1
  2 Detector  det  SIS3820    0    2  counter            1
  3       c3   c3  SIS3820    0    3  counter            1

If using a "timebase" counter, the scale factor needs to be set to the frequency of the input. The value 50e6 is appropriate if using the 50 MHz clock from control output 7.

CONFIGURATION (MCS)

MCS mode is configured on the Acquisition screen in spec's configuration editor:

MCA (1D) and Image (2D) Acquisition Device Configuration

MCA       DEVICE  ADDR  <>MODE                               <>TYPE
 0  YES     0x38000000          Struck SIS3820 Multi-Channel Scaler

Again, the ADDR field is set to match the settings of the rotary switches on the board.

FUNCTIONS

Note that values for the parameters "input_mode" and "output_mode" in counter mode and MCS mode are independent. Values can be set for each of the operation modes and those values will be saved to and restored from the state file.

COUNTERS: The counter_par() function takes an initial argument specifying a counter mnemonic or number. When using counter_par() for commands that apply to the entire module, the module affected will be the one associated with the mne argument.

counter_par(mne, "monitor")
Sets the channel assigned to mnemonic mne to be the monitor preset channel. The monitor channel gets reset when the config file is read on start up or on reconfig.
counter_par("input_mode" [, val])
The input mode bits in the operation-mode register control the behavior of the four input signals available on the controller front panel. Allowed values are from 0 through 6. The default value for counter/timer mode is 2.
counter_par("output_mode" [, val])
The output mode bits in the operation-mode register control the behavior of the four output signals available on the controller front panel. The default value is 1.
counter_par(mne, "veto_inhibit" [, val])
A value passed here will be written to the "veto external count inhibit register" when started in counter/timer mode (for firmware version 1.9 or later).
counter_par(mne, "test_pulse_mask" [, val])
A value passed here will be written to the "test pulse mask register" when the device is started in counter/timer mode (for firmware version 1.A or later). This register allows the 25 MHz internal test pulse train to be routed to any channel. If a nonzero value is written to this register, spec will enable counter test mode and the 25 MHz test pulses by writing to the "control/status register" when the device is started in counter/timer mode. In addition, val will be used to mask the channels that are to count external signals by writing to the "test pulse mask register". Note, spec will always mask channel 0 on the master unit, as spec uses that channel to measure elapsed time based on the 50 MHz internal signal.

MCS: The mca_par() function works on the default or currently selected MCA-type device. The mca_sel() command can be used to choose which MCA-type device is the current selection. (See the mca help file.) The mca_spar() function takes an initial argument that specifies the MCA-type device unit number, as set in the hardware config file. When using mca_spar() commands that apply to a particular counter channel, use a subaddress syntax, where the address argument is given as 0.0, 0.1, ..., 0.31. The first digit is the MCA unit number from the config file, and the digit right of the decimal point is the counter channel, which can be from 0 through 31. The syntax "0:0", "0:1", ..., "0:31" is also recognized, where the arguments are strings.

All parameters are saved to the state file.

mca_par("run")
Programs and starts the SIS3820 for MCS acquisition.
mca_par("halt")
Halts the SIS3820 MCS acquisition.
mca_par("passes" [, value])
Selects or returns the configured number of MCS passes.
mca_par("dwell" [, value])
Selects or returns the channel dwell value. Negative values indicate external dwell. The magnitude of the negative value is used to estimate the data rate.
mca_par("channels"|"npts" [, value])
Selects or returns the number of channels per pass.
mca_par("start_mode" [, value])
Selects or returns the start mode. MCS acquisition can begin when the device is started (mode 1) or with the first channel advance (mode 0).
mca_par("input_mode" [, val])
The input mode bits in the operation-mode register control the behavior of the four input signals available on the controller front panel. Allowed values are from 0 through 6. The default value for MCS mode is 0.
mca_par("output_mode" [, val])
The output mode bits in the operation-mode register control the behavior of the four output signals available on the controller front panel. Allowed values are from 0 through 3. The default value is 3.
mca_par("word_size" [, 1|2|4])

Selects or returns the MCS word size, which can be one, two or four bytes per word. Smaller word sizes can allow faster acquisition and more data to be accumulated.

Note, the MCS requires a full four-byte word for each data transfer. If channels 0 and 8 are enabled with a one-byte word size, two full four-byte words are transferred as the channels are located on different words. If any or all of only channels 0, 1, 2 and 3 are enabled, only one four-byte word is transferred.

Note also, spec will use four-byte data arrays to read data with mca_get() no matter what the acquisition word size.

mca_par("first_counter" [, chan])
Selects or returns the number of the first counter to be read during data acquisition. Can be used with "last_counter" to enable consecutive channels.
mca_par("last_counter" [, chan])
Selects or returns the number of the last counter to be read during data acquisition. Can be used with "first_counter" to enable consecutive channels.
mca_par("counters" [, mask|arr])
Enables an arbitrary set of channels to be enabled. The argument can be a single number where each set bit corresponds to an enabled channel. Alternatively, the argument can be a one- or two-dimensional associative array, where the index of the element (first element for a 2D array) contains the hardware channel number, and the corresponding element value has a nonzero or non-null value to indicate the channel is to be enabled.
mca_par("prescale_counter" [, chan])
Selects or returns the counter to be used for channel advance. The counts in this channel can be prescaled according to the "prescale" value. The chan argument is the counter number, which is from 0 to 31. This counter can not be enabled for MCS acquisition.
mca_par("prescale" [, value])
Selects the prescale value for the designated prescale counter. Every value input pulses will generate one channel advance.
mca_par("elapsed_passes")
Returns the current number of elapsed passes. The return value can be non integral reflecting the progress in transmitting data from the current pass. The value is estimated from the data so far read from the device. Data is read in chunks, so the calculated value will be granular.
mca_par("elapsed_channels")
Returns the current channel number in the current pass. The value is estimated from the data so far read from the device. Data is read in chunks, so the calculated value will be granular.
mca_par("elapsed_time")
Returns the elapsed time of the current acquisition based on the software clock.
mca_par("report"|"report2")

Displays the current MCS parameters along the following lines:

Struck SIS3820 (fw 1 A1, 64Mb) at VME A32 0x38000000.

    Enabled counters = 0 2 3 14 15 (0xc00d)
    Chan Adv counter = 31
            Prescale = 6
               Dwell = external (0.01 sec)
          Start mode = on first channel advance (1)
        MCS channels = 2001
              Passes = 1
           Word size = 2 bytes
          Input mode = 2
         Output mode = 3
       Invert inputs = NO
      Invert outputs = NO

    Elapsed channels = 2001
      Elapsed passes = 1.00
        Elapsed time = 20.24 sec
           Data rate = 1200 bytes/sec

The form "report2" includes the mca_par() argument string associated with the parameter displayed. The parenthesized value for enabled counters is the bit-wise representation that can be passed as an argument. The time associated with external dwell is the value passed in the argument used to estimate the data rate.

mca_par("chans"|"max_chans"|"max_channels")
Returns the currently configured number of points for the device. For the SIS3820, the number is the product of the configured number of counters, channels and passes. The value is recalculated when any of those parameters is changed. This value is the size of the array needed when reading back the raw data. If either the number of counters or number of passes is greater than one, one either needs to specify the roi_beg and roi_end arguments with mca_get() and mca_sget() or pass an array dimensioned to this "chans" value.
mca_get(arr [, roi_beg [, roi_end]])
Gets data from the MCS associated with the first counter configured and transfers it to the array arr. The optional region-of-interest arguments limit the data to the range of channels indicated. The data is placed starting at the beginning of the array. For multiple passes, data from each pass is summed for each channel.
mca_sget(addr[.ch]|"addr:ch", arr [, roi_beg [, roi_end]])
Gets data from the MCA unit number addr. If the subaddress ch is specified, data from that counter number will be returned. If the subaddress is not specified, data from the first counter will be returned. The function will return zero if ch is not an enabled channel. If the optional region-of-interest beginning and ending channels are given, the data is returned from those channels and placed starting at the beginning of the array. For multiple passes, data from each pass is summed for each channel. If the subaddress ch is 32, the raw data from all the counters, channels and passes is returned in a single array. Such data is ordered consecutively by counter, channel, pass.

If more than one pass or more than one counter is configured, the number of MCA channels associated with the device is the product of counters, channels and passes, which is the value returned by mca_par("chans"). Either the array passed to the mca_get() and mca_sget() functions has to be that size, or the region of interest arguments need to be specified.

COUNTERS and MCS:

The following counter_par(), mca_par() and mca_spar() commands are available. The shorthand xxx_par() is used to represent all three for the commands available in both counter and MCS modes. The initial counter mnemonic argument for counter_par() or MCA selection argument for mca_spar() will not be shown.

xxx_par("invert_inputs" [, how])
If passed with a nonzero argument, will set the "control inputs inverted" bit in the module's operation-mode register when the device is programmed for acquisition. With no argument, returns the current value of the parameter.
xxx_par("invert_outputs" [, how])
If passed with a nonzero argument, will set the "control outputs inverted" bit in the module's operation-mode register when the device is programmed for acquisition. With no argument, returns the current value of the parameter.