MCA Record

Mark Rivers and Tim Mooney

Contents

Overview

The MCA record controls and acquires data from a multichannel analyzer (MCA). The MCA record is unlike most other EPICS records in that its processing is neither "synchronous" nor "asynchronous" (as these terms are used in the EPICS Record Reference Manual). Currently, PACT is always FALSE after record processing has completed, even though a read operation may be pending a callback from device support.


Value Fields

Name Access Prompt Data type Description
VAL R/W* "Current value" DBF_xxx (array) The data array of the MCA. The data type of the array is set by the FTVL field. The maximum size of this array is determined by the NMAX field at IOC initialization. The actual array length used is determined by the NUSE field. Note: Current device support only permits reading of this field, but future enhancements may permit writing to this field.
BG R/W* "Background" DBF_xxx (array) Array into which the record writes background data that it calculates from the data array and from regions of interest defined by the fields RnLO and RnHI (see, e.g., R0LO, R0HI below).

The record also uses this array to show the user where ROIs are: The first and last channels of an ROI are set to the largest value in the data array. The intervening channels are set to the background values calculated for those channels. This behavior is intended to help users set ROIs using a generic channel-access client.
HOPR R/W "High Operating Range" DBF_FLOAT Range reported to MEDM and other channel-access clients.
LOPR R/W "Low Operating Range" DBF_FLOAT Range reported to MEDM and other channel-access clients.
NMAX R "Max number of channels" DBF_LONG Number of channels (array elements) allocated at iocInit. Some device support modules override this value if their memory allocation is done before iocInit.
NORD R "Number of channels read" DBF_LONG Number of channels read, as reported by device-support routine.
PREC R/W "Display Precision" DBF_SHORT Numeric precision reported to MEDM and other channel-access clients. The number of digits used to display values in this record.
FTVL R "Field Type of Value" DBF_MENU Type of variable used to store data array. Possible types are defined in the EPICS header file 'dbFldTypes.h', as follows:
FTVL  data type      comment
-------------------------------
0   string        (not supported)
1   char          (not supported)
2   unsigned char (not supported)
3   short           (2 bytes)
4   unsigned short  (2 bytes)
5   long (default)  (4 bytes)
6   unsigned long   (4 bytes)
7   float           (4 bytes)
8   double          (8 bytes)
Note that the asyn device support only supports long data, as does the SIS driver and device support.

Control Fields

Note: Not all device support modules support all of these fields. See the relevant device support documentation for details.

Name Access Prompt Data type Description
STRT R/W* "Start Acquire" DBF_MENU Writing a nonzero value to this field causes the MCA to begin data acquisition. The record immediately resets this field to zero.
ERST R/W* "Erase and Start Acquire" DBF_MENU Writing a nonzero value to this field causes the MCA to erase and to begin data acquisition. The record immediately resets this field to zero.
STOP R/W* "Stop Acquire" DBF_MENU Writing a nonzero value to this field causes the MCA to stop data acquisition. The record immediately resets this field to zero.
ACQG R "Acquiring" DBF_MENU The current acquire status of the hardware. ACQG will be 1 ("Acquire") while data acquisition is underway, and 0 ("Done") otherwise. When this field goes from 1 to 0, meaning that data acquisition is finished, a read operation (see READ/RDNG below) is initiated.
PROC R/W* "Process Record" DBF_MENU Puts to the PROC field initiate record processing. When the MCA record processes it reads the status of the MCA hardware (acquire done/busy, elapsed time, etc.), but does not read the MCA data. When the user sets PROC to 1, a read status command will be sent to the hardware. If that command is correctly acknowledged, the RDNS field (below) will be set to 1 ("Read"). When record processing completes the RDNS field is set to 0 ("Done").
RDNS R Reading status DBF_MENU Puts to the PROC field [above] initiate reading of the MCA's status. When the user sets PROC to 1, a read status command will be sent to the hardware. If that command is correctly acknowledged, the RDNS field (below) will be set to 1 ("Read"). When record processing completes the RDNS field is set to 0 ("Done"). This field is intended for use with MCAs that require asynchronous device support.
READ R/W* "Read array" DBF_MENU Put's to the READ field initiate of the MCA's data. When the user sets READ to 1 ("Read"), a read command will be sent to the hardware. If that command is correctly acknowledged, the RDNG field (below) will be set to 1 ("Read"). When device support sets READ to 0 ("Done") and triggers record processing, the read operation is finished, and the RDNG field is set to 0 ("Done").
RDNG R Reading array DBF_MENU Put's to the READ field [above] initiate reading of the MCA's data. When the user sets READ to 1 ("Read"), a read command will be sent to the hardware. If that command is correctly acknowledged, the RDNG field will be set to 1 ("Read"). When device support sets READ to 0 ("Done") and triggers record processing, the read operation is finished, and the RDNG field is set to 0 ("Done"). This field is intended for use with MCAs that require asynchronous device support.
ERAS R/W* Erase array DBF_MENU Put's to this field cause the hardware to erase the data array. When the user sets ERAS to 1 ("Erase") an "erase" command will be sent to the hardware. The record immediately resets this field to 0 ("Done").
CHAS R/W* Channel-advance source DBF_MENU If the MCA is in "MCS" (multichannel scaler) mode (see MODE), put's to this field tell the hardware whether to advance the current channel according to its internal clock (CHAS = 0 or "Internal"), or in response to an external channel-advance signal (CHAS = 1 or "External). (See the DWEL field.)
NUSE R/W* "# of channels to use" DBF_LONG Put's to this field tell the hardware how many channels (array elements) to use for spectrum acquisition. NUSE cannot be greater than NMAX.
SEQ R/W* "Time sequence #" DBF_LONG Put's to this field tell the hardware which memory region to use for data acquisition, readout and erasing. The main use of this field is for time-resolved spectroscopy, since it permits rapidly changing the location of data acquisition, without having to read and erase the acquisition memory between successive spectra.
DWEL R/W* "Dwell time per channel" DBF_FLOAT Put's to the DWEL field tell the hardware how many seconds to spend in each channel, when the hardware is in "MCS" (multichannel scaler) mode (see MODE), and the channel-advance source is "Internal" (see CHAS).
PSCL R/W* "Channel advance pre-scale" DBF_LONG Pre-scale factor when the hardware is in "MCS" (multichannel scaler) mode (see MODE), and the channel-advance source is "External" (see CHAS). The hardware will advance to the next channel after receiving PSCL external pulses. Default=1.
PRTM R/W* "Preset real time" DBF_FLOAT Puts to this field tells the hardware for how many seconds to acquire data, according to a free running clock (real time). Setting this field to 0.0 instructs the hardware to ignore it.
PLTM R/W* "Preset live time" DBF_FLOAT Puts to this field tells the hardware for how many seconds to acquire data, according to a clock which counts only when the hardware is ready to accept data (live time). Setting this field to 0.0 instructs the hardware to ignore it.
PCT R/W* "Preset counts" DBF_LONG Puts to this field tells the hardware that data acquisition is to be halted when the sum of the numbers of counts acquired in channels PCTL though PCTH inclusive reaches PCT. Setting this field to 0.0 instructs the hardware to ignore it.
PCTL R/W* "Preset count low channel" DBF_LONG See PCT above.
PCTH R/W* "Preset count high channel" DBF_LONG See PCT above.
PSWP R/W* "Preset number of sweeps" DBF_LONG Puts to this field tell the hardware that data acquisition (in MCS "multichannel scaler" mode; see MODE) is to continue until PSWP sweeps have completed.
MODE R/W* "Mode PHA/MCS/LIST" DBF_MENU Puts to this field tell the hardware in what mode to acquire data--what to do when an "event" occurs. (An event is a hardware trigger that may also clock a digital word into the MCA.)
MODE=0 ("PHA") is "pulse-height analysis" mode: each number presented to the hardware is interpreted as the number of the channel whose contents are to be incremented by one.
MODE=1 ("MCS") is "multichannel scaler" mode: the MCA maintains a "current channel" number, which increases either with time or in response to a channel-advance signal (see the CHAS and DWEL fields), and increments the current channel's contents by one (or by the number presented to the MCA input, depending on the hardware) on each event.
MODE=2 ("List") is "list" mode: the MCA simply records each event in the data array.

Calibration Fields

Note: These fields are not currently used by the record processing or device support software. They are provided as a convenient place for client software to store these values.

Name Access Prompt Data type Description
EGU R/W "Calibration Units Name" DBF_STRING Typically used to hold the calibration units of the record, e.g. "keV", "milliseconds", etc. Note that this use of the EGU field is simply a common convention, and the field could also be used to describe the units of the Y axis of the data array, e.g. "Counts" or "Volts".
CALO R/W "Calibration offset" DBF_FLOAT The calibration offset, defined as the calibrated value of the first channel in the spectrum. The relationship between calibrated units (cal) and channel number (chan) is defined as cal=CALO + chan*CALS + chan^2*CALQ. The first channel in the spectrum is defined as chan=0.
CALS R/W "Calibration slope" DBF_FLOAT The calibration slope. See CALO above.
CALQ R/W "Calibration quadratic" DBF_FLOAT The calibration quadratic term. See CALO above.
TTH R/W "Two-theta" DBF_FLOAT The two-theta angle of the detector. This field is useful in energy-dispersive diffraction experiments.

Status Fields

Name Access Prompt Data type Description
ERTM R "Elapsed real time" DBF_FLOAT After a read status operation, this field contains the elapsed real time, as reported by the hardware.
ELTM R "Elapsed live time" DBF_FLOAT After a read status operation, this field contains the elapsed live time, as reported by the hardware.
ACT R "Actual counts in pregion" DBF_FLOAT After a read status operation, this field contains the number of counts in the "preset region". (See the PCT field.)
DTIM R "Average dead time" DBF_FLOAT After a read status operation, this field contains the average dead time of the detector. The average dead time is the percent of time the detector was not able to collect data during the current elapsed time.
IDTIM R "Instantaneous dead time" DBF_FLOAT After a read status operation, this field contains the instantaneous dead time of the detector. The instantaneous dead time is the percent of time the detector was not able to collect data since the previous read status operation.
STIM R "Acquisition stop time" NOTE: Prior to release 7-1 of the mca module this field contained the acquisition start time, not the stop time. This was changed because in multi-element detector systems like the DXP xMAP or the SIS38XX MCS the MCA records only process when acquisition completes, not when it starts. This meant that the record time stamp and the STIM field were never being updated. The MCA record always processes when acquisition completes, so this field is now correctly updated. DBF_STRING This field contains the time that acquisition was stopped. It is an absolute time as reported and formatted by the IOC.
NACK R "Message not acknowledged" DBF_LONG This field is initialized to 0 each time the record is processed, and set to 1 if any command sent to the hardware is not acknowledged correctly.

Alarm Fields

Note: These fields are used to control the alarm status and severity, based on the dead time. See the DTIM field above.

Name Access Prompt Data type Description
HIGH R/W "High deviation limit" DBF_FLOAT The dead time value above which the record will go into alarm, with severity controlled by the HSV field.
HSV R/W "High severity" DBF_MENU The alarm severity when the dead time exceeds that in the HIGH field.
HIHI R/W "High-high deviation limit" DBF_FLOAT The dead time value above which the record will go into alarm, with severity controlled by the HHSV field.
HHSV R/W "High severity" DBF_MENU The alarm severity when the dead time exceeds that in the HIGH field.
LOW R/W "Low deviation limit" DBF_FLOAT The dead time value below which the record will go into alarm, with severity controlled by the LSV field.
LSV R/W "Low severity" DBF_MENU The alarm severity when the dead time is less than that in the LOW field.
HIHI R/W "High-high deviation limit" DBF_FLOAT The dead time value above which the record will go into alarm, with severity controlled by the HHSV field.
HHSV R/W "High severity" DBF_MENU The alarm severity when the dead time exceeds that in the HIGH field.
HYST R/W "Alarm deadband" DBF_FLOAT The alarm deadband, which is used to prevent the alarm status from changing rapidly when the deadtime is close to an alarm limit.

Name Access Prompt Data type Description
INP R "Input Specification" DBF_INLINK This field contains the address information needed by device support to identify and communicate with the MCA this record instance controls. If the hardware can handle more than one detector or signal channel, INP identifies the signal channel as well.

Simulation Fields

Note: these fields have been retained without modification from the waveform record. See the chapter on simulation mode in the Record Reference Manual for details.

Name Access Prompt Data type Description
SIOL R "Sim Input Specifctn" DBF_INLINK See waveform record.
SIML R "Sim Mode Location" DBF_INLINK See waveform record.
SIMM R/W "Simulation Mode" DBF_MENU See waveform record.
SIMS R/W "Sim mode Alarm Svrty" DBF_MENU See waveform record.

Region-Of-Interest (ROI) Fields

The MCA record has fields for 32 ROIs. In the following field names, replace 'n' with a digit '0' through '31'.

Name Access Prompt Data type Description
RnLO R/W* "Region n low channel" DBF_LONG The RnLO and RnHi fields define a region of interest in the data array. If (RnLO >= 0) and (RnHI >= RnLO), then the record will calculate a linear background under the channel range [RnLO..RnHI] (including channels RnLO and RnHI), sum over this range of channels, post the sum in the field Rn, and post the sum less background in the field RnN. The background at channel RnLO is calculated as the average over 2m+1 channels centered on RnLO, where 'm' is the value of the field RnBG. The background at RnHI is calculated similarly, and the background in the region between RnLO and RnHI is a linear interpolation.
RnHI R/W* "Region n high channel" DBF_LONG See RnLO above.
RnBG R/W* "Region n bkgrnd chans" DBF_SHORT The number of data channels on either side of RnLO, RnHI to use in calculating an average background for those channels. If the value of this field is negative, no background calculation will be performed.
RnIP R/W* "Region n is preset" DBF_MENU If this field is nonzero, the record will halt data acquisition when the net counts in the n'th ROI is greater than or equal to the value of the preset field, RnP.
Rn R "Region n counts" DBF_DOUBLE The total number of counts in the n'th ROI.
RnN R "Region n net counts" DBF_DOUBLE The net number of counts in the n'th ROI, i.e. the total counts less the total background in that ROI.
RnP R/W "Region n preset count" DBF_DOUBLE The value of RnN at which data acquisition will halt, if RnIP is nonzero.
RnNM R/W "Region n name" DBF_STRING A descriptive string for region n.

Miscellaneous Fields

Name Access Prompt Data type Description
VERS R "Code Version" DBF_FLOAT The version number of the record software.


Private Fields

Name Access Prompt Data type Description
BPTR R "Buffer Pointer" DBF_NOACCESS The pointer to the buffer for the VAL field.
PBG R "Background buffer" DBF_NOACCESS The pointer to the buffer for the BG field.
MMAP R "Monitor map" DBF_ULONG A field containing flags indicating which record fields require posting of channel access monitors.
RMAP R "ROI monitor map" DBF_ULONG A field containing flags indicating which ROI fields require posting of channel access monitors.
NEWV R "New value map" DBF_ULONG A field containing flags indicating which fields have been changed by channel access puts.
NEWR R "New ROI value map" DBF_ULONG A field containing flags indicating which ROI fields have been changed by channel access puts.
LALM R "Last value alarmed" DBF_FLOAT The last deadtime alarm value.
ACQP R "Previous acquire status" DBF_MENU The previous state of the ACQG field.
DWLP R "Previous dwell time" DBF_FLOAT The previous value of the DWEL field.
ERTP R "Previous real time" DBF_FLOAT The previous value of the ERTM field.
ELTP R "Previous live time" DBF_FLOAT The previous value of the ELTM field.
ACTP R "Previous actual counts" DBF_LONG The previous value of the ACT field.
Note: In the Access column above:
R Read only
R/W Read and write are allowed
R/W* Read and write are allowed; write triggers record processing if the record's SCAN field is set to "Passive".
N No access allowed

Intended Use

This record should normally have its SCAN field set to "Passive", since Put's to the STRT and READ fields are intended to cause data acquisition and data reading to begin immediately, and since Put's to these "process-passive" fields can trigger record processing only if the record is passive.

To read data periodically while acquisition is underway, arrange for a '1' to be poked into the READ field periodically. The following recipe arranges for the READ field to be poked periodically while the MCA is acquiring data.

  1. attach the output link of a "binary-out" (BO) record to the MCA record's READ field,
  2. set the BO record's value permanently to 1 (using its DOL field),
  3. attach the BO record's scan-disable link (DISL) to the MCA record's ACQG field,
  4. set the BO record's scan-disable value (DISV) to 0.
  5. set the BO record's SCAN field to the desired update rate.

Similarly, to read status periodically while acquisition is underway, arrange for a '1' to be poked into the PROC field periodically. The following recipe arranges for the PROC field to be poked periodically while the MCA is acquiring data.

  1. attach the output link of a "binary-out" (BO) record to the MCA record's PROC field,
  2. set the BO record's value permanently to 1 (using its DOL field),
  3. attach the BO record's scan-disable link (DISL) to the MCA record's ACQG field,
  4. set the BO record's scan-disable value (DISV) to 0.
  5. set the BO record's SCAN field to the desired update rate.

The file mca.db contains records to implement the above logic. It also contains records for Start and EraseStart that optionally set a Busy record flag to wait for a channel access client, such as IDL, to save the data before continuing. That database also contains a set of records to indicate why acquisition was stopped (preset time reached, user stopped it manually, etc.)


Suggestions and comments to: Mark Rivers : (rivers@cars.uchicago.edu)