CSIS3820 -- Low level support for SIS 3820 32 channel latching scaler module


#include <CSIS3820.h>
 class CSIS3820 {

  CSIS3820(unsigned long base, int crate = 0)
          throws std::string;

  const double getRevision();
  const void LightOn();
  const void LightOff();
  const unsigned int getCsr();
  const unsigned long getAcqMode();
  const void Reset();
  const void setOperatingMode(OperatingMode mode);
  const OperatingMode getOperatingMode();
  const void setInputMode(InputMode mode);
  const InputMode getInputMode();
  const void setLatchSource(LNESource mode);
  const LNESource getLatchSource();
  const void Arm();
  const bool isArmed();
  const void Enable();
  const void Disable();
  const bool isEnabled();
  const void EnableReferencePulser();
  const void DisableReferencePulser();
  const bool isReferencePulserEnabled();
  const void EnableTestCounter();
  const void DisableTestCounter();
  const bool isTestCounterOn();
  const void ClearChannels();
  const void DisableClearOnLatch();
  const void> EnableClearOnLatch();
  const unsigned long ReadChannel(unsigned int num);
  const void ReadAllChannels(unsigned long* buffer);
  const void Latch();
  const unsigned long ReadLatchedChannel(unsigned int num);
  void ReadAllLatchedChannels(unsigned long* buffer);
  const void LatchAndRead(unsigned long* buffer);


The CSIS3820 is a 32 channel latching scaler with several different modes of operation. At the NSCL we usually need to run scalers as simple latching scalers. That mode is the one best supported and tested.

Public member functions

CSIS3820(unsigned long base, int crate0);

Creates an object that can control an SIS 3820 scaler. The base parameter is the base address programmed into the rotary switches of the module, while the crate parameter is the VME crate number. If crate is not supplied it defaults to zero which is exactly right for a system with a single VME crate.

double getRevision(void);const

Returns the firmware revision from the Id/firmware revision register.

void LightOn(void);const

Turns on the user LED.

void LightOff(void);const

Turns the user led off.

unsigned int getCsr(void);const

Returns the contents of the control status register.

unsigned long getAcqMode(void);const

Returns the contents of the acquisition mode register.

void Reset(void);const

Does a software reset on the module.

void setOperatingMode(OperatingMode mode);const

Set the modue operating mode. See "Types and public data" below for a description of the OperatingMode data type.

OperatingMode getOperatingMode(void);const

Returns the module operating mode. See "Types and public data" for a description of the OperatingMode data type.

void setInputMode(InputMode mode);const

Set the module's input mode. This governs the meaning of the control inputs. See "Types and public data" for a description of the InputMode data type.

InputMode getInputMode(void);const

Returns the module's current input mode. The input mode determines the meaning of the inputs on the module's control bus. The InputMode data type and its allowed values are decribed further in "Types and public data" below.

void setLatchSource(LNESource mode);const

Set the source of the "load next event" signal. This signal determines when to latch data For more information about the LNESource data type and its allowed values, see the section "Types and public data" below

LNESource getLatchSource(void);const

Returns the current source of the "load next event" signal. See setLatchSource for more information about this.

void Arm(void);const

Arms the module. The module cannot be enabled until it is armed.

bool isArmed(void);const

Returns true if the module is armed for data taking.

void Enable(void);const

Enables the module. Once the module is armed and enabled, events can be latched into it using the Load next event source.

void Disable(void);const

Disables the module. When disabled, the module cannot take data (ignores its load next event source).

bool isEnabled(void);const

Returns true if the module is enabled for data taking.

void EnableReferencePulser(void);const

Enales the reference pulser to channel 0 of the scaler. The reference pulser is a 50Mhz data source that can be routed into the first of the scaler channels. Note that the manual numbers channels from 1, however we use the more conventionaly 0 based numbering.

void DisableReferencePulser(void);const

Disables the reference pulser. See EnableReferencePulser above for more information about the reference pulser.

bool isReferencePulserEnabled(void);const

Returns true if the reference pulser is enabled. See EnableReferencePulser and DisableReferencePulser for more information about how to turn this on and off.

void EnableTestCounter(void);const

Enables the test counter. The test counter is a 25Mhz pulser that can be enabled into all channels of the scaler.

void DisableTestCounter(void);const

Disables the test counter. See EnableTestCounter for more information about the test counter.

bool isTestCounterOn(void);const

Returns true if the test counter is enabled.

void ClearChannels(void);const

Clears the counters of all the channels of the scaler. Note that this does not clear the multi-event memory.

void DisableClearOnLatch(void);const

By default, the Latch next event pulse clears the counters. This makes the event buffers incremental scaler values, which is what scaler programs at the NSCL expect. This disables that function making the scaler values read 'absolute' values..at least until they roll over.

void> EnableClearOnLatch(void);const

Enables the scalers to clear counters on the "Load next event" signal.

unsigned long ReadChannel(unsigned int num);const

Reads a single channel from the scaler. Note that this function reads the live counters, rather than the event memory or latches. The live counters may be unstable.

void ReadAllChannels(unsigned long* buffer);const

Reads all of the scaler channels. Note that this uses ReadChannel to operate. This means that the raw counters are read, not the latched values so there is at least time skew between channel 0 anbd channel 31, and there may be some instability in the counter values.

void Latch(void);const

Latches the scaler counters in to the latches and the event buffer. Once latched the values are stable. The counters will be cleared if clear on latch is enabled (see DisableClearOnLatch and EnableClearOnLatch).

unsigned long ReadLatchedChannel(unsigned int num);const

Reads one of the latched channel registers. This will hold the value of a channel counter at the time of the last Load Next Event operation.

void ReadAllLatchedChannels(unsigned long* buffer);

Reads all 32 latch registers into buffer. These registers will hold the values of the counters as of the most recent "Load Next Event" signal.

void LatchAndRead(unsigned long* buffer);const

Peforms a load next event and reads all latch registers into the buffer.

Types and public data

The CSIS3820.h defines several enumerated data types that are passed to the various setup functions of the module.


This enumerated type defines the module operating modes:


The module will operate as a latching scaler. This is the only mode that is really supported at the NSCL.


In this mode, the scaler takes data for fixed repetetive time periods and then latches the values into its event memory. This mode is not really supported (yet), as there is no mechanims to access the multievent memory.


In this mode, the scaler performs much like the multiscaler mode described above except that the events saved are sums over all of the time periods.


This enumerated type defines the possible input modes for the device. Input modes determine the meaning of the control inputs. Section 7.18.2 of the SIS3820 manual provides a detailed description of the input modes. Possible values for this type include:


The inputs have no function (mode 0).


Input 1 is an external load next event pulse. Input 2 and 3 are external user inputs that are available in the control register. Input 4 is an inhibit for the Load Next Event input. (Mode 1).


(Mode 2). Input 1 is an external load next event input, input 2 is external user bit 1 in the status register, Input 3 inhibits counting in all channels of the scaler and Input4 inhibits te load nexte event input.


(Mode 3). Input 1 is the extneral latch next event. Inputs 2 and 3 are the user input bits 1 and 2 respectively in the control register and input 4 inhibits counting in all channels of the scaler.


(Mode 4). Each input inhibits a group of 8 channels. Input 1 inhibits channels 0-7, input 2 inhibits channels 8-15 etc.


Mode 5: Input 1 is the load next event input while input two starts the module's histogramming scaler data taking. All other inputs have no function.


Mode 6: Input 1 is the load next event input. Input 2 inhibits counting in all counters. input 3 clears all counters.


Sets source of the latch next event signal. This can have any of the following values:


Next event an only be latched from the VME (via calls to functions that latch the event such as Latch).


Latch only on front panel input. This requires an input mode be set that enables one of the front panel inputs as a Load next event signal.


Latches based on the 10Mhz internal clock divided by the latch preset register (not really supported)


Latch on the overflow of a channel selected by the LNE channel select register.


Latch on counts in the selected scaler register divided by the preset register value.


std::string exceptions get thrown when various error conditions occur.