Setting up the module in latching mode.

Setting up the module involves the following steps:

Constructing a module object.

Modules objects are created by constructing them. The constructor CSIS3820::CSIS3820 supports the construction of a module at any base address in any VME crate. At present, geographically based construction is not supported as the NSCL does not have any VME64 crates.

The code below might be put into your iniscl() function:

          CSIS3820* pModule(0);
           ...
          void iniscl()
          {
           ...
             if(!pModule) pModule=new CSIS3820(0x38000000);
           ...
          }

If pModule is a null pointer, this code constructs a scaler object at base address 0x38000000 in crate 0 (the default crate) and assigns the pointer to the address of the module.

Note that the module constructor calls CSIS3820::Reset.

Setting the operating mode.

The SIS3820 has several operating modes. Each of the hardware modes is described by one of the values of the enumerated type

          CSIS3820* pModule(0);
           ...
          void iniscl()
          {
             ...
             if(!pModule) pModule=new CSIS3820(0x38000000);
             pModule->setOperatingMode(CSIS3820::LatchingScaler);
              ...
          }

Setting the Input modes.

The SIS3820 have a four NIM control inputs. These inputs have programmable functionality. The manual refers to this programmable functionality as the modules Input Modes.

The valid input modes are described by the enumerated constants CSIS3820::InputMode. The valid input modes are:

Continuing with the examples in Constructing a module object. and Setting the operating mode., To set the module so that it has a Latch external input and an inhibit input for all channels, you might choose input mode CSIS3820::InputLatchInhibitAll as shown in the extended example below:

          CSIS3820* pModule(0);
           ...
          void iniscl()
          {
             ...
             if(!pModule) pModule=new CSIS3820(0x38000000);
             pModule->setOperatingMode(CSIS3820::LatchingScaler);
             pModule->setInputMode(CSIS3820::InputLatchInhibitAll);
              ...
          }

Note:
Note that the external latch inhibit will never inhibit the software latch functionality.

Specifying whether or not the module will clear on a latch.

The SIS3820 is a `dual-rank' scaler. This means that it has a set of counters. At any time the counters can be read, however if they are counting while read there will be skew between the values of the channels. `Latching' the module transfers the contents of the counters into a set of shadow registers. This transfer takes place in time on the order of 5ns. Therfore doing a latch and then a read of the shadow registers allows a skew-free read of the module.

By default, the module will clear its countesr when it is latched. This setting can be manipulated by the functions:

Non clear mode is useful when the scaler is used to provide a timebase (real time clock e.g.). To set up the module in this mode (continuing the the example we have been studying thus far):

          CSIS3820* pModule(0);
           ...
          void iniscl()
          {
             ...
             if(!pModule) pModule=new CSIS3820(0x38000000);
             pModule->setOperatingMode(CSIS3820::LatchingScaler);
             pModule->setInputMode(CSIS3820::InputLatchInhibitAll);
             pModule->DisableClearOnLatch();
              ...
          }

Enabling the module to count.

The the SIS3820 has a two phase enable. Once the module is set up it can be armed. Once armed it can be enabled. When enabled, pulses on the module inputs are counted in the outer couter layer. When latched, these counters are copied to the inner `shadow' registers.

The code below shows the use of the CSIS3820::Arm and CSIS3820::Enable functions to enable the module.

          CSIS3820* pModule(0);
           ...
          void iniscl()
          {
             ...
             if(!pModule) pModule=new CSIS3820(0x38000000);
             pModule->setOperatingMode(CSIS3820::LatchingScaler);
             pModule->setInputMode(CSIS3820::InputLatchInhibitAll);
             pModule->DisableClearOnLatch();     // RT Clock mode e.g.
             pModule->Arm();
             pModule->Enable();
              ...
          }

Once enabled, the module can be disabled via CSIS3820::Disable. A disabled module does not count. There is no way to disarm a module other than by resetting it (CSIS3820::Reset).


Generated on Wed Sep 17 08:38:10 2008 for NSCL Device support. by  doxygen 1.5.1