ADC 400F Manuál Strana 28

  • Stažení
  • Přidat do mých příruček
  • Tisk
  • Strana
    / 74
  • Tabulka s obsahem
  • KNIHY
  • Hodnocené. / 5. Na základě hodnocení zákazníků
Zobrazit stránku 27
Chapter 2. Setting up the software
Ì The CAnalyzer reference that will be passed in to the operator() member function is really a
reference to a CTclAnalyzer. Since we will be calling member functions of CTclAnalyzer
directly, we must include the header of that class as well
Í This section of code defines sevaral constants that help us unpack data longwords from the CAEN
V785 ADC. See the hardware manual for that module for a detailed description of the format of the
buffer produced by this module. Whenever possible avoid magic numbers in code in favor of
symbolic constants as shown in the listing. Symbolic constants make the code easier to understand
for the next person and for you if you have to look at it a long time later. The constants are:
CAEN_DATUM_TYPE
This is a mask of of the bits that make up the field in the V785 data that describes what each
longword is.
CAEN_HEADER
If the bits selected by the CAEN_DATUM_TYPE are equal to CAEN_HEADER the longword is an
ADC header word. Thus you can check for header-ness with code like:
if ((data & CAEN_DATUM_TYPE) == CAEN_HEADER) { ...
CAEN_DATA
CAEN_DATA selects ADC data longwords in a mannger analagous to the way that
CAEN_HEADER selects header words. If the bits of a longwords of V785 data are anded with
CAEN_DATUM_TYPE, and the result is CAEN_DATA the longword contains conversion data.
CAEN_TRAILER
If a longword of CAEN V785 data, anded with the CAEN_DATUM_TYPE mask is
CAEN_TRAILER, the longword is an ADC trailer and indicates the end of an event from the
module.
CAEN_GEOMASK and CAEN_GEOSHIFT
These two values can be used to extract the Geographical Address field from data returned by
the CAEN V785 ADC. The Geographical Address is what we have been loosely calling the slot
of the ADC. The following code snippet is a recipe for getting the geographical address from
any of the longwords that the module returns:
unsigned long slotNumber = (data & CAEN_GEOMASK) >> CAEN_GEOSHIFT;
CAEN_COUNTMASK and CAEN_COUNTSHIFT
These two values can be used to return the number of channels present in an event from the
CAEN V785 adc. The number of channels present in the event is available in the header word
for the ADC data. Given a header word, this information can be extracted as follows:
unsigned long channelCount = (header & CAEN_COUNTMASK) >> CAEN_COUNTSHIFT;
23
Zobrazit stránku 27
1 2 ... 23 24 25 26 27 28 29 30 31 32 33 ... 73 74

Komentáře k této Příručce

Žádné komentáře