Reading the module

Once the module has been setup, it should be read at each event. When reading the module, there are two possibilities:

Read a Single Word.

This mode is appropriate in most NSCL applications, where the module is a simple bit patter register or a coincidence register. To Read a single word from the FIFO you must:
  1. Ensure that data is available in the FIFO by invoking CSIS3600::DataReady
  2. Read the module using CSIS3600::Read() in its single event form.

The code below shows how to do this using the pModule object that has been used in the setup examples (e.g. Introduction).

        unsigned long latchvalue = 0;      // If no data return 0.
        if(pModule->DataReady()) {
           latchvalue = pModule->Read();
        }
        putlong(latchvalue);               // Readout classic.

Read Multiple Words.

This mode is appropriate if the module is being used to readout an external source of data which then must then be read by CPU in response to an event trigger. To use the module in this mode you must:
  1. Ensure that data is available in the module (CSIS3600::DataReady()).
  2. Read the data using CSIS3600::Read (multievent format).

Using the pModule created in the example from e.g. Introduction

        unsigned long latchedvalues[NVALUES];
        unsigned int  nRead;
        if(pModule->DataReady()) {
            do {
              nRead = pModule->Read(latchedvalues, NVALUES);
              if(nRead) {
                bufpt = LongArrayToBuffer(bufpt, latchedvalues, nRead);
              }
            } while(nRead == NVALUES);
        }       

This example assumes that:

note that the return value from CSIS3600::Read is the number of longwords actually read. If there are no more longs in the FIFO, the function will return a zero.


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