DppApi Developers Reference

The DppApi Developers Reference provides detailed information for rapid application development with the DppApi.

The DP4/PX4/DP5 Digital Pulse Processor API is an Application Programming Interface Library for Amptek DP4, PX4, and DP5 Digital Pulse Processors.

The DP4, PX4, and DP5 will be referred to collectively as DPP (Digital Pulse Processor).

The DPPAPI communicates to the DPP via USB.

  • DppApi Developers Reference

  • DppApi Function Reference

  • DppApi Function ProtoTypes Cut/Paste Source

  • Configuration File Details

  • Configuration Control Value Cut/Paste Text

  • Data Types and Byte Alignment

  • DP5 Update Details for Developers Using the DppApi

  • Source Updates for C++

  • Source Updates for VB


DP4/PX4 Digital Pulse Processor API Reference

DP4/PX4/DP5 Digital Pulse Processor API Reference

Amptek, Inc.

14 De Angelo Dr.

Bedford MA 01730

781-275-2242 www.amptek.com

1 DP4/PX4/DP5 Digital Pulse Processor API (DPPAPI) Basics. 5

1.1 Programming Guidelines. 5

1.1.1 Accessing the API 5

1.1.2 Establishing Communications. 5

1.1.3 Selecting a DPP from Multiple Devices. 5

1.1.4 The DPPAPI Device Index. 6

1.1.5 DPP Status. 6

1.1.6 DPP Configuration. 6

1.1.7 DP5 Configuration Notes. 6

1.1.8 DP5 Boot Options. 6

1.1.9 Acquiring Data. 7

1.1.10 DPPAPI Programming Summary. 7

1.2 C++ Data Acquisition Example. 8

1.3 VB Data Acquisition Example. 8

2 DPPAPI Programming Topics. 9

2.1 Rapid Prototyping Solutions. 9

2.2 USB. 9

3 Configurations. 10

3.1 Reading and Writing DPP Device Configurations. 10

3.1.1 The DP4 Configuration Cycle. 10

3.1.2 The PX4 Configuration Cycle. 10

3.1.3 The DP5 Configuration Cycle. 11

3.1.4 DP5 Configuration Notes. 11

3.1.5 DPPAPI Configuration Details. 11

3.1.6 DPPAPI Active and Temporary Configurations. 11

3.1.7 Editing Configurations and the CurrentUpdate Parameter 12

3.2 Configuration Transfer Functions Diagram.. 12

4 DPP Status Operation. 13

4.1 DPP Status Function Guide. 13

4.1.1 Getting Complete Status with One Function Call 13

4.1.2 Returning Display Status with One Function Call 13

4.1.3 Advanced Status Functions. 13

4.1.4 Creating Status Information for Amptek Spectrum Files. 13

4.2 DPP Status Information Types. 14

4.2.1 Device Identification. 14

4.2.2 Spectrum Accumulation Status. 14

4.2.3 Monitors. 14

4.2.4 Boot Status. 15

4.2.5 Tuning Status. 15

5 Acquisition Modes. 15

5.1.1 Multichannel Analyzer (MCA) 15

5.1.2 Acquiring MCA Data. 15

5.1.3 Multichannel Scaling (MCS) 16

5.1.4 MCS Acquisition Setup. 16

5.1.5 Acquiring MCS Data. 16

5.2 Presets. 17

5.2.1 Preset Modes. 17

5.2.2 None (No Presets) 17

5.2.3 Preset Time. 17

5.2.4 Preset Counts. 17

5.2.5 Preset Time and Preset Counts. 17

5.3 Setting the Slow and Fast Thresholds. 18

6 Automating the DPP Tuning Process. 19

6.1 Fast Threshold. 19

6.2 The Tune Fast Threshold Procedure. 19

6.3 Input Offset 19

6.4 Slow Threshold. 19

7 Configuration Settings. 20

7.1 MCA Properties. 20

7.1.1 Acquisition Mode. 20

7.1.2 MCS Timebase. 20

7.1.3 MCA Channels. 21

7.1.4 Buffer Select (DP4/PX4) 21

7.1.5 TTL Gate. 21

7.1.6 Slow Threshold. 21

7.1.7 Preset Time. 22

7.1.8 Preset Count 22

7.1.9 Single Channel Analyzers. 22

7.2 Shaping Properties. 23

7.2.1 Time to Peak. 23

7.2.2 Decimation. 24

7.2.3 Flat Top. 24

7.2.4 PUR Enable. 24

7.2.5 Fast Threshold. 24

7.2.6 RTD Slow (DP4/PX4) / RTD Ratio (DP5) 24

7.2.7 RTD On. 25

7.2.8 RTD Fast (DP4/PX4) / RTD Slow Threshold (DP5) 25

7.2.9 Baseline Restoration (BLR) 25

7.2.10 Baseline On (Obsolete, do not use , kept for backward compatibility) 27

7.3 Gain PZ Properties. 27

7.3.1 Coarse Gain. 27

7.3.2 Fine Gain. 28

7.3.3 Pole Zero (PX4/DP5 only) 28

7.3.4 Input Offset (PX4/DP5 only) 28

7.3.5 Input Polarity (PX4/DP5 only) 29

7.3.6 Detector Reset Lockout Period. 29

7.4 Power Properties. 29

7.4.1 Thermoelectric Cooler (PX4/DP5 only) 29

7.4.2 High Voltage Enabled (PX4/DP5 only) 30

7.4.3 High Voltage (PX4/DP5 only) 30

7.4.4 Preamp Voltage (PX4 only) 30

7.5 Miscellaneous Properties. 30

7.5.1 Analog Out 30

7.5.2 Output Offset 31

7.5.3 Auxiliary Output (PX4/DP5 only) 31

7.5.4 Audible Counter (PX4 only) 31

8 DPPAPI Data Types. 32

8.1 DPP_CONFIG_SETTINGS Data Type (C++) 32

8.2 DPP_CONFIG_SETTINGS Data Type (Visual Basic) 33

8.3 DPP_STATUS Data Type (C++) 34

8.4 DPP_STATUS Data Type (Visual Basic) 34

9 Amptek DPP Configuration File Reference. 35

1 DP4/PX4/DP5 Digital Pulse Processor API (DPPAPI) Basics

The DP4/PX4/DP5 Digital Pulse Processor API is an Application Programming Interface Library for Amptek DP4, PX4, and DP5 Digital Pulse Processors. The DP4, PX4, and DP5 will be referred to collectively as DPP (Digital Pulse Processor). The DPPAPI communicates to the DPP via USB. The DPPAPI can select a DPP from a number of DPP devices attached to a system. The DPPAPI runs on personal computers with Intel® Pentium® or higher equivalent processor , Microsoft Windows® 98 (SE), Me, 2000, or XP and 64 MB RAM (128 MB recommended).

Application programs invoke DPPAPI functions to establish DPP communications, control DPP operations, and retrieve spectrum data. The DPPAPI is distributed with an import library (.LIB), and a dynamic link library (.DLL) and a type library (.TLB). Applications can be developed with the DPPAPI in C++, Visual Basic and many other programming languages.

The C language representation of DPPAPI functions are defined in the DppApi.h header file. These files are provided with the DPPAPI libraries. The USB drivers provided with your Amptek DPP must be installed and the usbdrvd.dll must be accessible to the DPPAPI in order to function properly.

1.1 Programming Guidelines

1.1.1 Accessing the API

Before any interaction with the DPP can take place, the application program must open an instance of the DPPAPI by calling the OpenDppApi function. The OpenDppApi function call creates a handle to the DPPAPI which is then passed to all DPPAPI functions.

After all DPP operations have completed and before the application is terminated the DPPAPI must be closed by calling the CloseDppApi function. The application should always call CloseDppApi before exiting the program.

1.1.2 Establishing Communications

The DPPAPI supports USB communications for one DPP device (called a "connection") from a pool of one or more devices. Before configuring or acquiring data, USB communications must be established. This is done by calling OpenUSBDevice. OpenUSBDevice returns the number of the devices detected. If the number of devices is zero, the DPP cannot be detected. Check if the DPP is ON and the USB cable is plug into the computer. Once a connection is opened, MonitorUSBDppDevices can be used to check the USB connection. When communications are done call CloseUSBDevice to close the USB connection. CloseUSBDevice must be called before CloseDppApi is called.

1.1.3 Selecting a DPP from Multiple Devices

To select a DPP from a pool of DPP devices, the devices first must be enumerated. The enumeration process begins with a call to OpenUSBDevice to count the number of DPP devices attached. The number of devices is saved and the connection is closed (CloseUSBDevice).

Each DPP must then be identified. The device index ranges from 1 to the number of DPP devices. Each device index is matched to the device type and serial number. OpenUSBDeviceEx opens a device connection for a specific index. GetUSBDppDeviceInfo returns the DPP device type and DPP serial number for the opened device. CloseUSBDevice must be called before another device is opened and before CloseDppApi is called.

1.1.4 The DPPAPI Device Index

The DPPAPI stores a copy of the DPP device index to determine which USB device to communicate to. Only two functions can change this value, OpenDppApi and OpenUSBDeviceEx. The DPPAPI device index defaults to one when the DPPAPI is first opened (OpenDppApi). Calls to OpenUSBDeviceEx changes the DPPAPI device index to the selected device.

OpenUSBDevice always opens the first device if only one device is used and opens the last index called by OpenUSBDeviceEx otherwise. The DPPAPI device index can be reset by reopening the DPPAPI or calling OpenUSBDeviceEx with an index of one.

1.1.5 DPP Status

The status can be read in a number of formats. Status formats include display string, byte block, and status structure. DPP status includes identification, configuration, monitor, and acquisition information. GetStatusStruct returns the status in a structure. Status returned in a status structure can tested and displayed. Example functions are provided demonstrating how to check the DPP status.

1.1.6 DPP Configuration

The DPP and the DPPAPI must each have a working configuration to perform data acquisition. The DPP and the DPPAPI can get their configurations from different sources. The simplest example is a PX4 that has been configured at power-up by holding the power button down until the device beeps twice. The PX4 configuration has been loaded at power-up, so the only remaining configuration task is to get the configuration being used from the PX4 by calling GetConfigFromDpp. This copies the configuration stored in the PX4 hardware and loads the configuration into the DPPAPI program. Even though the PX4 is configured, the DPPAPI must have the configuration to properly acquire data and perform configuration management.

1.1.7 DP5 Configuration Notes

The DP5 has additional features that add more functionality. The FPGA Clock (DP5 ONLY) allows for more control over peaking time. The DP5 FPGA 80MHz Clock Mode indicator must be set to correctly interpret DP5 configuration file settings. The FPGA 80MHz Clock indicator is set when a DPP status command is issued and a DPP device is attached or when SetFPGAClockDefault sets this value. SetFPGAClockDefault is needed when editing DP5 configuration files without a DP5 device. Get80MHzMode reads the DP5 FPGA 80MHz Clock Mode indicator. The DP5 FPGA Clock setting has 2 speeds, 20MHz (normal speed = 1) and 80MHz (high speed = 1). Always read the status before configuring a DP5. Run GetStatusStruct or GetStatusString before running Get80MHzMode.

1.1.8 DP5 Boot Options

DP5 Boot Options allow new configuration options not available with either the DP4 or the PX4. GetBootOptionsStruct reads the DP5 Boot Options. DP5 Boot Options can be changed calling SendDppVendorRequest with corresponding Vendor Request values.

1.1.9 Acquiring Data

Data can be acquired after the DPP and the DPPAPI have been configured. If the DPP is already acquiring data the only call necessary to acquire data is GetDppData. The data is stored in a buffer ready to be plotted. GetDppData returns the number of channels represented in the spectrum data. Data acquisition can be enabled and paused by calling the PauseDppData function. The data channels are cleared by calling ClearDppData. The data returned by GetDppData function is a summary of the DPP histogram memory: The histogram memory operates as in a traditional MCA. When a pulse occurs with a particular peak value, a counter in a corresponding memory location is incremented. The result is a histogram, an array containing, in each cell, the number of events with the corresponding peak value. This is the energy spectrum and is the primary output of the DPP. The DPP uses 3 bytes per channel, which allows up to 16.7M counts per channel. The 3 bytes per channel are combined producing the final the energy spectrum ready to plot.

1.1.10 DPPAPI Programming Summary

The typical tasks required to setup and acquire data can be summarized as follows:

o        open the DPPAPI

o        open USB communications

o        get the device status

o        configure the software

o        configure the hardware

o        pause the DPP data acquisition

o        clear the data buffer

o        start the data acquisition

o        repeat the next 2 steps until data acquisition finished

a. get the acquired data buffer

b. plot data

o        close usb

o        close DPPAPI

Each DPPAPI task can be completed by a function call. A timer is needed for the data acquisition. A method to plot the data must also be added.

1.2 C++ Data Acquisition Example

void CvcMinExDlg::OnBnClickedGetdatabutton() {

    GetDlgItem(IDC_GETDATABUTTON)->EnableWindow(false); // disable this button until done

    int numdev;                                         // number of usb devices

    void * objDppApi;                                   // pointer to DPPAPI

    char szStatus[2000];                                // status text

    long DataBuffer[8192];                              // spectrum data

    CString cstrStatus;                                 // status display string

    int NumChan;                                        // number of acquired channels

    DPP_STATUS StatusLst;                               // status structure

    objDppApi = OpenDppApi();                           // Create/Open DPPAPI

    numdev = OpenUSBDevice(objDppApi);                  // Open USB communications

    if (numdev > 0) {

        GetStatusStruct(objDppApi, true, &StatusLst);   // get device status structure

        if (StatusLst.SerialNumber < 1) {

            GetDlgItem(IDC_STATUS)->SetWindowText("Device status error.");

        } else if (! StatusLst.SwConfigRcvd) {

            GetDlgItem(IDC_STATUS)->SetWindowText("Please configure device before taking data.");

        } else {

            if (! StatusLst.StatMcaEnabled) {

                PauseDppData(objDppApi, false);             // enable data acquisition

            }

            GetStatusString(objDppApi, 1, szStatus, 2000);  // get device status display string

            cstrStatus = szStatus;

            GetDlgItem(IDC_STATUS)->SetWindowText(cstrStatus);  // display status

            GetConfigFromDpp(objDppApi);                    // configure from stored configuration

            NumChan = GetDppData(objDppApi, DataBuffer);    // aquire data

            PlotData(DataBuffer, NumChan);                  // plot data

        }

    }

    CloseUSBDevice (objDppApi);                             // close usb

    CloseDppApi (objDppApi);                                // close DPPAPI

    GetDlgItem(IDC_GETDATABUTTON)->EnableWindow(true);

}

1.3 VB Data Acquisition Example

Private Sub cmdGetData_Click()

    cmdGetData.Enabled = False                             ' disable button until done

    Dim numdev As Integer                                  ' number of usb devices

    Dim objDppApi As Long                                  ' pointer to dpp api

    Dim szStatus As String * 2000                          ' status text

    Dim DataBuffer(8192) As Long                           ' spectrum data

    Dim NumChan As Integer                                 ' number of acquired channels

    objDppApi = OpenDppApi()                               ' create/open DPPAPI

    numdev = OpenUSBDevice(objDppApi)                      ' open USB communications

    If (numdev > 0) Then

        GetStatusString objDppApi, 1, szStatus, 2000       ' get device status

        txtStatus = szStatus

        GetConfigFromDpp objDppApi                         ' configure from hardware

        NumChan = GetDppData(objDppApi, VarPtr(DataBuffer(0)))  ' acquire data

        PlotData DataBuffer, NumChan                       ' plot data

    End If

    CloseUSBDevice (objDppApi)                             ' close usb

    CloseDppApi (objDppApi)                                ' close DPPAPI

    cmdGetData.Enabled = True

End Sub

2 DPPAPI Programming Topics

2.1 Rapid Prototyping Solutions

The DPPAPI was designed for fast and simple development. The source code examples included with the DPPAPI demonstrate most of the functionality. Example code can be cut and pasted into applications to save time and development effort.

o        Start with the closest model to the required application.

o        Borrow from the other examples.

o        Complete and test the basic DPP specific tasks.

o        Customize the application.

2.2 USB

The DPPAPI USB interface is a wrapper around the APAUSB interface. No special programming is required. The DPPAPI USB interface includes all the functionality to control and communicate with DP4, PX4 and DP5 type devices. Almost all necessary USB functions are completed automatically by the DPPAPI. The only functions required by the programmer are to open and close the USB device and to monitor if the device has been removed or disconnected. For details of the DPPAPI USB functions see the USB Manager Functions section.

NOTE: The usbdrvd.dll APAUSB driver library must be accessible to the DPPAPI.

3 Configurations

3.1 Reading and Writing DPP Device Configurations

3.1.1 The DP4 Configuration Cycle

The DP4 stores a copy of the current configuration that can be read back until the unit is powered down. Each time a DP4 is powered up, it must be sent a valid configuration. Each time a configuration parameter is changed, a copy of the current configuration must be sent to the DP4. It is also recommended that the new configuration be saved to a file for future reference. There are two methods to detect if a DP4 has been configured with a valid configuration. The Software Configuration Received boot status bit can be checked, or the configuration can be read back from the DP4 and compared to the configuration sent.

DP4 Start Up Configuration Sequence:

o        Load a configuration file (GetConfigFromFile)

o        Send a configuration to the DP4 (SendConfigToDPP)

DP4 Configuration Update Sequence:

o        Update the current configuration (GetTempConfigSettings, SetTempConfigSettings, etc.)

o        Send the new configuration to the DP4 (SendConfigToDPP)

o        Save the current configuration to file (SaveConfigToFile)

3.1.2 The PX4 Configuration Cycle

The PX4 stores a copy of the current configuration in EEPROM. It can be recalled at power up by pressing the power button for about three seconds (until two beeps are heard). If the PX4 has been configured by recalling the stored configuration at power up, the Power Button Configured boot status bit will be set. Each time a PX4 is powered up, either the current configuration must be recalled or a valid configuration must be sent. Each time a configuration parameter is changed, a copy of the current configuration must be sent to the PX4. It is also recommended that the new configuration be saved to a file for future reference. There are three methods to detect if a PX4 has been configured with a valid configuration. The Software Configuration Received and Power Button Configured boot status bits can be checked, or the configuration can be read back from the PX4 and compared to the configuration sent.

Px4 Start Up Configuration Sequence, Power Up Configured Method:

o        Power up configure PX4

o        Read the current configuration from the PX4 (GetConfigFromDPP)

o        (Optional but recommended) Send a configuration to the PX4 (SendConfigToDPP)

Px4 Start Up Configuration Sequence, Configure from File Method:

o        Same as the DP4 Start Up Configuration Sequence

Px4 Configuration Update Sequence:

o        DP4 Configuration Update Sequence

3.1.3 The DP5 Configuration Cycle

The DP5 stores a copy of the current configuration in EEPROM. It can be recalled at power up by setting the "Boot configuration state" boot flag to "Use nonvolatile configuration". If the DP5 has been configured by recalling the stored configuration at power up, the Power Button Configured boot status bit will be set. Each time a configuration parameter is changed, a copy of the current configuration must be sent to the DP5. It is also recommended that the new configuration be saved to a file for future reference. There are three methods to detect if a DP5 has been configured with a valid configuration. The Software Configuration Received and Power Button Configured boot status bits can be checked, or the configuration can be read back from the DP5 and compared to the configuration sent. The DP5 configuration sequence is the same as the PX4.

3.1.4 DP5 Configuration Notes

· The FPGA Clock indicator must be set with SetFPGAClockDefault if a configuration file being edited for a DP5 without a DP5 connected.

· Before configuring a DP5 always read the DP5 status. This sets the FPGA Clock indicator.

3.1.5 DPPAPI Configuration Details

The DPPAPI stores a working copy of the current DPP configuration (active configuration). After the DPPAPI is opened, a configuration is read from file or transferred from a DPP device. In the case of the DP4, the active configuration is always read from a file. In the case of the PX4, the initial configuration can be read from a file or from PX4 configuration storage memory. If the configuration is changed, it is recommended that a copy be saved to a file for future reference.

The DPPAPI also stores a spare copy of the current DPP configuration (temporary configuration). The temporary configuration can be used as a scratchpad for configuration updates. GetTempConfigSettings and SetTempConfigSettings read/write DPP configuration settings from the active configuration and temporary configuration to/from a DPP_CONFIG_SETTINGS structure. The DPP_CONFIG_SETTINGS structure values are designed to be used with dialog controls.

3.1.6 DPPAPI Active and Temporary Configurations

The DPPAPI stores an active and a temporary configuration. The active configuration is the main DPPAPI configuration. The DPPAPI uses the active configuration for configuration transfer operations. Configuration transfer operations include reading/writing configuration files and sending/receiving DPP device configurations. The temporary configuration is used for configuration editing. When ever a DPPAPI configuration is edited, a copy of the temporary is used.

The CurrentUpdate parameter in GetTempConfigSettings and SetTempConfigSettings set to "1 (TRUE)" causes the active configuration settings to be updated along with the temporary settings. This allows the active configuration to be read and directly updated.

The CurrentUpdate parameter in GetTempConfigSettings and SetTempConfigSettings set to "0 (FALSE)" causes the active configuration settings to be isolated from the temporary settings. This allows the temporary configuration to be read and updated independently from the active configuration.

3.1.7 Editing Configurations and the CurrentUpdate Parameter

Set the CurrentUpdate parameter in GetTempConfigSettings and SetTempConfigSettings to "1 (TRUE)" to read and directly update the active configuration.

3.2 Configuration Transfer Functions Diagram

4 DPP Status Operation

DPP Status provides device information for normal operations. Status information can be read as a block of data, a status structure or a display string. Status information includes device identification, spectrum accumulation status, monitors, and boot status. Also see the DPPAPI STATUS INDICATOR FUNCTIONS section.

4.1 DPP Status Function Guide

4.1.1 Getting Complete Status with One Function Call

Only one function call is required to get a full snapshot of the current status. Status can be read as a structure with GetStatusStruct. In a structure (see DPP_STATUS ) the status values are represented in numeric form. This format allows for the values to be easily tested. GetStatusStruct is the preferred method of reading the status. Values in the DPP_STATUS structure can also easily be converted into strings for display.

4.1.2 Returning Display Status with One Function Call

GetStatusString returns a subset of the status for display purposes.

GetStatusString Display

Device Type = PX4

Fast Count = 660

Slow Count = 495

FPGA = 4.00

Firmware = 4.00

Serial Number = 1070

Accumulation Time = 72

StatMcaEnabled = True

4.1.3 Advanced Status Functions

GetStatusBuffer only returns the status as a block of bytes (raw data). Bytes within the data block must be decoded. The data can be manually decoded (see the PX4 Programmer’s Guide) or ProcessStatusBuffer to decode the status values. If ProcessStatusBuffer is called, the decoded status information is stored in the DPPAPI. A call to DisplayStatusBuffer converts the status information into a text display string which is the same format as the GetStatusString Display string.

4.1.4 Creating Status Information for Amptek Spectrum Files

CreateMCAFileDPPSettings reads the current status and the current configuration stored in the DPPAPI. The status and configuration is stored in string format. This function is used to create Amptek DPP MCA Spectrum file configuration and status information. (See ADMCA Help - Amptek Spectrum File Format, vbDppApi example application.

The current status and configuration are updated during normal operations. It is important to understand how the current information is updated.

The current configuration is updated when a file is read into the DPPAPI or when the current device settings are read into the DPPAPI.

The current status is updated when one of the following events occurs:

  • GetStatusStruct is called
  • GetStatusString is called.
  • GetStatusBuffer together with ProcessStatusBuffer is called.

4.2 DPP Status Information Types

4.2.1 Device Identification

4.2.1.1 Serial Number

The serial number identifies the individual unit. The DPPAPI also uses the serial number to determine if communications are present between the DPP and the DPPAPI.

4.2.1.2 FPGA Version

The Field Programmable Gate Array (FPGA) version identifies the current hardware capabilities. The FPGA is an array of logic gates that is hardware-programmed to fulfill DPP-specified tasks.

4.2.1.3 Firmware Version

The firmware version identifies the low level software that controls the system hardware. The firmware is a set of instructions and data programmed into the EEPROM responsible for controlling the operation of the DPP device. The DPP firmware version value is composed of two parts, a major version and a version. A major version of 4 indicates a DP4 or PX4. A major version of 5 indicates a DP5.

4.2.2 Spectrum Accumulation Status

4.2.2.1 Accumulation Time

Accumulation Time is the duration (real time) of the present data acquisition interval.

4.2.2.2 Fast Count

Fast Count is the number of counts that have accumulated in the fast channel in the present data acquisition interval.

4.2.2.3 Slow Count

Slow Count is the number of counts that have accumulated in the slow channel in the present data acquisition interval.

4.2.3 Monitors

4.2.3.1 Board Temperature

Board Temperature is the current temperature measured on the printed circuit board in Celsius degrees.

4.2.3.2 High Voltage (PX4/DP5 only)

High Voltage is the detector high voltage measured in volts.

4.2.3.3 Thermoelectric Cooler (PX4/DP5 only)

Thermoelectric Cooler is the detector temperature measured in Kelvin.

4.2.4 Boot Status

4.2.4.1 Power Button Configured (PX4 only)

The Power Button Configured bit indicates a PX4 has been configured using the power button.

4.2.4.2 Software Configuration Received

The Software Configuration Received bit indicates a valid configuration has been received since power up.

4.2.4.3 Preset Count Expired (PX4/DP5 only)

The Preset Count Expired bit indicates the preset counts set in the selected range have been reached.

4.2.4.4 Status MCA Enabled

The status MCA enabled bit set indicates the DPP device multichannel analyzer is currently acquiring spectrum data. The DPPAPI makes every effort to preserve data integrity during data acquisition. The MCA acquisition mode is set by the PauseDPPData command.

4.2.4.5 Status Device Indicator (0=DP4, 1=PX4)

The status device indicator identifies the type of DPP device connected. Application features is automatically enabled or disabled depending upon the type device attached. For the DP5, a status device indicator 0="DP4 emulation mode" is selected and 1="PX4 emulation mode" is selected.

4.2.5 Tuning Status

4.2.5.1 Set Fast Threshold Done

DPP tune fast threshold has successfully completed.

4.2.5.2 Set Input Offset Done (PX4/DP5 only)

PX4 tune input offset has successfully completed.

5 Acquisition Modes

A primary function of the DPPAPI is to transmit the spectrum to the user. The interface also controls data acquisition, by starting and stopping the processing and by clearing the spectrum data. There are two acquisition modes Multichannel Analyzer (MCA) and Multichannel Scaler (MCS). For a detailed description of MCA and MCS modes see the DP4 and PX4 Users Manuals. All the configuration settings play an important role in acquiring data in MCA and MCS modes.

5.1.1 Multichannel Analyzer (MCA)

The Multichannel Analyzer (MCA) produces an energy spectrum. The digitized peak amplitude of an input shaped pulse creates a count. Counts are accumulated into channels representing a narrow range of energy. The histogram of the counts is the energy spectrum. This is the normal mode of operation.

5.1.2 Acquiring MCA Data

Before starting an acquisition, all configuration settings must be correctly set. The “Acquisition Mode” configuration setting (AcqMode) must be set to MCA. GetDppData returns a snapshot of the data buffer ready for histogram display or for mca plot file storage. The status indicator StatMcaEnabled set to TRUE indicates the acquisition device MCA is enabled. When MCA is paused StatMcaEnabled is false.

5.1.3 Multichannel Scaling (MCS)

The MultiChannel Scaler (MCS) is similar to the MCA except that each data channel corresponds to time instead of amplitude (energy), with the channel boundaries corresponding to start and stop times. Each value in the histogram array represents the total number of counts above the slow threshold during the appropriate time interval.

An MCS data acquisition is started with a given counting time per channel (MCS Timebase). The system records the number of counts in the first interval and places them in the first channel, and so on. The slow (shaped) channel counts are used for MCS. If the peaking time is set to its fastest (0.8 ms), then the MCS counts more closely resemble the input count rate. The MCS mode uses SCA8, so this gives the user the capability of setting the upper and lower level thresholds

5.1.4 MCS Acquisition Setup

The region of interest (energy range) is set using SCA8. Set SCA8 Low Channel to “0” and SCA8 High Channel to “MCA Channels – 1”. “0 to MCA Channels – 1” is the maximum range and is used for normal operation. SCA8 MUST BE ENABLED AND SET FOR MCS TO RUN.

5.1.5 Acquiring MCS Data

Configure the acquisition device and take a sample acquisition in MCA mode. This ensures the acquisition device and the DPPAPI are functioning and ready. The next step is to setup the MCS related parameters. Set the Acquisition Mode to MCS. Select a MCS Timebase. Set the energy range in SCA8 (From 0 to MCA Channels - 1). Enable SCA8 and apply the configuration. Once the MCS parameters are set, the DPP and DPPAPI are ready for MCS data acquisition. Stop the acquisition, if running. Clear the current data. Start the MCS acquisition. The status indicator MCSDone set to TRUE indicates the MCS acquisition has completed. The spectrum data is read and saved the same as in the MCA mode.

5.2 Presets

Presets are set as part of the DPP configuration. There are two types of presets, Preset Time and Preset Counts. The preset time and preset count values are stored in separate variables. Preset counts also requires channel boundary values and an enable which are stored in SCA8.

5.2.1 Preset Modes

There are four possible preset modes:

  • None. – No presets are set.
  • Preset Time – A preset time is set, but no preset count is set.
  • Preset Count – A preset count is set, but no preset time is set.
  • Preset Time and Count – Both a preset time and count is set.

5.2.2 None (No Presets)

To turn off all presets, the Preset Time must be set to zero or none and the preset counts must be disabled. To ensure that the preset counts are disabled, set the preset counts to zero, set the lower and upper preset channels to zero and set the SCA8 enable to disabled.

5.2.3 Preset Time

Preset Time stops the spectrum acquisition at a predetermined time.

  • If the preset time value is set before the spectrum acquisition has begun then the spectrum acquisition will stop when the Accumulation Time reaches the preset time.
  • If the preset time value is set after the spectrum acquisition has begun and the Accumulation Time is less than the time set, the spectrum acquisition will stop when the Accumulation Time reaches the preset time.
  • If the preset time value is set after the spectrum acquisition has begun and the Accumulation Time is greater than the time set, the spectrum acquisition will not stop until after a new acquisition has begun and the Accumulation Time reaches the preset time.

5.2.4 Preset Counts

Preset Count stops the spectrum acquisition at a predetermined number of counts for a selected group of channels. Select the low and upper count boundary channels and enable SCA8. The preset counts are stored in a variable and the selected channels and the SCA8 enable are stored in SCA8.

5.2.5 Preset Time and Preset Counts

When both Preset Time and Preset Counts are selected the acquisition stops when the first preset is reached.

5.3 Setting the Slow and Fast Thresholds

Setting the fast and slow thresholds is an important setup consideration. Following is a step-by-step guide to correctly setting the fast and slow thresholds.

1) Configure the DPP and the application software for an acquisition.

2) Start an acquisition.

3) Remove the source.

4) Set to delta mode.

5) Setting the slow threshold:

A) Look for counts on low end.

B) Place cursor above low end counts.

C) Open configuration dialog.

D) Go to MCA tab.

E) Press slow threshold cursor button.

F) Press apply.

6) Setting the fast threshold:

A) Open configuration dialog.

B) Go to Shaping Tab

C) Select a fast threshold.

D) Press apply.

E) Check Fast Count value in Info Panel.

F) Repeat Steps C-E until the Input Counts value is approximately 5.

7) The thresholds are now set. You are ready to begin an acquisition.

8) Replace the source.

9) Start an acquisition.

6 Automating the DPP Tuning Process

6.1 Fast Threshold

Calling the TuneFastThreshold function automatically tunes the fast channel threshold. Please wait until the operation has completed before proceeding.

6.2 The Tune Fast Threshold Procedure

  1. REMOVE THE SOURCE BEFORE RUNNING.
  2. Press Tune Fast Threshold button.
  3. The dialog may not be visible for a second.
  4. Wait for the dialog box to return.
  5. The old fast threshold is replaced with the new value.
  6. Tune Fast Threshold only takes a few seconds to run.

6.3 Input Offset

Calling the TuneInputOffset function (PX4/DP5) automatically sets the input signal offset. First a coarse input offset adjust is done, then a fine input offset is done to complete the input offset adjustment.

6.4 Slow Threshold

A simple algorithm to tune the slow threshold:

  1. REMOVE THE SOURCE BEFORE RUNNING.
  2. Set the slow threshold to 0.
  3. Start an acquisition.
  4. Clear the spectrum data.
  5. Wait a few seconds.
  6. Stop the acquisition.
  7. Save the spectrum data to a buffer.
  8. Search the buffer at the low channel end for slow counts.
  9. Set the slow threshold above the highest slow counts channel.
  10. Adjust for the specific application.

7 Configuration Settings

The DPP_CONFIG_SETTINGS data structure variables share the same data type in C++ and Visual Basic. The DPP_CONFIG_SETTINGS data values have been selected for ease of use with application controls.

7.1 MCA Properties

7.1.1 Acquisition Mode

Variable

AcqMode

Data Type

byte

Description

The acquisition mode selection determines how the acquired events will be analyzed. The standard acquisition mode is MCA or Multi-Channel Analyzer mode. Amptek Digital Pulse Processors are designed to be Multi-Channel Analyzers. Multi-Channel Analyzers create a histogram of pulse heights over a particular voltage scale.

As added functionality, a limited MCS or Multi-Channel Scaling mode has been added. Once per update interval, the data from all the channels is downloaded and summed. This summed value is then plotted in the display. Therefore, what is displayed is the count rate per update interval.

Values

0 - MCA

1 - MCS

7.1.2 MCS Timebase

Variable

MCSTimebase

Data Type

byte

Description

Sets the MCS time interval per channel.

Values

0 - 10mS/channel | 8 - 5 sec/channel
1 - 20mS/channel | 9 - 10 sec/channel
2 - 50mS/channel | 10 - 20 sec/channel
3 - 100mS/channel | 11 - 30 sec/channel
4 - 200mS/channel | 12 - 60 sec/channel
5 - 500mS/channel | 13 - 90 sec/channel
6 - 1 sec/channel | 14 - 120 sec/channel
7 - 2 sec/channel | 15 - 300 sec/channel

7.1.3 MCA Channels

Variable | MCAChannels
Data Type | byte
Description | Number of acquisition channels.
Values | 0 - 256 1 - 512 2 - 1024 3 - 2048 4 - 4096 5 - 8192

7.1.4 Buffer Select (DP4/PX4)

Variable | BufferSelect
Data Type | byte
Description | MCA buffer selection, the selected MCA buffer holds the current accumulating counts.
Values | DP4/PX4: 0 - Buffer A 1 - Buffer B 2 - HW Select DP5: 0 - Buffer A (DP5 Supports Buffer A Only)

7.1.5 TTL Gate

Variable | TTLGate
Data Type | byte
Description | TTL gate input includes or excludes events from the spectrum.
Values | 0 - Off 1 - Active High 2 - Active Low

7.1.6 Slow Threshold

Variable | SlowThreshold
Data Type | byte
Description | Pulses exceeding the low level discriminator threshold on the slow channel will be recorded in the spectrum.
Values | 0 – 250 = 0 - 24.41% of the full energy scale in percent or channels

7.1.7 Preset Time

Variable

PresetTime

Data Type

long

Description

Preset duration of time requested for the current acquisition in tenths of seconds

Values

100ms to 19.4 days, with 100ms precision (i.e. 100ms = 1, 5 seconds = 50, etc.)

Control value strings used with configuration helper functions:

0 - None | 8 - 5 min
1 - 1 sec | 9 - 10 min
2 - 2 sec | 10 - 30 min
3 - 5 sec | 11 - 1 hr
4 - 10 sec | 12 - 2 hr
5 - 30 sec | 13 - 5 hr
6 - 1 min | 14 - 10 hr
7 - 2 min | 15 - 24 hr

7.1.8 Preset Count

Variable | PresetCount
Data Type | long
Description | Preset number of counts requested in selected channel range. Channel values are stored in SCA8.
Values | 0 - 0xFFFFFFFF counts

7.1.9 Single Channel Analyzers

Variable | SCA(0 To 7)
Data Type | long
Description | Single channel analyzers, upper/lower thresholds and enables, stored in packed format.
Values | 0 - SCA 1 Controls 1 - SCA 2 Controls 2 - SCA 3 Controls 3 - SCA 4 Controls 4 - SCA 5 Controls 5 - SCA 6 Controls 6 - SCA 7 Controls 7 - SCA 8 Controls SCA values, LL, UL, and Enable are stored together

Select Single Channel Analyzer Value Composition:

Description | Enable Channel | Upper Level Threshold | Lower Level Threshold
Bits | 31 | 30-16 | 15-0
Value | 0=OFF, 1=ON | upper channel value – 1=0-8191 | lower channel value -1=0-8191

7.2 Shaping Properties

7.2.1 Time to Peak

Variable

TimeToPeak

Data Type

byte

Description

Time-to-peak register setting. For DP5 80MHz FPGA Clock the Peaking Time values are 4x faster. (These values are multiplies by 0.25.)

Values

Configuration helper functions convert these values to configuration values.

Spin - Display string values:

0 - 0.8uS | 12 - 16.0uS
1 - 1.6uS | 13 - 19.2uS
2 - 2.4uS | 14 - 22.4uS
3 - 3.2uS | 15 - 25.6uS
4 - 4.0uS | 16 - 32.0uS
5 - 4.8uS | 17 - 38.4uS
6 - 5.6uS | 18 - 44.8uS
7 - 6.4uS | 19 - 51.2uS
8 - 8.0uS | 20 - 64.0uS
9 - 9.6uS | 21 - 76.8uS
10 - 11.2uS | 22 - 89.6uS
11 - 12.8uS | 23 - 102.4uS

7.2.2 Decimation

Variable | Decimation
Data Type | byte
Description | decimation setting for pulse shaping
Values | Calculated by configuration helper functions from time-to-peak value.

7.2.3 Flat Top

Variable | FlatTop
Data Type | byte
Description | Flattop register setting. For DP5 80MHz FPGA Clock the Flattop Width values are 4x faster. (These values are multiplies by 0.25.)
Values | Display values calculated by configuration helper functions from time-to-peak value and decimation value. Flattop calculated from selected control value.

7.2.4 PUR Enable

Variable | PUREnable
Data Type | byte
Description | pile-up rejection enabled
Values | 0 - Off 1 - On

7.2.5 Fast Threshold

Variable | FastThreshold
Data Type | byte
Description | Fast Ch Threshold, events with fast channel amplitude below this are rejected.
Values | 0 - 250

7.2.6 RTD Slow (DP4/PX4) / RTD Ratio (DP5)

Variable | RTDSlow
Data Type | byte
Description | DP4/PX4: Risetime Discrimination slow threshold DP5: If RTD is enabled, compares the fast channel peak height to the slow channel peak height. If this ratio is sufficiently high (fast risetime), the event is accepted. If this ratio is low, the event is rejected.
Values | spin values: 0 – 255 display values: 0 – 48.83% full energy scale

7.2.7 RTD On

Variable | RTDOn
Data Type | byte
Description | Turns RTD on, and sets the amplitude and timing thresholds
Values | 0 - Off 1 - On

7.2.8 RTD Fast (DP4/PX4) / RTD Slow Threshold (DP5)

Variable | RTDFast
Data Type | byte
Description | DP4/PX4: RTD Time Threshold Events with HWHM wider than this are rejected DP5: If RTD is enabled, sets the RTD slow threshold. This threshold applies to the slow channel. Only events exceeding this threshold will be analyzed by the RTD circuit; all events below this threshold are accepted.
Values | 4 - 19

RTD Rules:

Events whose shaped slow channel amplitude is below the RTD slow threshold are kept.

- OR -

Events whose fast channel amplitude is below the fast threshold are rejected;

- OR -

Events whose measured HWHM is wider than the RTD Time Threshold are rejected.

7.2.9 Baseline Restoration (BLR)

Variable

BLR

Data Type

byte

Description

Baseline Restoration, (see VB SpinToBLR function) . For DP5 80MHz FPGA Clock the Baseline Restoration (BLR) values are 4x faster. (See Table of values below.)

Values

ComboBox Index | BLR Setting | BLR
0 | 63 | BLR:OFF*
1 | 64 | BLR:ON---DOWN:1:VERY SLOW---UP:1:VERY SLOW
2 | 68 | BLR:ON---DOWN:1:VERY SLOW---UP:4:SLOW
3 | 72 | BLR:ON---DOWN:1:VERY SLOW---UP:16:MEDIUM
4 | 76 | BLR:ON---DOWN:1:VERY SLOW---UP:64:FAST
5 | 80 | BLR:ON---DOWN:4:SLOW---UP:1:VERY SLOW
6 | 84 | BLR:ON---DOWN:4:SLOW---UP:4:SLOW
7 | 88 | BLR:ON---DOWN:4:SLOW---UP:16:MEDIUM
8 | 92 | BLR:ON---DOWN:4:SLOW---UP:64:FAST
9 | 96 | BLR:ON---DOWN:16:MEDIUM---UP:1:VERY SLOW
10 | 100 | BLR:ON---DOWN:16:MEDIUM---UP:4:SLOW
11 | 104 | BLR:ON---DOWN:16:MEDIUM---UP:16:MEDIUM
12 | 108 | BLR:ON---DOWN:16:MEDIUM---UP:64:FAST
13 | 112 | BLR:ON---DOWN:64:FAST---UP:1:VERY SLOW
14 | 116 | BLR:ON---DOWN:64:FAST---UP:4:SLOW
15 | 120 | BLR:ON---DOWN:64:FAST---UP:16:MEDIUM
16 | 124 | BLR:ON---DOWN:64:FAST---UP:64:FAST

DP5 80MHz FPGA Clock Only

ComboBox Index | BLR Setting | BLR
0 | 63 | BLR: OFF
1 | 64 | BLR:ON---DOWN:4:SLOW---UP:4:SLOW
2 | 68 | BLR:ON---DOWN:4:SLOW---UP:16:MEDIUM
3 | 72 | BLR:ON---DOWN:4:SLOW---UP:64:FAST
4 | 76 | BLR:ON---DOWN:4:SLOW---UP:256:VERY FAST
5 | 80 | BLR:ON---DOWN:16:MEDIUM---UP:4:SLOW
6 | 84 | BLR:ON---DOWN:16:MEDIUM---UP:16:MEDIUM
7 | 88 | BLR:ON---DOWN:16:MEDIUM---UP:64:FAST
8 | 92 | BLR:ON---DOWN:16:MEDIUM---UP:256:VERY FAST
9 | 96 | BLR:ON---DOWN:64:FAST---UP:4:SLOW
10 | 100 | BLR:ON---DOWN:64:FAST---UP:16:MEDIUM
11 | 104 | BLR:ON---DOWN:64:FAST---UP:64:FAST
12 | 108 | BLR:ON---DOWN:64:FAST---UP:256:VERY FAST
13 | 112 | BLR:ON---DOWN:256:VERY FAST---UP:4:SLOW
14 | 116 | BLR:ON---DOWN:256:VERY FAST---UP:16:MEDIUM
15 | 120 | BLR:ON---DOWN:256:VERY FAST---UP:64:FAST
16 | 124 | BLR:ON---DOWN:256:VERY FAST---UP:256:VERY FAST

7.2.10 Baseline On (Obsolete, do not use , kept for backward compatibility)

Variable | BaselineOn
Data Type | byte
Description | use autobaseline during detector reset
Values | 0 - Off

7.3 Gain PZ Properties

7.3.1 Coarse Gain

Variable

Coarse Gain

Data Type

byte

Description

coarse gain value, provides large gain adjust

Values

DP4

0 - 10.8x

1 - 20.7x

2 - 55.4x

3 - 106.2x

PX4 |
0 - 4.13x | 14 - 49.93x
1 - 4.95x | 15 - 60.30x
2 - 5.94x | 16 - 76.70x
3 - 7.17x | 17 - 91.86x
4 - 8.22x | 18 - 110.29x
5 - 9.84x | 19 - 133.19x
6 - 11.82x | 29 - 162.92x
7 - 14.27x | 21 - 195.10x
8 - 17.46x | 22 - 234.25x
9 - 20.90x | 23 - 282.89x
10 - 25.10x | 24 - 324.14x
11 - 30.31x | 25 - 388.17x
12 - 34.73x | 26 - 466.05x
13 - 41.59x | 27 - 562.83x

DP5 |
0 - 1.00x | 8 - 14.56x
1 - 2.22x | 9 - 17.77x
2 - 3.78x | 10 - 22.42x
3 - 5.26x | 11 - 30.83x
4 - 6.56x | 12 - 38.18x
5 - 8.39x | 13 - 47.47x
6 - 10.1x | 14 - 66.26x
7 - 11.31x | 15 - 102.01x

7.3.2 Fine Gain

Variable | Fine Gain
Data Type | double
Description | fine gain value, allows small gain adjustments
Values | Spin values: 6144-10240, fine gain values: 0.7500 – 1.2500

7.3.3 Pole Zero (PX4/DP5 only)

Variable | PoleZero
Data Type | long
Description | pole zero adjust value (PX4/DP5 only)
Values | 0 - 250

7.3.4 Input Offset (PX4/DP5 only)

Variable | InputOffset
Data Type | long
Description | input offset (PX4/DP5 only)
Values | DP4: 0 PX4/DP5: spin values: 0 – 4000 display values: -2.048V to 1.952V DP5: A setting of -2.048V instructs the DP5 to use a DP5 selected default setting, any other setting is interpreted the same as the PX4

7.3.5 Input Polarity (PX4/DP5 only)

Variable | InputPolarity
Data Type | byte
Description | Determines if the PX4 front-end is inverting or not inverting. (PX4/DP5 only)
Values | DP4: 0 PX4/DP5: 0 – Positive = Front-end non-inverting 1 – Negative = Front-end Inverting

7.3.6 Detector Reset Lockout Period

Variable | DetReset
Data Type | byte
Description | Detector reset lockout period. For DP5 80MHz FPGA Clock the Detector Reset Lockout Period values are 4x faster. (These values are multiplies by 0.25.)
Values | 0 = Slow - 13.1mS 1 = Slow - 6.55mS 2 = Slow - 3.28mS 3 = Slow - 1.64mS 4 = Fast - 819uS 5 = Fast - 410uS 6 = Fast - 205uS 7 = Fast - 102uS 8 = OFF

7.4 Power Properties

7.4.1 Thermoelectric Cooler (PX4/DP5 only)

Variable | TEC
Data Type | long
Description | TEC temperature setting (displayed in Kelvin). (PX4/DP5 only.)
Values | DP4: Any value within PX4 range. PX4: spin values: 2458 – 4095 display values: 180.0K - 299.9K

7.4.2 High Voltage Enabled (PX4/DP5 only)

Variable | HVEnabled
Data Type | byte
Description | high voltage setting enable (PX4/DP5 only)
Values | 0 - Disabled 1 - Enabled

7.4.3 High Voltage (PX4/DP5 only)

Variable | HV
Data Type | long
Description | High voltage setting value. (PX4/DP5 only.)
Values | DP4: Any value within valid PX4 range. PX4: spin: 0 – 4000 display values: 0.0V - 2929.7V (only 0V to 1500V is valid)

7.4.4 Preamp Voltage (PX4 only)

Variable | PreampPower
Data Type | byte
Description | preamp voltage select value (PX4 only)
Values | 0 - 5.0V 1 - 8.5V (Not recognized by DP5 – preamp voltage set by hardware jumpers)

7.5 Miscellaneous Properties

7.5.1 Analog Out

Variable | AnalogOut
Data Type | byte
Description | Analog output dac enabled and DAC output type.
Values | 0 - Fast Channel 1 - Shaped Pulse 2 - Decimated Input 3 - BLR Correction 4 – Off

7.5.2 Output Offset

Variable | OutputOffset
Data Type | byte
Description | Output DAC offset
Values | spin values: 0 – 127 display values: -500mV to 492mV

7.5.3 Auxiliary Output (PX4/DP5 only)

Variable | AuxOut
Data Type | byte
Description | Auxiliary output select (PX4/DP5 only)
Values | 0 - ICR 1 - PILEUP 2 – MCS Timebase 3 - ONESHOT 4 - DET_RES 5 - MCA_EN 6 - TRIGGER 7 - SCA8

7.5.4 Audible Counter (PX4 only)

Variable | AudibleCounter
Data Type | byte
Description | audio volume setting (PX4 only)
Values | 0 - Off 1 - Low 2 - Medium 3 – High

8 DPPAPI Data Types

8.1 DPP_CONFIG_SETTINGS Data Type (C++)

typedef struct _DPP_CONFIG_SETTINGS {

    //MCA Properties

       byte AcqMode;        // acquisition mode 0=MCA,1=MCS

       byte MCSTimebase;    // MCS timebase value (0-15) see CAcqMode

       byte MCAChannels;    // number of channels 4=256,3=512,2=1024,1=2048,0=4096,5=8192

       byte BufferSelect;   // Holds Buffer Sel A&B,Buffer Sel Hardware,see DPPBufferSelect

       byte TTLGate;        // gate input, controls spectrum events included/excluded, see DPPGate

       byte SlowThreshold;  // Slow ch threshold, Events w/amp lower not added to spectrum

       long PresetTime;     // var holds preset time, used in usb

       long PresetCount;    // preset count in selected channels, ch are set in SCA8

       long SCA[8];         // SCA values, LL, UL, and Enable are stored together

    //Shaping Properties

       byte TimeToPeak;     // TimeToPeak register setting

       byte Decimation;     // decimation setting for pulse shaping

       byte FlatTop;        // flatop register setting

       byte PUREnable;      // pile-up rejection enabled

       byte FastThreshold;  // Fast Ch Threshold, events w/fch amp below this are rejected

       byte RTDSlow;        // Risetime Discrimination slow threshold

       byte RTDOn;          // Turns RTD on, and sets the amplitude and timing thresholds

       byte RTDFast;        // RTD Time Threshold,Events w/HWHM wider than this are rejected

       byte BLR;            // Baseline Restoration, see udBLR.Value notes for values

       byte BaselineOn;     // use autobaseline during detector reset

    //Gain PZ Properties

       byte CoarseGain;     // stores current coarse gain value

       long FineGain;             // stores current fine gain value

       long PoleZero;             // pole zero adjust value

       long InputOffset;    // input offset

       byte InputPolarity;  // use InvertEnable during detector reset

       byte DetReset;             // detector reset lockout period

    //Power Properties

       long TEC;            // TEC temperature setting (displayed in Kelvin)

       byte HVEnabled;      // high voltage setting enable

       long HV;             // high voltage setting value

       byte PreampPower;    // preamp power select value (5v or 8.5v)

    //Misc Properties

       byte AnalogOut;      // dac enabled and DAC output type,(stobed peak,shaped pulse,dec inp,fast ch)

       byte OutputOffset;   // Output DAC offset, -64…+63,(signed)(D7-D1) (-500mV to +492mV)

       byte AuxOut;         // Aux output type

       byte AudibleCounter; // audio volume setting

} DPP_CONFIG_SETTINGS, *LP_DPP_CONFIG_SETTINGS;

8.2 DPP_CONFIG_SETTINGS Data Type (Visual Basic)

Public Type DPP_CONFIG_SETTINGS

    ' MCA Properties

     AcqMode As Byte           ' acquisition mode 0=MCA,1=MCS

     MCSTimebase As Byte       ' MCS timebase value (0-15) see CAcqMode

     MCAChannels As Byte       ' number of channels 4=256,3=512,2=1024,1=2048,0=4096,5=8192

     BufferSelect As Byte      ' Holds Buffer Sel A&B,Buffer Sel Hardware,see DPPBufferSelect

     TTLGate As Byte           ' gate input, controls spectrum events included/excluded, see DPPGate

     SlowThreshold As Byte     ' Slow ch threshold, Events w/amp lower not added to spectrum

     PresetTime As Long        ' var holds preset time, used in usb

     PresetCount As Long       ' preset count in selected channels, ch are set in SCA8

     SCA(0 To 7) As Long       ' SCA values, LL, UL, and Enable are stored together

    ' Shaping Properties

     TimeToPeak As Byte        ' TimeToPeak register setting

     Decimation As Byte        ' decimation setting for pulse shaping

     FlatTop As Byte           ' flatop register setting

     PUREnable As Byte         ' pile-up rejection enabled

     FastThreshold As Byte     ' Fast Ch Threshold, events w/fch amp below this are rejected

     RTDSlow As Byte           ' Risetime Discrimination slow threshold

     RTDOn As Byte             ' Turns RTD on, and sets the amplitude and timing thresholds

     RTDFast As Byte           ' RTD Time Threshold,Events w/HWHM wider than this are rejected

     BLR As Byte               ' Baseline Restoration, see udBLR.Value notes for values

     BaselineOn As Byte        ' use autobaseline during detector reset

    ' Gain PZ Properties

     CoarseGain As Byte        ' stores current coarse gain value

     FineGain As Long          ' stores current fine gain value

     PoleZero As Long          ' pole zero adjust value

     InputOffset As Long       ' input offset

     InputPolarity As Byte     ' use InvertEnable during detector reset

     DetReset As Byte          ' detector reset lockout period

    ' Power Properties

     TEC As Long               ' TEC temperature setting (displayed in Kelvin)

     HVEnabled As Byte         ' high voltage setting enable

     HV As Long                ' high voltage setting value

     PreampPower As Byte       ' preamp power select value (5v or 8.5v)

    ' Misc Properties

     AnalogOut As Byte         ' DAC enabled/output type,(stobed peak,shaped pulse,dec inp,fast ch)

     OutputOffset As Byte      ' Output DAC offset, -64…+63,(signed)(D7-D1) (-500mV to +492mV)

     AuxOut As Byte            ' Aux output type

     AudibleCounter As Byte    ' audio volume setting

End Type

8.3 DPP_STATUS Data Type (C++)

typedef struct _DPP_STATUS {

       // Identification

       double FPGA;               // FPGA

       double Firmware;           // firmware revision

       double SerialNumber;       // unit serial number

       byte StatDevInd;           // device indicator from status block (0=dp4,1=px4)

       // Configuration

       byte BootStatus;           // boot status byte (PwrBtnConfig,SwConfigRcvd,McaEnabled)

       byte PwrBtnConfig;         // dpp has loaded config from power button

       byte SwConfigRcvd;         // software has sent valid config to unit since startup

       // Tuning

       byte SetFastThreshDone;    // DPP tune fast thresh has successfully done

       byte SetSlowThreshDone;    // DPP tune slow thresh has successfully done (NOT USED)

       byte SetInputOffsetDone;   // DPP tune input offset has successfully done

       // Monitors

       double BoardTemp;          // board temperature monitor value

       double HVMonitor;          // high voltage monitor value

       double TECMonitor;         // TEC temperature monitor value (displayed in Kelvin)

       // Acquisition Parameters

       double FastCount;          // fast channel count

       double SlowCount;          // slow channel count

       double AccumulationTime;   // real time duration of present data acquisition interval

       // Acquisition Mode

       byte StatMcaEnabled;       // mca enabled status, hi during acq, preset time resets flag

       byte MCSDone;              // MCS done flag 1=finished, 0=not finished

       byte PresetCountExpired;   // indicates presets counts have been reached

} DPP_STATUS, *LP_DPP_STATUS;

8.4 DPP_STATUS Data Type (Visual Basic)

Public Type DPP_STATUS

    ' Identification

    FPGA As Double              ' FPGA

    Firmware As Double          ' firmware revision

    SerialNumber As Double      ' unit serial number

    StatDevInd As Byte          ' device indicator from status block (0=dp4,1=px4)

    ' Configuration

    BootStatus As Byte          ' boot status byte (PwrBtnConfig,SwConfigRcvd,McaEnabled)

    PwrBtnConfig As Byte        ' dpp has loaded config from power button

    SwConfigRcvd As Byte        ' software has sent valid config to unit since startup

    ' Tuning

    SetFastThreshDone As Byte   ' DPP tune fast thresh has successfully done

    SetSlowThreshDone As Byte   ' DPP tune slow thresh has successfully done

    SetInputOffsetDone As Byte  ' DPP tune input offset has successfully done

    ' Monitors

    BoardTemp As Double         ' board temperature monitor value

    HVMonitor As Double         ' high voltage monitor value

    TECMonitor As Double        ' TEC temperature monitor value (displayed in Kelvin)

    ' Acquisition Parameters

    FastCount As Double         ' fast channel count

    SlowCount As Double         ' slow channel count

    AccumulationTime As Double  ' real time duration of present data acquisition interval

    ' Acquisition Mode

    StatMcaEnabled As Byte      ' mca enabled status, high during acq, preset time resets flag

    MCSDone As Byte             ' MCS done flag 1=finished, 0=not finished

    PresetCountExpired As Byte  ' indicates presets counts have been reached

End Type

9 Amptek DPP Configuration File Reference

The Amptek DPP configuration file format allows for configurations to be shared between DPP devices and software. The current format is a superset of the past configuration file formats. The goal is to provide seamless and uninterrupted development of DPP devices and software. By expanding on the legacy format, development continuity has been maintained with maximum preservation of past development investments. The following table is a summary of the format.

Item | Setting | Stored Value Type | Reference Section | Notes
1 | Peaking Time | control index | Time to Peak | This value is used to generate Decimation and TimeToPeak values. The Decimation value is necessary to generate the FlatTop Width display values. These values must be calculated before the FlatTop is set.
2 | Flat Top Width | control index | Flat Top AND Decimation | There are 16 Flat Top settings. To calculate the FlatTop Width display value: index * 0.1 * (2 ^ Decimation) The value is displayed in "uS".
3 | Slow Threshold | control index | Slow Threshold |
4 | Fast Threshold | control index | Fast Threshold |
5 | Output Offset | control index | Output Offset | To calculate the Output Offset display value: i = index * 2 j = IIf(i > 127, 1, 0) k = ((i + j * -256) * 1000/ 256) OutputOffset=cstring(k)+"mV"
6 | PUR | string text | PUR Enable | “PUROff”=0, “PUROn”=1
7 | Detector Reset | control index | Detector Reset Lockout Period |
8 | Analog Out | string text index | Analog Out | The current control index + 1 is appended to the string “DAC” Examples: index = 0 -> DAC1 index = 1 -> DAC2
9 | MCA Channels | string text | MCA Channels | The number or channels is appended to the string “MCA” Example: channels = 1024 -> MCA1024
10 | Com Port | string text | Only USB supported | Always set to zero (0) or “USB”. Developer Notes: ADMCA.exe and DPPAPI.dll currently only support USB and ignore this setting. The VB DPP hardware demo application DP4.exe or PX4.exe uses the following format: USB = “USB” RS232 COM PORT1= “COM1”
11 | RTD Enable | string text | RTD Enable | “RTDOff”=0, “RTDOn”=1
12 | RTD Slow | control index | RTD Slow |
13 | RTD Fast | control index | RTD Fast |
14 | Coarse Gain | control index | Coarse Gain |
15 | Auto Baseline | string text | Baseline On | “AutoBaselineOff”=0 “AutoBaselineOn”=1
16 | BLR | setting value | Baseline Restoration | Note: Use the BLR setting not the index. On some applications these are the same.
17 | Buffer Select | string text | Buffer Select | "BufferSelectA"=0 "BufferSelectB"=1 "BufferSelectHW"=2
18 | TTL Gate | string text | TTL Gate | "GateOff"=0 "GateHigh"=1 "GateLow"=2
19 | Preset Time | string text | Preset Time | The display text is saved/read.
20 | Fine Gain | control index | Fine Gain | FineGain=CSTR(index/8192)
21 | TEC Enabled | control index | PX4 Programmer’s Guide | Always Enabled = 1
22 | RESERVED1 | control index | PX4.exe Source Example | Always Enabled = 1
23 | PWR_8_5SEL | control index | PX4 Programmer’s Guide | Always Enabled = 1
24 | RESERVED2 | control index | PX4.exe Source Example | Always Enabled = 1
25 | PWR_9V | control index | PX4 Programmer’s Guide | Always Enabled = 1
26 | Input Polarity | control index | Input Polarity | 0=Positive, 1=Negative
27 | Input Offset | control index | Input Offset | To calculate the Input Offset display value: i = (index - 2048) / 1000 InputOffset = cstring(i)+"V"
28 | Pole Zero | control index | Pole Zero |
29 | Aux Out | control index | Auxiliary Output |
30 | HV | control index | High Voltage |
31 | TEC | control index | Thermoelectric Cooler |
32 | Audio | control index | Audible Counter |
33 | Preset Count | setting value | Preset Count |
34 | SCA1 | packed bit array | Single Channel Analyzers |
35 | SCA2 | packed bit array | Single Channel Analyzers |
36 | SCA3 | packed bit array | Single Channel Analyzers |
37 | SCA4 | packed bit array | Single Channel Analyzers |
38 | SCA5 | packed bit array | Single Channel Analyzers |
39 | SCA6 | packed bit array | Single Channel Analyzers |
40 | SCA7 | packed bit array | Single Channel Analyzers |
41 | SCA8 | packed bit array | Single Channel Analyzers |
42 | Acquisition Mode | control index | Acquisition Mode |
43 | MCS Timebase | control index | MCS Timebase |

Current version as of manual release date: 10/2/2009

DPPAPI - DPP Digital Pulse Processor API Reference Manual Version: 2.0

Copyright (C) 2000-2009 Amptek, Inc.

END OF DOCUMENT


DppApi Help

DP4/PX4/DP5 Digital Pulse Processor API Help

The DP4/PX4/DP5 Digital Pulse Processor API is an Application Programming Interface Library for the Amptek DP4,PX4 and DP5 Digital Pulse Processors.

DPPAPI Function Groups

  • _ DPPAPI Introduction
  • Configuration Helper Functions
  • Configuration Transfer Functions
  • Data Acquisition Functions
  • DP5 Text Functions
  • DPP Tune Functions
  • DPP USB Additional Functions
  • DPPAPI Constructor Functions
  • DPPAPI Setup Notes
  • PX4 Text Functions
  • Status Indicator Functions
  • USB Manager Functions

    • DPPAPI Reference Sections

    Functions

    Structures

    Modules

    Help file built: 10/02/09

    Functions

  • ClearDppData
  • CloseDppApi
  • CloseUSBDevice
  • CreateMCAFileDPPSettings
  • DisplayStatusBuffer
  • Get80MHzMode
  • GetCoarseGainSpinFromText
  • GetCoarseGainTextFromSpin
  • GetConfigFromBuffer
  • GetConfigFromDpp
  • GetConfigFromFile
  • GetConfigString
  • GetDP5Text
  • GetDppData
  • GetOutputOffsetSpinFromText
  • GetOutputOffsetTextFromSpin
  • GetPresetTimeStringFromVal
  • GetPresetTimeValFromString
  • GetPX4Text
  • GetSlowThreshSpinFromChannel
  • GetSlowThreshSpinFromPercent
  • GetSlowThreshStringsFromSpin
  • GetStatusBuffer
  • GetStatusString
  • GetStatusStringFromBuffer
  • GetStatusStruct
  • GetStatusStructFromBuffer
  • GetTempConfigSettings
  • GetTempConfigString
  • GetTimeToPeakDecimationFromSpin
  • GetTimeToPeakSpinFromValues
  • GetUSBDppDeviceInfo
  • MonitorUSBDppDevices
  • OpenDppApi
  • OpenUSBDevice
  • OpenUSBDeviceEx
  • PauseDppData
  • ProcessDppData
  • ProcessStatusBuffer
  • SaveConfigToFile
  • SendConfigToBuffer
  • SendConfigToDpp
  • SendDppVendorRequest
  • SetDP5Text
  • SetFPGAClockDefault
  • SetPX4Text
  • SetTempConfigSettings
  • TuneFastThreshold
  • TuneInputOffset
  • TuneInputOffsetInit

    • Modules

  • _ DPPAPI Introduction
  • Configuration Helper Functions
  • Configuration Transfer Functions
  • Data Acquisition Functions
  • DP5 Text Functions
  • DPP Tune Functions
  • DPP USB Additional Functions
  • DPPAPI Constructor Functions
  • DPPAPI Setup Notes
  • PX4 Text Functions
  • Status Indicator Functions
  • USB Manager Functions

    • Structures

  • DPP_BOOT_STATUS
  • DPP_CONFIG_SETTINGS
  • DPP_STATUS

    • _ DPPAPI Introduction

     Filename: DppApi.h

    Description

    Interface to the DPP Application functions.

    The DP4/PX4/DP5 Digital Pulse Processor API (DPPAPI) is the Application Programming Interface Library for Amptek DP4, PX4 and DP5 Digital Pulse Processors (DPPs).

    Copyright (c)2005, 2007, 2009 Amptek, All Rights Reserved

    Developer Notes

    Application programs invoke DPPAPI functions to establish communication with DPP, control its operation, and retrieve data. DPPAPI is distributed in two forms, as an object link library (.LIB) or Dynamic Link Library (.DLL). The application executable programs (.EXE) are created by linking the application code with one of these libraries statically or dynamically (see Microsoft documentation about program linking). The applications can be developed in C, Visual Basic or many other languages.

    Version: v20050729_1423

    _ DPPAPI Introduction

  • DPP_BOOT_STATUS
  • DPP_CONFIG_SETTINGS
  • DPP_STATUS

    • Configuration Helper Functions

     Filename: DppApi.h

    Description

    help in the display, control and conversion of DPP configuration data.

    All of the configuration settings have underlying support classes. Configuration Helper Functions tap some of the functionality of the underlying classes. The goal is to reduce the amount of support coding necessary to a minimum.

    Copyright (c)2005, 2007 Amptek, All Rights Reserved

    Configuration Helper Functions

  • GetCoarseGainSpinFromText
  • GetCoarseGainTextFromSpin
  • GetOutputOffsetSpinFromText
  • GetOutputOffsetTextFromSpin
  • GetPresetTimeStringFromVal
  • GetPresetTimeValFromString
  • GetSlowThreshSpinFromChannel
  • GetSlowThreshSpinFromPercent
  • GetSlowThreshStringsFromSpin
  • GetTimeToPeakDecimationFromSpin
  • GetTimeToPeakSpinFromValues

    • Configuration Transfer Functions

     Filename: DppApi.h

    Description

    Configuration Transfer Functions provide device configuration services.

    Configuration Transfer Functions sets and transfers configurations to and from the current DPP, the DPPAPI and selected Amptek DPP configuration files.

    Copyright (c)2005, 2007 Amptek, All Rights Reserved

    Developer Notes

    The DPPAPI and the current DPP must be configured before data acquisition operations can begin.

    Configuration Transfer Functions

  • Get80MHzMode
  • GetConfigFromBuffer
  • GetConfigFromDpp
  • GetConfigFromFile
  • GetConfigString
  • GetTempConfigSettings
  • GetTempConfigString
  • SaveConfigToFile
  • SendConfigToBuffer
  • SendConfigToDpp
  • SetFPGAClockDefault
  • SetTempConfigSettings

    • Data Acquisition Functions

     Filename: DppApi.h

    Description

    Control data acquisition.

    Spectrum information is read as a block of data and is converted into histogram ready display values.

    Copyright (c)2005, 2007 Amptek, All Rights Reserved

    Data Acquisition Functions

  • ClearDppData
  • GetDppData
  • PauseDppData
  • ProcessDppData

    • DP5 Text Functions

     Filename: DppApi.h

    Description

    Sets and reads text stored in the DP5.

    DP5 Text Functions works for DP5 only.

    Copyright (c)2005, 2009 Amptek, All Rights Reserved

    DP5 Text Functions

  • GetDP5Text
  • SetDP5Text

    • DPP Tune Functions

     Filename: DppApi.h

    Description

    Tunes the fast threshold (DP4/PX4/DP5) and input offset (PX4/DP5 only).

    PX4 with FPGA/Firmware greater than Version 3.13 or DP4 with FPGA/Firmware greater than Version 4.00 required.

    Developer Notes

    The source must be removed to auto tune the fast threshold. Status flags are provided to indicate a tuning function successful completion. (See DPP_STATUS.)

    Copyright (c)2005-2009 Amptek, All Rights Reserved

    DPP Tune Functions

  • TuneFastThreshold
  • TuneInputOffset
  • TuneInputOffsetInit

    • DPP USB Additional Functions

     Filename: DppApi.h

    Description

    Send Dpp USB Vendor Request (DP4/PX4/DP5).

    Developer Notes

    Additonal functions are available through Dpp USB Vendor Requests. This is an advanced function and is not supported. See DP4/PX4/DP5 user manuals for Vendor Request function details.

    Copyright (c)2005-2009 Amptek, All Rights Reserved

    DPP USB Additional Functions

  • SendDppVendorRequest

    • DPPAPI Constructor Functions

     Filename: DppApi.h

    Description

    Opens the DPP Application functions.

    DPPAPI Constructor Functions create, initialize and close the DPPAPI. Opening the DPPAPI with OpenDppApi creates and initializes an instance of the DPPAPI. The DPPAPI instance manages and stores DPP data, configurations, and controls communication.

    Copyright (c)2005, 2007 Amptek, All Rights Reserved

    Developer Notes

    All other DPPAPI functions need the DPPAPI to be opened before being called. When all DPPAPI operations are completed and before the application is closed, the DPPAPI must be closed with CloseDppApi.

    DPPAPI Constructor Functions

  • CloseDppApi
  • OpenDppApi

    • DPPAPI Setup Notes

     Filename: DppApi.h

    Description

    Additional setup notes.

    Application programs invoke DPPAPI functions to establish DPP communications, control DPP operations, and retrieve spectrum data. The DPPAPI is distributed with an import library (.LIB), and a dynamic link library (.DLL) and a type library (.TLB).

    Applications can be developed with the DPPAPI in C, Visual Basic and many other programming languages.

    The C language representation of DPPAPI functions are defined in the DppApi.h header file. These files are provided with the DPPAPI libraries. The USB drivers provided with your Amptek DPP must be installed and the usbdrvd.dll must be accessible to the DPPAPI in order to function properly.

    Copyright (c)2005, 2007 Amptek, All Rights Reserved

    DPPAPI Setup Notes

    PX4 Text Functions

     Filename: DppApi.h

    Description

    Sets and reads text stored in the PX4.

    PX4 Text Functions works for PX4 with FPGA/Firmware Version 3.13 and above.

    Copyright (c)2005, 2007 Amptek, All Rights Reserved

    PX4 Text Functions

  • GetPX4Text
  • SetPX4Text

    • Status Indicator Functions

     Filename: DppApi.h

    Description

    Status Indicator Functions monitor and display DPP device information.

    Status information is read as a block of data and is converted into display values. Status information includes device identification, spectrum accumulation status, monitors, and boot status.

    Copyright (c)2005, 2007 Amptek, All Rights Reserved

    Status Indicator Functions

  • CreateMCAFileDPPSettings
  • DisplayStatusBuffer
  • GetStatusBuffer
  • GetStatusString
  • GetStatusStringFromBuffer
  • GetStatusStruct
  • GetStatusStructFromBuffer
  • ProcessStatusBuffer

    • USB Manager Functions

     Filename: DppApi.h

    Description

    USB Manager Functions provide USB device control.

    USB Manager Functions provide USB device control. All USB communications to the DPP require that the USB device be open for the corresponding DPP. When a USB device is opened with OpenUSBDevice communications are opened to the DPP. All USB functions are handled within the DPPAPI.

    Copyright (c)2005, 2007 Amptek, All Rights Reserved

    Developer Notes

    Once all USB operations are completed and before the DPPAPI is closed the USB device should be closed with CloseUSBDevice. The number of USB device connections can be monitored with MonitorUSBDppDevices. If a device has been disconnected, MonitorUSBDppDevices will indicate the number of devices has decreased and appropriate action can be taken.

    USB Manager Functions

  • CloseUSBDevice
  • GetUSBDppDeviceInfo
  • MonitorUSBDppDevices
  • OpenUSBDevice
  • OpenUSBDeviceEx

    • ClearDppData

     void __stdcall ClearDppData(void * objptr, BOOLEAN isBufferA)

    Clears the USB DPP spectrum data.

    Defined in: DppApi.h

    Parameters

    objptr
    Pointer to the DPPAPI.

    isBufferA
    Spectrum data buffer selector.

    CloseDppApi

     void __stdcall CloseDppApi(void * objptr)

    Closes the current instance of the DPPAPI.

    Defined in: DppApi.h

    Parameters

    objptr
    Pointer to the DPPAPI.

    CloseUSBDevice

     void __stdcall CloseUSBDevice(void * objptr)

    Closes the USB current device for communications.

    Defined in: DppApi.h

    Parameters

    objptr
    Pointer to the DPPAPI.

    CreateMCAFileDPPSettings

     void __stdcall CreateMCAFileDPPSettings(void * objptr, LPSTR pszSettings, LONG cSize)

    Creates a MCA acquisition file string that includes all configuration and status settings.

    Defined in: DppApi.h

    Parameters

    objptr
    Pointer to the DPPAPI.

    pszSettings
    DPP devices settings.

    cSize
    Character buffer size.

    Developer Notes

    This function formats the additional information for MCA spectrum file storage. This settings string is appended to the end of the DPP MCA spectrum file after the spectrum data section. This information is used by the Amptek acquisition software.

    DisplayStatusBuffer

     void __stdcall DisplayStatusBuffer(void * objptr, UCHAR Status[], LPSTR pszStatus, LONG cSize)

    Processes raw status data, stores the status data in the DPPAPI, and returns a status display string.

    Defined in: DppApi.h

    Parameters

    objptr
    Pointer to the DPPAPI.

    Status[]
    Status buffer.

    pszStatus
    Status character string.

    cSize
    Character buffer size.

    Developer Notes

    The raw status data is read from the DPP by calling GetStatusBuffer. DisplayStatusBuffer is used to update the DPPAPI to the current DPP status and request status display information.

    Get80MHzMode

     long __stdcall Get80MHzMode(void * objptr)

    Gets FPGA 80MHz Clock Mode for DP5 only, returns true if is a DP5 and in 80MHz Mode.

    Defined in: DppApi.h

    Parameters

    objptr
    Pointer to the DPPAPI.

    Developer Notes

    The FPGA 80MHz Clock Mode indicator is set when a DPP status command is issued and a DPP device is attached or when SetFPGAClockDefault sets this value. The DP5 FPGA 80MHz Clock Mode must be set to correctly interpret DP5 configuration file settings.

    Run GetStatusStruct or GetStatusString before running Get80MHzMode

    GetCoarseGainSpinFromText

     void __stdcall GetCoarseGainSpinFromText(void * objptr, byte * Spin, LPCSTR pszCoarseGain)

    Creates an up-down spin control value from a coarse gain display string.

    Defined in: DppApi.h

    Parameters

    objptr
    Pointer to the DPPAPI.

    Spin
    Up-down spin control setting.

    pszCoarseGain
    Coarse gain value string.

    GetCoarseGainTextFromSpin

     void __stdcall GetCoarseGainTextFromSpin(void * objptr, byte Spin, LPSTR pszCoarseGain, LONG cSize)

    Creates a coarse gain display string from a selected up-down spin control value.

    Defined in: DppApi.h

    Parameters

    objptr
    Pointer to the DPPAPI.

    Spin
    Up-down spin control setting.

    pszCoarseGain
    Coarse gain value string.

    cSize
    Character buffer size.

    GetConfigFromBuffer

     void __stdcall GetConfigFromBuffer(void * objptr)

    Loads the stored configuration read from the DPP (stored in a byte block) into the DPPAPI.

    Defined in: DppApi.h

    Parameters

    objptr
    Pointer to the DPPAPI. configuration buffer read from the dpp stored in a byte block the current device type (default is 1=DP4)

    GetConfigFromDpp

     void __stdcall GetConfigFromDpp(void * objptr)

    Loads the stored configuration from the DPP USB into the DPPAPI.

    Defined in: DppApi.h

    Parameters

    objptr
    Pointer to the DPPAPI.

    GetConfigFromFile

     void __stdcall GetConfigFromFile(void * objptr, LPCSTR pszFilename, LONG cSize, byte DPPDeviceType)

    Loads a configuration from a DPP configuration file into the DPPAPI.

    Defined in: DppApi.h

    Parameters

    objptr
    Pointer to the DPPAPI.

    pszFilename
    Dpp configuration filename.

    cSize
    Character buffer size.

    DPPDeviceType
    DPP Device Type

    Developer Notes

    DPP Device Type (1=DP4,2=PX4,3=DP5(DP4 Emulation),4=DP5(Px4 Emulation)) If no device type or an invalid device type is selected, DPPDeviceType defaults to PX4.

    GetConfigString

     void __stdcall GetConfigString(void * objptr, LPSTR pszConfig, LONG cSize)

    Creates display formatted copy of the current DPPAPI configuration.

    Defined in: DppApi.h

    Parameters

    objptr
    Pointer to the DPPAPI.

    pszConfig
    Configuration display string.

    cSize
    Character buffer size.

    GetDP5Text

     void __stdcall GetDP5Text(void * objptr, LPSTR pszDP5Text, LONG cSize)

    Gets the DP5 stored text.

    Defined in: DppApi.h

    Parameters

    objptr
    Pointer to the DPPAPI.

    pszDP5Text
    DP5 text string.

    cSize
    Character buffer size.

    GetDppData

     int __stdcall GetDppData(void * objptr, long DataBuffer[])

    Get the USB DPP spectrum data.

    Defined in: DppApi.h

    Return Value

    Returns the number of spectrum channels.

    Parameters

    objptr
    Pointer to the DPPAPI.

    DataBuffer[]
    Holds the DPP spectrum data.

    GetOutputOffsetSpinFromText

     void __stdcall GetOutputOffsetSpinFromText(void * objptr, byte * Spin, LPCSTR pszOffset)

    Creates an up-down spin control value from an output offset display string.

    Defined in: DppApi.h

    Parameters

    objptr
    Pointer to the DPPAPI.

    Spin
    Up-down spin control setting.

    pszOffset
    Output offset value string.

    GetOutputOffsetTextFromSpin

     void __stdcall GetOutputOffsetTextFromSpin(void * objptr, byte Spin, LPSTR pszOffset, LONG cSize)

    Creates an output offset display string from a selected up-down spin control value.

    Defined in: DppApi.h

    Parameters

    objptr
    Pointer to the DPPAPI.

    Spin
    Up-down spin control setting.

    pszOffset
    Output offset value string.

    cSize
    Character buffer size.

    GetPresetTimeStringFromVal

     void __stdcall GetPresetTimeStringFromVal(void * objptr, long lPresetTime, LPSTR pszPresetTime, LONG cSize)

    Creates a preset time display string from a preset time value.

    Defined in: DppApi.h

    Parameters

    objptr
    Pointer to the DPPAPI.

    lPresetTime
    Preset time in tenths of a second.

    pszPresetTime
    Preset time display string.

    cSize
    Character buffer size.

    GetPresetTimeValFromString

     void __stdcall GetPresetTimeValFromString(void * objptr, long * lPresetTime, LPCSTR pszPresetTime)

    Calculates a preset time value from a preset time display string.

    Defined in: DppApi.h

    Parameters

    objptr
    Pointer to the DPPAPI.

    lPresetTime
    Preset time in tenths of a second.

    pszPresetTime
    Preset time display string.

    GetPX4Text

     void __stdcall GetPX4Text(void * objptr, LPSTR pszPX4Text, LONG cSize)

    Gets the PX4 stored text.

    Defined in: DppApi.h

    Parameters

    objptr
    Pointer to the DPPAPI.

    pszPX4Text
    PX4 text string.

    cSize
    Character buffer size.

    GetSlowThreshSpinFromChannel

     void __stdcall GetSlowThreshSpinFromChannel(void * objptr, double dblChannel, byte * Spin)

    Calculates the up-down spin control value for a given slow threshold channel value.

    Defined in: DppApi.h

    Parameters

    objptr
    Pointer to the DPPAPI.

    dblChannel
    Slow threshold spectrum channel.

    Spin
    Up-down spin control setting.

    GetSlowThreshSpinFromPercent

     void __stdcall GetSlowThreshSpinFromPercent(void * objptr, double dblPercent, byte * Spin)

    Calculates the up-down spin control value for a given slow threshold percent value.

    Defined in: DppApi.h

    Parameters

    objptr
    Pointer to the DPPAPI.

    dblPercent
    Slow threshold percent of full energy scale.

    Spin
    Up-down spin control setting.

    GetSlowThreshStringsFromSpin

     void __stdcall GetSlowThreshStringsFromSpin(void * objptr, byte Spin, LPSTR pszPercent, LONG cSizePer, LPSTR pszChannels, LONG cSizeChan)

    Creates slow threshold percent and channel display strings from an up-down spin control value.

    Defined in: DppApi.h

    Parameters

    objptr
    Pointer to the DPPAPI.

    Spin
    Up-down spin control setting.

    pszPercent
    Slow threshold percent display string.

    cSizePer
    Size of the percent character buffer.

    pszChannels
    Slow threshold channel position display string.

    cSizeChan
    Size of the channel character buffer.

    GetStatusBuffer

     void __stdcall GetStatusBuffer(void * objptr, BOOLEAN isBufferA, UCHAR Status[])

    Requests the current DPP device and spectrum status raw data.

    Defined in: DppApi.h

    Parameters

    objptr
    Pointer to the DPPAPI.

    isBufferA
    Spectrum data buffer selector.

    Status[]
    Status buffer.

    Developer Notes

    A spectrum buffer (A or B) is selected to determine which group of Spectrum Accumulation Status information to return.

    GetStatusString

     void __stdcall GetStatusString(void * objptr, BOOLEAN isBufferA, LPSTR pszStatus, LONG cSize)

    Gets a copy of the current status and stores the data in a string.

    Defined in: DppApi.h

    Parameters

    objptr
    Pointer to the DPPAPI.

    isBufferA
    Spectrum data buffer selector.

    pszStatus
    Status character string.

    cSize
    Character buffer size.

    Developer Notes

    A spectrum buffer (A or B) is selected to determine which group of Spectrum Accumulation Status information to return.

    GetStatusStringFromBuffer

     void __stdcall GetStatusStringFromBuffer(void * objptr, BOOLEAN isBufferA, LPSTR pszStatus, LONG cSize, UCHAR Status[])

    Gets a copy of the current status and stores the data in a string.

    Defined in: DppApi.h

    Parameters

    objptr
    Pointer to the DPPAPI.

    isBufferA
    Spectrum data buffer selector.

    pszStatus
    Status character string.

    cSize
    Character buffer size.

    Status[]
    Status buffer.

    Developer Notes

    A spectrum buffer (A or B) is selected to determine which group of Spectrum Accumulation Status information to return.

    GetStatusStruct

     void __stdcall GetStatusStruct(void * objptr, BOOLEAN isBufferA, DPP_STATUS * StatusStruct)

    Returns the current DPP device and spectrum status data in a status structure.

    Defined in: DppApi.h

    Parameters

    objptr
    Pointer to the DPPAPI.

    isBufferA
    Spectrum data buffer selector.

    StatusStruct
    Status structure.

    Developer Notes

    A spectrum buffer (A or B) is selected to determine which group of Spectrum Accumulation Status information to return.

    GetStatusStructFromBuffer

     void __stdcall GetStatusStructFromBuffer(void * objptr, BOOLEAN isBufferA, DPP_STATUS * StatusStruct, UCHAR Status[])

    Returns the current DPP device and spectrum status data in a status structure.

    Defined in: DppApi.h

    Parameters

    objptr
    Pointer to the DPPAPI.

    isBufferA
    Spectrum data buffer selector.

    StatusStruct
    Status structure.

    Status[]
    Status buffer.

    Developer Notes

    A spectrum buffer (A or B) is selected to determine which group of Spectrum Accumulation Status information to return.

    GetTempConfigSettings

     void __stdcall GetTempConfigSettings(void * objptr, DPP_CONFIG_SETTINGS * CfgSet, BOOLEAN CurrentUpdate)

    Copies selected configuration to a DPP_CONFIG_SETTINGS structure.

    Defined in: DppApi.h

    Parameters

    objptr
    Pointer to the DPPAPI.

    CfgSet
    Configuration settings.

    CurrentUpdate
    Current settings update.

    Developer Notes

    If UpdateCurrent is selected, the configuration is copied from the current DPPAPI configuration settings. If UpdateCurrent is not selected, the last temporary configuration storage is used.

    GetTempConfigString

     void __stdcall GetTempConfigString(void * objptr, LPSTR pszConfig, LONG cSize)

    Creates a display formatted copy of the temporary DPPAPI configuration.

    Defined in: DppApi.h

    Parameters

    objptr
    Pointer to the DPPAPI.

    pszConfig
    Configuration display string.

    cSize
    Character buffer size.

    GetTimeToPeakDecimationFromSpin

     void __stdcall GetTimeToPeakDecimationFromSpin(void * objptr, byte * TimeToPeak, byte * Decimation, byte Spin)

    Calculates the time-to-peak and decimation values from an up-down spin control value.

    Defined in: DppApi.h

    Parameters

    objptr
    Pointer to the DPPAPI.

    TimeToPeak
    Time-to-peak value.

    Decimation
    Decimation value.

    Spin
    Up-down spin control setting.

    GetTimeToPeakSpinFromValues

     void __stdcall GetTimeToPeakSpinFromValues(void * objptr, byte TimeToPeak, byte Decimation, byte * Spin)

    Converts a time-to-peak value to an up-down spin control setting.

    Defined in: DppApi.h

    Parameters

    objptr
    Pointer to the DPPAPI.

    TimeToPeak
    Time-to-peak value.

    Decimation
    Decimation value.

    Spin
    Up-down spin control setting.

    Developer Notes

    When a time-to-peak value is known it may be necessary to remotely set an up-down spin control. GetTimeToPeakSpinFromValues uses a time-to-peak value a known decimation value to calculate the correct control setting.

    GetUSBDppDeviceInfo

     int __stdcall GetUSBDppDeviceInfo(void * objptr, long Device, long * lSerialNumber)

    Get device information (serial number and type) for the selected usb device.

    Defined in: DppApi.h

    Return Value

    Returns the type Amptek USB device detected.

    Amptek DPP USB devices

    DPPNONE = 0x0 // none

    DPPDP4 = 0x1 // DP4

    DPPPX4 = 0x2 // PX4

    DPPDP4EMUL = 0x3 // DP5 with DP4 Emulation

    DPPPX4EMUL = 0x4 // DP5 with PX4 Emulation (Same as DPPDP5)

    DPPDP5 = 0x4 // DP5 with PX4 Emulation

    Parameters

    objptr
    Pointer to the DPPAPI.

    Device
    selected USB DPP device

    lSerialNumber
    serial number of device

    MonitorUSBDppDevices

     int __stdcall MonitorUSBDppDevices(void * objptr)

    Monitors the USB current device to determine if connected and communicating.

    Defined in: DppApi.h

    Return Value

    Returns the number of Amptek USB devices detected.

    Parameters

    objptr
    Pointer to the DPPAPI.

    OpenDppApi

     void * __stdcall OpenDppApi(void)

    Creates and initializes an instance of the DPPAPI.

    Defined in: DppApi.h

    Return Value

    Returns an object pointer handle to the DPPAPI.

    OpenUSBDevice

     int __stdcall OpenUSBDevice(void * objptr)

    Opens the USB current device for communications.

    Defined in: DppApi.h

    Return Value

    Returns the number of Amptek USB devices detected.

    Parameters

    objptr
    Pointer to the DPPAPI.

    OpenUSBDeviceEx

     int __stdcall OpenUSBDeviceEx(void * objptr, long Device)

    Opens the USB selected device for communications.

    Defined in: DppApi.h

    Return Value

    Returns the number of Amptek USB devices detected.

    Parameters

    objptr
    Pointer to the DPPAPI.

    Device
    selected USB DPP device

    PauseDppData

     void __stdcall PauseDppData(void * objptr, BOOLEAN boolPauseData)

    Pauses the USB DPP spectrum data.

    Defined in: DppApi.h

    Parameters

    objptr
    Pointer to the DPPAPI.

    boolPauseData
    Pause the spectrum data.

    ProcessDppData

     int __stdcall ProcessDppData(void * objptr, long DataBuffer[], UCHAR RawData[], UINT ByteCount)

    Process the USB DPP spectrum data.

    Defined in: DppApi.h

    Return Value

    Returns the number of spectrum channels.

    Parameters

    objptr
    Pointer to the DPPAPI.

    DataBuffer[]
    Holds the DPP spectrum data.

    RawData[]
    Holds pre-processed spectra data.

    ByteCount
    Holds pre-processed spectra data byte count.

    ProcessStatusBuffer

     void __stdcall ProcessStatusBuffer(void * objptr, UCHAR Status[])

    Processes raw status data and stores the status data in the DPPAPI.

    Defined in: DppApi.h

    Parameters

    objptr
    Pointer to the DPPAPI.

    Status[]
    Status buffer.

    Developer Notes

    The raw status data is read from the DPP by calling GetStatusBuffer. ProcessStatusBuffer is used to update the DPPAPI to the current DPP status without requesting status display information.

    SaveConfigToFile

     void __stdcall SaveConfigToFile(void * objptr, LPCSTR pszFilename, LONG cSize)

    Sends the current configuration from the DPPAPI to a DPP configuration file.

    Defined in: DppApi.h

    Parameters

    objptr
    Pointer to the DPPAPI.

    pszFilename
    Dpp configuration filename.

    cSize
    Character buffer size.

    SendConfigToBuffer

     void __stdcall SendConfigToBuffer(void * objptr)

    Sends the current configuration from the DPPAPI to a configuration buffer.

    Defined in: DppApi.h

    Parameters

    objptr
    Pointer to the DPPAPI. dppapi configuration stored in a byte block preset setting

    SendConfigToDpp

     void __stdcall SendConfigToDpp(void * objptr)

    Sends the current configuration from the DPPAPI to the DPP USB.

    Defined in: DppApi.h

    Parameters

    objptr
    Pointer to the DPPAPI.

    SendDppVendorRequest

     void __stdcall SendDppVendorRequest(void * objptr, int Request, int Value)

    Sends a generic DPP Vendor Request to the default usb device.

    Defined in: DppApi.h

    Parameters

    objptr
    Pointer to the DPPAPI.

    Request
    Vendor request.

    Value
    Vendor request value.

    Developer Notes

    The function SendDppVendorRequest is determined by the Request parameter. See DP4/PX4/DP5 user manuals for Vendor Request function details.

    Boot Option Vendor Requests:

    BootOptSetBootFlags = 0x92 //Set DP5 boot options

    BootOptSetPC5HV = 0x93 //Set PC5 HV

    BootOptPC5TECTemp = 0x94 //Set PC5 TEC temperature

    BootOptDP5InputOffset = 0x95 //Set DP5 input offset

    BootOptSetDP5uCtrADC = 0x96 //Set DP5 microcontroller ADC/Temperature calibration (RESERVED)

    BootOptSetDP5SpectrumOffset = 0x97 //Set DP5 spectrum offset

    SetDP5Text

     void __stdcall SetDP5Text(void * objptr, LPCSTR pszDP5Text)

    Sets the DP5 stored text.

    Defined in: DppApi.h

    Parameters

    objptr
    Pointer to the DPPAPI.

    pszDP5Text
    DP5 text string.

    SetFPGAClockDefault

     void __stdcall SetFPGAClockDefault(void * objptr, BOOLEAN b80MHzMode, byte DPPDeviceType)

    Sets FPGA 80MHz Clock Mode indicator for DP5 only

    Defined in: DppApi.h

    Parameters

    objptr
    Pointer to the DPPAPI.

    b80MHzMode
    80MHz Mode indicator.

    DPPDeviceType
    DPP Device Type.

    Developer Notes

    The DP5 FPGA 80MHz Clock Mode indicator must be set to correctly interpret DP5 configuration file settings. The FPGA 80MHz Clock indicator is set when a DPP status command is issued and a DPP device is attached or when SetFPGAClockDefault sets this value. SetFPGAClockDefault is needed when editing DP5 configuration files without a DP5 device.

    SetPX4Text

     void __stdcall SetPX4Text(void * objptr, LPCSTR pszPX4Text)

    Sets the PX4 stored text.

    Defined in: DppApi.h

    Parameters

    objptr
    Pointer to the DPPAPI.

    pszPX4Text
    PX4 text string.

    SetTempConfigSettings

     void __stdcall SetTempConfigSettings(void * objptr, DPP_CONFIG_SETTINGS * CfgSet, BOOLEAN CurrentUpdate)

    Copies the selected settings from a DPP_CONFIG_SETTINGS data structure.

    Defined in: DppApi.h

    Parameters

    objptr
    Pointer to the DPPAPI.

    CfgSet
    Configuration settings.

    CurrentUpdate
    Current settings update.

    Developer Notes

    If UpdateCurrent is selected, the temporary configuration is also copied to the current DPPAPI configuration settings. Current DPPAPI configuration settings can be used to configure the DPP or be saved to a configuration file for storage.

    TuneFastThreshold

     void __stdcall TuneFastThreshold(void * objptr)

    Tunes the fast threshold.

    Defined in: DppApi.h

    Parameters

    objptr
    Pointer to the DPPAPI.

    Developer Notes

    The source must be removed before tuning the fast threshold.

    The status flag SetFastThreshDone is set (=TRUE) if the fast threshold tuning was successful. If the fast threshold tuning was successful, the configuration must be read back using GetConfigFromDpp to update the DppApi copy of the configuration.

    TuneInputOffset

     void __stdcall TuneInputOffset(void * objptr)

    Tunes the input offset. (PX4/DP5 only.)

    Defined in: DppApi.h

    Parameters

    objptr
    Pointer to the DPPAPI.

    Developer Notes

    Input Offset MUST be properly set before running TuneInputOffset. The initial input offset setting is based on the current input polarity and polezero configuration settings. The TuneInputOffsetInit function checks these values and sets the initial input offset value.

    The status flag SetInputOffsetDone is set (=TRUE) if the input offset tuning was successful. If the input offset tuning was successful, the configuration must be read back using GetConfigFromDpp to update the DppApi copy of the configuration.

    (See the DppApi Reference and the PX4/DP5 Hardware Description for details.)

    Possible input offset tune start settings:

    SET TO -2.048V (= 0000) IF THE Input Polarity is NEGATIVE(-) and PoleZero > 0

    SET TO -0.100V (= 1948) IF THE Input Polarity is NEGATIVE(-) and PoleZero = 0

    SET TO +0.100V (= 2148) IF THE Input Polarity is POSITIVE(+) and PoleZero = 0

    SET TO +2.042V (= 4090) IF THE Input Polarity is POSITIVE(+) and PoleZero > 0

    TuneInputOffsetInit

     void __stdcall TuneInputOffsetInit(void * objptr)

    Sets initial values for PX4 input offset tuning. (PX4 only.)

    Defined in: DppApi.h

    Parameters

    objptr
    Pointer to the DPPAPI.

    DPP_BOOT_STATUS structure

    struct {
    USHORT BootFlags;
    USHORT HVDACSet;
    USHORT TECDACSet;
    USHORT InputOffsetTuning;
    USHORT uCTempCal;
    USHORT SpectrumOffset;
} DPP_BOOT_STATUS;
    DPP Boot Options Status Storage Type

    Defined in: DppApi.h

    Members

    BootFlags
    Boot flags (MSB currently unused)
    HVDACSet
    HV DAC setting (not used in PX4 mode)
    TECDACSet
    TEC DAC setting (not used in PX4 mode)
    InputOffsetTuning
    Input offset DAC setting (not used in PX4 mode)
    uCTempCal
    uC temp cal
    SpectrumOffset
    Spectrum offset

    DPP_CONFIG_SETTINGS structure

    struct {
    byte AcqMode;
    byte MCSTimebase;
    byte MCAChannels;
    byte BufferSelect;
    byte TTLGate;
    byte SlowThreshold;
    long PresetTime;
    long PresetCount;
    long SCA[8];
    byte TimeToPeak;
    byte Decimation;
    byte FlatTop;
    byte PUREnable;
    byte FastThreshold;
    byte RTDSlow;
    byte RTDOn;
    byte RTDFast;
    byte BLR;
    byte BaselineOn;
    byte CoarseGain;
    long FineGain;
    long PoleZero;
    long InputOffset;
    byte InputPolarity;
    byte DetReset;
    long TEC;
    byte HVEnabled;
    long HV;
    byte PreampPower;
    byte AnalogOut;
    byte OutputOffset;
    byte AuxOut;
    byte AudibleCounter;
} DPP_CONFIG_SETTINGS;
    DPP Configuration Settings Storage Type

    Defined in: DppApi.h

    Members

    AcqMode
    acquisition mode 0=MCA,1=MCS
    MCSTimebase
    MCS timebase value (0-15) see CAcqMode
    MCAChannels
    number of channels 4=256,3=512,2=1024,1=2048,0=4096,5=8192
    BufferSelect
    Holds Buffer Sel A&B,Buffer Sel Hardware,see DPPBufferSelect
    TTLGate
    gate input settings, determines events included/excluded from spectrum, see DPPGate
    SlowThreshold
    Slow ch threshold, Events w/amp lower not added to spectrum
    PresetTime
    var holds preset time, used in usb
    PresetCount
    preset count in selected channels, ch are set in SCA8
    SCA[8]
    SCA values, LL, UL, and Enable are stored together
    TimeToPeak
    TimeToPeak register setting
    Decimation
    decimation setting for pulse shaping
    FlatTop
    flatop register setting
    PUREnable
    pile-up rejection enabled
    FastThreshold
    Fast Ch Threshold, events w/fch amp below this are rejected
    RTDSlow
    Risetime Discrimination slow threshold
    RTDOn
    Turns RTD on, and sets the amplitude and timing thresholds
    RTDFast
    RTD Time Threshold,Events w/HWHM wider than this are rejected
    BLR
    Baseline Restoration, see udBLR.Value notes for values
    BaselineOn
    use autobaseline during detector reset
    CoarseGain
    stores current coarse gain value
    FineGain
    stores current fine gain value
    PoleZero
    pole zero adjust value
    InputOffset
    input offset
    InputPolarity
    use InvertEnable during detector reset
    DetReset
    detector reset lockout period
    TEC
    TEC temperature setting (displayed in Kelvin)
    HVEnabled
    high voltage setting enable
    HV
    high voltage setting value
    PreampPower
    preamp power select value (5v or 8.5v)
    AnalogOut
    dac enabled and DAC output type,(stobed peak,shaped pulse,dec inp,fast ch)
    OutputOffset
    Output DAC offset, -64…+63,(signed)(D7-D1) (-500mV to +492mV)
    AuxOut
    Aux output type
    AudibleCounter
    audio volume setting

    DPP_STATUS structure

    struct {
    double FPGA;
    double Firmware;
    double SerialNumber;
    byte StatDevInd;
    byte BootStatus;
    byte PwrBtnConfig;
    byte SwConfigRcvd;
    byte SetFastThreshDone;
    byte SetSlowThreshDone;
    byte SetInputOffsetDone;
    double BoardTemp;
    double HVMonitor;
    double TECMonitor;
    double FastCount;
    double SlowCount;
    double AccumulationTime;
    byte StatMcaEnabled;
    byte MCSDone;
    byte PresetCountExpired;
} DPP_STATUS;
    DPP Status Storage Type

    Defined in: DppApi.h

    Members

    FPGA
    FPGA
    Firmware
    firmware revision
    SerialNumber
    unit serial number
    StatDevInd
    device indicator from status block (0=dp4,1=px4)
    BootStatus
    boot status byte (PwrBtnConfig,SwConfigRcvd,McaEnabled)
    PwrBtnConfig
    dpp has loaded config from power button
    SwConfigRcvd
    software has sent valid config to unit since startup
    SetFastThreshDone
    DPP tune fast thresh has successfully done
    SetSlowThreshDone
    DPP tune slow thresh has successfully done (NOT USED)
    SetInputOffsetDone
    DPP tune input offset has successfully done
    BoardTemp
    board temperature monitor value
    HVMonitor
    high voltage monitor value
    TECMonitor
    TEC temperature monitor value (displayed in Kelvin)
    FastCount
    fast channel count
    SlowCount
    slow channel count
    AccumulationTime
    real time duration of present data acquisition interval
    StatMcaEnabled
    mca enabled status, high during acq, preset time resets flag
    MCSDone
    MCS done flag 1=finished, 0=not finished
    PresetCountExpired
    indicates presets counts have been reached


DPP FAQ

NOTE: DPP = DP4, PX4, DP5, GammaRAD, X123, X123-SDD

HOW DO I?
---------
1. Q. I just got a DPP.  How do I get a spectrum from my DPP.
   A. Consult your QUICK START GUIDE included with your unit.

2. Q. My unit is acquiring and I know if I'm getting pulses.  I am viewing
      "Shaped Pulse" with the Amptek Digital Oscilloscope, but I am not
      seeing any shaped pulses.  How can I see the shaped pulses.
   A. Check the fast threshold.  The fast threshold must be set properly
      to view the shaped pulse on the digital oscilloscope.

3. Q. I saved a custom configuration for my DPP unit.  Can I directly access
      my custom configuration from the "DPP Properties - General Tab"?
   A. The "Open Predefined Configuration File" opens and loads a configuration
      from a selected file.

4. Q. Can I directly access my custom configuration from the
      Detector Configuration ComboBox?
   A. Yes, but first the software must be configured.
      This is only recommended if you understand the ".INI" file format.
      0. ---> BACKUP THE AmptekDC.ini FILE BEFORE PROCEEDING. <---
      1. Copy your custom configuration to the "\DET_CFG" sub-directory.
      2. Find the AmptekDC.ini file in the same directory as ADMCA.exe.
      3. Open the AmptekDC.ini file with a text editor.
      4. Find the [Amptek Detector Configurations] section.
      5. Add your configuration description and file location.
             NOTE: The format is DESCRIPTION=DET_CFG_FILE_PATH

         Example:
             DESCRIPTION: My Custom Configuration
             DET_CFG_FILE_PATH: MyCustCfg.cfg
         Add to AmptekDC.ini:
             My Custom Configuration=DET_CFG\MyCustCfg.cfg

5. Q. I am running in DPP MCS mode, I know my unit is acquiring
      in MCA mode.  I am not getting any MCS counts.
   A. Check and set SCA8.  The energy channels must be set in
      SCA8.  SCA8 must also be enabled for MCS to run.

6. Q. I am acquiring a spectrum and I press the "TUNE" button on the
      toolbar.  Why doesn't the slow and fast thresholds set properly?
   A. The source MUST be removed to "auto" tune the thresholds.


DPP TROUBLE SHOOTING HINTS

TROUBLE SHOOTING HINTS
----------------------

NOTE: DPP = DP4, PX4, DP5, GammaRAD, X123, X123-SDD

Suggestion: Always wait 10 seconds after power up for detector setup to stabilize before running acquisitions.

The DPP has been previously configured and the configuration doesn't seem to work after power up:
- First, try the DPPCFG button on the toolbar.
- Second, if DPPCFG doesn't work, press the CONNECT button, once connected press DPPCFG.
- Third, check if the unit is connected and the configuration can be read.

If the DPP seems to be working and the USB communications doesn't:
- Close the acquisition software.
- Unplug the USB cable from the unit.
- Wait a few seconds then plug the USB cable back in.

The digital oscilloscope (DPP) is not displaying the shaped pulse.
- The digital oscilloscope is not triggering on the shaped pulse edges.
- The fast threshold must be set correctly for the (DPP) oscilloscope to trigger properly.


Additional Documentation

Amptek Installation CD Additional Documents

DP4/PC4
  • Amptek Installation CD\DP4 Quick Start Guide A1.pdf
  • Amptek Installation CD\DP4 User Manual D4.pdf
  • Amptek Installation CD\PC4 Interface Boards Rev A4.pdf
  • Amptek Installation CD\Additional DPP Software\DP4 Programmer's Guide B1.pdf
  • Amptek Installation CD\Additional DPP Software\Grounding and Shielding the DP4 Product Family.pdf
PX4
  • Amptek Installation CD\PX4 FAQ.pdf
  • Amptek Installation CD\PX4 Quick Start Guide B2.pdf
  • Amptek Installation CD\PX4 User's Manual Rev A1.pdf
  • Amptek Installation CD\Additional DPP Software\PX4 Programmer's Guide Rev B2.pdf
DP5/PC5
  • Amptek Installation CD\DP5 Product Changes B4.pdf
  • Amptek Installation CD\DP5 Quick Start Guide A0.pdf
  • Amptek Installation CD\PC5 User's Manual Rev A0.pdf
Gamma-Rad
  • Amptek Installation CD\Gamma-Rad Quick Start Guide A0.pdf
X-123/X-123SDD/XR-100SDD
  • Amptek Installation CD\X-123 Quick Start Guide A1.pdf
  • Amptek Installation CD\X-123SDD Quick Start Guide A1.pdf
  • Amptek Installation CD\XR-100SDD with PX4 Quick Start Guide A0.pdf
General Infomation
  • Amptek Installation CD\Digital Processor FAQ.pdf
  • Amptek Installation CD\Glossary.pdf
  • Amptek Installation CD\Additional DPP Software\PX4 DP4 USB speed.pdf
  • Amptek Installation CD\Additional DPP Software\Dead Time in the DP4 and PX4.pdf


ADMCA DPPAPI Configuration File Format

Amptek ADMCA/DppApi Configuration File Format

for

DP4/PX4/DP5 DPP Devices

5/5/2009

Line # | Setting | Value | Meaning |  |  |  |
1 | Peaking Time (Tp) | 0 | 0 .8uS |  |  |  |
 |  | 1 | 1.6uS |  |  |  |
 |  | 2 | 2.4uS |  |  |  |
 |  | 3 | 3.2uS |  |  |  |
 |  | 4 | 4uS |  |  |  |
 |  | 5 | 4.8uS |  |  |  |
 |  | 6 | 5.6uS |  |  |  |
 |  | 7 | 6.4uS |  |  |  |
 |  | 8 | 8uS |  |  |  |
 |  | 9 | 9.6uS |  |  |  |
 |  | 10 | 11.2uS |  |  |  |
 |  | 11 | 12.8uS |  |  |  |
 |  | 12 | 16uS |  |  |  |
 |  | 13 | 19.2uS |  |  |  |
 |  | 14 | 22.4uS |  |  |  |
 |  | 15 | 25.6uS |  |  |  |
 |  | 16 | 32uS |  |  |  |
 |  | 17 | 38.4uS |  |  |  |
 |  | 18 | 44.8uS |  |  |  |
 |  | 19 | 51.2uS |  |  |  |
 |  | 20 | 64uS |  |  |  |
 |  | 21 | 76.8uS |  |  |  |
 |  | 22 | 89.6uS |  |  |  |
 |  | 23 | 102.4uS |  |  |  |
 | Peaking Time (Tp) (DP5 80MHz FPGA) | 0 | 0.2uS |  |  |  |
 |  | 1 | 0.4uS |  |  |  |
 |  | 2 | 0.6uS |  |  |  |
 |  | 3 | 0.8uS |  |  |  |
 |  | 4 | 1.0uS |  |  |  |
 |  | 5 | 1.2uS |  |  |  |
 |  | 6 | 1.4uS |  |  |  |
 |  | 7 | 1.6uS |  |  |  |
 |  | 8 | 2.0uS |  |  |  |
 |  | 9 | 2.4uS |  |  |  |
 |  | 10 | 2.8uS |  |  |  |
 |  | 11 | 3.2uS |  |  |  |
 |  | 12 | 4.0uS |  |  |  |
 |  | 13 | 4.8uS |  |  |  |
 |  | 14 | 5.6uS |  |  |  |
 |  | 15 | 6.4uS |  |  |  |
 |  | 16 | 8.0uS |  |  |  |
 |  | 17 | 9.6uS |  |  |  |
 |  | 18 | 11.2uS |  |  |  |
 |  | 19 | 12.8uS |  |  |  |
 |  | 20 | 16.0uS |  |  |  |
 |  | 21 | 19.2uS |  |  |  |
 |  | 22 | 22.4uS |  |  |  |
 |  | 23 | 25.6uS |  |  |  |
2 | Flat Top Width (Tf) |  | Tp=0...6.4uS | Tp=8...12.8uS | Tp=16…25.6uS | Tp=32…51.2uS | Tp=64…102.4uS
 |  | 0 | 0.2uS | 0.4uS | .8uS | 1.6uS | 3.2uS
 |  | 1 | 0.4uS | 0 .8uS | 1.6uS | 3.2uS | 6.4uS
 |  | 2 | 0.6uS | 1.2uS | 2.4uS | 4.8uS | 9.6uS
 |  | 3 | 0 .8uS | 1.6uS | 3.2uS | 6.4uS | 12.8uS
 |  | 4 | 1uS | 2uS | 4uS | 8uS | 16uS
 |  | 5 | 1.2uS | 2.4uS | 4.8uS | 9.6uS | 19.2uS
 |  | 6 | 1.4uS | 2.8uS | 5.6uS | 11.2uS | 22.4uS
 |  | 7 | 1.6uS | 3.2uS | 6.4uS | 12.8uS | 25.6uS
 |  | 8 | 1.8uS | 3.6uS | 7.2uS | 14.4uS | 28.8uS
 |  | 9 | 2uS | 4uS | 8uS | 16uS | 32uS
 |  | 10 | 2.2uS | 4.4uS | 8.8uS | 17.6uS | 35.2uS
 |  | 11 | 2.4uS | 4.8uS | 9.6uS | 19.2uS | 38.4uS
 |  | 12 | 2.6uS | 5.2uS | 10.4uS | 20.8uS | 41.6uS
 |  | 13 | 2.8uS | 5.6uS | 11.2uS | 22.4uS | 44.8uS
 |  | 14 | 3uS | 6uS | 12uS | 24uS | 48uS
 |  | 15 | 3.2uS | 6.4uS | 12.8uS | 25.6uS | 51.2uS
 | Flat Top Width (Tf) (DP5 80MHz FPGA) |  | Tp=0…1.6uS | Tp=2…3.2uS | Tp=4…6.4uS | Tp=8…12.8uS | Tp=16…25.6uS
 |  | 0 | 0.05uS | 0.1uS | 0.2uS | 0.4uS | 0.8uS
 |  | 1 | 0.10uS | 0.2uS | 0.4uS | 0.8uS | 1.6uS
 |  | 2 | 0.15uS | 0.3uS | 0.6uS | 1.2uS | 2.4uS
 |  | 3 | 0.20uS | 0.4uS | 0.8uS | 1.6uS | 3.2uS
 |  | 4 | 0.25uS | 0.5uS | 1.0uS | 2.0uS | 4.0uS
 |  | 5 | 0.30uS | 0.6uS | 1.2uS | 2.4uS | 4.8uS
 |  | 6 | 0.35uS | 0.7uS | 1.4uS | 2.8uS | 5.6uS
 |  | 7 | 0.40uS | 0.8uS | 1.6uS | 3.2uS | 6.4uS
 |  | 8 | 0.45uS | 0.9uS | 1.8uS | 3.6uS | 7.2uS
 |  | 9 | 0.50uS | 1.0uS | 2.0uS | 4.0uS | 8.0uS
 |  | 10 | 0.55uS | 1.1uS | 2.2uS | 4.4uS | 8.8uS
 |  | 11 | 0.60uS | 1.2uS | 2.4uS | 4.8uS | 9.6uS
 |  | 12 | 0.65uS | 1.3uS | 2.6uS | 5.2uS | 10.4uS
 |  | 13 | 0.70uS | 1.4uS | 2.8uS | 5.6uS | 11.2uS
 |  | 14 | 0.75uS | 1.5uS | 3.0uS | 6.0uS | 12.0uS
 |  | 15 | 0.80uS | 1.6uS | 3.2uS | 6.4uS | 12.8uS
3 | Slow Threshold | 0-250 | (Setting * 100/1024) = % of full scale |  |  |  |
4 | Fast Threshold | 0-250 |  |  |  |  |
5 | Output (DAC) Offset | 0-125 | If setting < 64: | (Setting/128*1000) mV |  |  |
 |  |  | If setting >= 64: | ((Setting-128)/128*1000) mV |  |  |
6 | PUR (Pileup Reject) | PUROn | Pileup reject enabled |  |  |  |
 |  | PUROff | Pileup reject disabled |  |  |  |
7 | Detector Reset Lockout | 0 | 13.1mS |  |  |  |
 |  | 1 | 6.55mS |  |  |  |
 |  | 2 | 3.28mS |  |  |  |
 |  | 3 | 1.64mS |  |  |  |
 |  | 4 | 819uS |  |  |  |
 |  | 5 | 410uS |  |  |  |
 |  | 6 | 205uS |  |  |  |
 |  | 7 | 102uS |  |  |  |
 |  | 8 | disabled |  |  |  |
 | Detector Reset Lockout (DP5 80MHz FPGA) | 0 | 3.28mS |  |  |  |
 |  | 1 | 1.64mS |  |  |  |
 |  | 2 | 819uS |  |  |  |
 |  | 3 | 410uS |  |  |  |
 |  | 4 | 205uS |  |  |  |
 |  | 5 | 102uS |  |  |  |
 |  | 6 | 51.2uS |  |  |  |
 |  | 7 | 25.6uS |  |  |  |
 |  | 8 | disabled |  |  |  |
8 | Analog Out (Output DAC) selection | DAC1 | Fast channel |  |  |  |
 |  | DAC2 | Shaped |  |  |  |
 |  | DAC3 | Decimated input |  |  |  |
 |  | DAC4 | Test pulser |  |  |  |
 |  | DAC5 | Off |  |  |  |
9 | MCA Channels | MCA256 | 256 channels |  |  |  |
 |  | MCA512 | 512 channels |  |  |  |
 |  | MCA1024 | 1024 channels |  |  |  |
 |  | MCA2048 | 2048 channels |  |  |  |
 |  | MCA4096 | 4096 channels |  |  |  |
 |  | MCA8192 | 8192 channels |  |  |  |
10 | Com Port (Interface) | USB or "0" | (Ethernet,Serial not supported by this file format) |  |  |  |
11 | RTD Enable | RTDOn | RTD enabled |  |  |  |
 |  | RTDOff | RTD disabled |  |  |  |
12 | RTD Slow threshold (DP4/PX4) | 0-250 | (Setting*100/512) % full scale |  |  |  |
 | RTD Ratio (DP5) | 0-250 | Setting/64 |  |  |  |
13 | RTD Fast (HWHM) Threshold (DP4/PX4) | 4-19 | # of clocks |  |  |  |
 | RTD Slow threshold (DP5) |  | ((Setting-4)*16/512 )*100 % full scale |  |  |  |
14 | Coarse Gain (DP4) | 0 | Coarse gain = 11x |  |  |  |
 |  | 1 | Coarse gain = 21x |  |  |  |
 |  | 2 | Coarse gain = 55x |  |  |  |
 |  | 3 | Coarse gain = 106x |  |  |  |
 | Coarse Gain (PX4) | 0-27 | Coarse gain = 4 * (1.2^(setting)) |  |  |  |
 | Coarse Gain (DP5 PX4-Emulation) | 0 | 1.00x |  |  |  |
 |  | 1 | 2.22x |  |  |  |
 |  | 2 | 3.78x |  |  |  |
 |  | 3 | 5.26x |  |  |  |
 |  | 4 | 6.56x |  |  |  |
 |  | 5 | 8.39x |  |  |  |
 |  | 6 | 10.1x |  |  |  |
 |  | 7 | 11.31x |  |  |  |
 |  | 8 | 14.56x |  |  |  |
 |  | 9 | 17.77x |  |  |  |
 |  | 10 | 22.42x |  |  |  |
 |  | 11 | 30.83x |  |  |  |
 |  | 12 | 38.18x |  |  |  |
 |  | 13 | 47.47x |  |  |  |
 |  | 14 | 66.26x |  |  |  |
 |  | 15 | 102.01x |  |  |  |
15 | Auto Baseline (Obsolete) | AutoBaselineOff |  |  |  |  |
16 | BLR | 63 | BLR:OFF |  |  |  |
 |  | 64 | BLR:ON DOWN:1:VERY SLOW UP:1:VERY SLOW |  |  |  |
 |  | 68 | BLR:ON DOWN:1:VERY SLOW UP:4:SLOW |  |  |  |
 |  | 72 | BLR:ON DOWN:1:VERY SLOW UP:16:MEDIUM |  |  |  |
 |  | 76 | BLR:ON DOWN:1:VERY SLOW UP:64:FAST |  |  |  |
 |  | 80 | BLR:ON DOWN:4:SLOW UP:1:VERY SLOW |  |  |  |
 |  | 84 | BLR:ON DOWN:4:SLOW UP:4:SLOW |  |  |  |
 |  | 88 | BLR:ON DOWN:4:SLOW UP:16:MEDIUM |  |  |  |
 |  | 92 | BLR:ON DOWN:4:SLOW UP:64:FAST |  |  |  |
 |  | 96 | BLR:ON DOWN:16:MEDIUM UP:1:VERY SLOW |  |  |  |
 |  | 100 | BLR:ON DOWN:16:MEDIUM UP:4:SLOW |  |  |  |
 |  | 104 | BLR:ON DOWN:16:MEDIUM UP:16:MEDIUM |  |  |  |
 |  | 108 | BLR:ON DOWN:16:MEDIUM UP:64:FAST |  |  |  |
 |  | 112 | BLR:ON DOWN:64:FAST UP:1:VERY SLOW |  |  |  |
 |  | 116 | BLR:ON DOWN:64:FAST UP:4:SLOW |  |  |  |
 |  | 120 | BLR:ON DOWN:64:FAST UP:16:MEDIUM |  |  |  |
 |  | 124 | BLR:ON DOWN:64:FAST UP:64:FAST |  |  |  |
 | BLR (DP5 80MHz FPGA) | 63 | BLR:OFF |  |  |  |
 |  | 64 | BLR:ON DOWN:4:SLOW UP:4:SLOW |  |  |  |
 |  | 68 | BLR:ON DOWN:4:SLOW UP:16:MEDIUM |  |  |  |
 |  | 72 | BLR:ON DOWN:4:SLOW UP:64:FAST |  |  |  |
 |  | 76 | BLR:ON DOWN:4:SLOW UP:256:VERY FAST |  |  |  |
 |  | 80 | BLR:ON DOWN:16:MEDIUM UP:4:SLOW |  |  |  |
 |  | 84 | BLR:ON DOWN:16:MEDIUM UP:16:MEDIUM |  |  |  |
 |  | 88 | BLR:ON DOWN:16:MEDIUM UP:64:FAST |  |  |  |
 |  | 92 | BLR:ON DOWN:16:MEDIUM UP:256:VERY FAST |  |  |  |
 |  | 96 | BLR:ON DOWN:64:FAST UP:4:SLOW |  |  |  |
 |  | 100 | BLR:ON DOWN:64:FAST UP:16:MEDIUM |  |  |  |
 |  | 104 | BLR:ON DOWN:64:FAST UP:64:FAST |  |  |  |
 |  | 108 | BLR:ON DOWN:64:FAST UP:256:VERY FAST |  |  |  |
 |  | 112 | BLR:ON DOWN:256:VERY FAST UP:4:SLOW |  |  |  |
 |  | 116 | BLR:ON DOWN:256:VERY FAST UP:16:MEDIUM |  |  |  |
 |  | 120 | BLR:ON DOWN:256:VERY FAST UP:64:FAST |  |  |  |
 |  | 124 | BLR:ON DOWN:256:VERY FAST UP:256:VERY FAST |  |  |  |
17 | Buffer Select (DP4/PX4) | BufferSelectA | Select Buffer A |  |  |  |
 |  | BufferSelectB | Select Buffer B |  |  |  |
 |  | BufferSelectHW | Use Buffer Select hardware input to select |  |  |  |
17 | Buffer Select (DP5) | BufferSelectA | Select Buffer A Only |  |  |  |
18 | TTL Gate Select | GateOff | Gate is disabled |  |  |  |
 |  | GateHigh | Active high gate |  |  |  |
 |  | GateLow | Active low gate |  |  |  |
19 | Preset Time | 0 - 2^24-1 | Preset time, 0.1s per count |  |  |  |
20 | Fine Gain | 6144-10240 | Fine gain = setting/8192 |  |  |  |
21 | TEC Supply (PX4/DP5) | 0 | TEC supply off |  |  |  |
 |  | 1 | TEC supply on |  |  |  |
22 | RESERVED1 | 0 |  |  |  |  |
23 | 8.5/5V Supply (PX4) | 0 | Preamp supply =5V |  |  |  |
 |  | 1 | Preamp supply =8.5V |  |  |  |
 | 8.5/5V Supply (DP5) | 0 | Not Used. Selected by hardware jumper. |  |  |  |
24 | RESERVED2 | 0 |  |  |  |  |
25 | 9V supply (PX4/DP5) | 0 | 9V supply = off |  |  |  |
 |  | 1 | 9V supply = on |  |  |  |
26 | Input Polarity (PX4/DP5) | 0 | input polarity = positive |  |  |  |
 |  | 1 | input polarity = negative |  |  |  |
27 | Input Offset (PX4/DP5) | 0-4000 | Input offset = ((Setting-2048)/1000) Volts |  |  |  |
 | Input Offset Used Default Value (DP5 Only) | 4000 | DP5 Selects Default Value |  |  |  |
28 | Pole-Zero (PX4/DP5) | 0-250 | Pole cancellation index |  |  |  |
29 | AuxOut (PX4/DP5) / TP .5 (DP4) selection | 0 | ICR |  |  |  |
 |  | 1 | PILEUP |  |  |  |
 |  | 2 | MCS Timebase |  |  |  |
 |  | 3 | ONESHOT |  |  |  |
 |  | 4 | DET_RES_ |  |  |  |
 |  | 5 | MCA_EN |  |  |  |
 |  | 6 | TRIGGER |  |  |  |
 |  | 7 | SCA8 |  |  |  |
30 | HV Supply (PX4/DP5) | 0-4000 | HV = (Setting * 1500 / 4096) Volts |  |  |  |
31 | TEC Setting (PX4/DP5) | 0-4095 | TEC temperature = ((Setting * 3 /4096 * 100) - 273) deg C |  |  |  |
32 | Audible Counter (PX4) | 0 | Off |  |  |  |
 |  | 1 | Low Volume |  |  |  |
 |  | 2 | Medium Volume |  |  |  |
 |  | 3 | High Volume |  |  |  |
33 | Preset Count | 0 - 0xFFFFFFFF | Preset count requested in selected channel range. |  |  |  |
 |  |  | Channel values are stored in SCA8. |  |  |  |
SCA | Bit Pack Format For SCA Storage | Enable Channel | Bit 31, 0=OFF,1=ON |  |  |  |
 |  | Upper Threshold Channel | Bits 30 - 16, Upper Channel Value - 1 = 0 - 8191 |  |  |  |
 |  | Lower Threshold Channel | Bits 15 - 0, Lower Channel Value - 1 = 0 - 8191 |  |  |  |
34 | SCA1 | 0 - 0x9FFF1FFF | Bit Pack Format For SCA Storage |  |  |  |
35 | SCA2 | 0 - 0x9FFF1FFF | Bit Pack Format For SCA Storage |  |  |  |
36 | SCA3 | 0 - 0x9FFF1FFF | Bit Pack Format For SCA Storage |  |  |  |
37 | SCA4 | 0 - 0x9FFF1FFF | Bit Pack Format For SCA Storage |  |  |  |
38 | SCA5 | 0 - 0x9FFF1FFF | Bit Pack Format For SCA Storage |  |  |  |
39 | SCA6 | 0 - 0x9FFF1FFF | Bit Pack Format For SCA Storage |  |  |  |
40 | SCA7 | 0 - 0x9FFF1FFF | Bit Pack Format For SCA Storage |  |  |  |
41 | SCA8 | 0 - 0x9FFF1FFF | Bit Pack Format For SCA Storage |  |  |  |
42 | Acquisition Mode | 0-1 | 0=MCA,1=MCS |  |  |  |
43 | MCS Timebase | 0 | 10mS/channel |  |  |  |
 |  | 1 | 20mS/channel |  |  |  |
 |  | 2 | 50mS/channel |  |  |  |
 |  | 3 | 100mS/channel |  |  |  |
 |  | 4 | 200mS/channel |  |  |  |
 |  | 5 | 500mS/channel |  |  |  |
 |  | 6 | 1 Sec/channel |  |  |  |
 |  | 7 | 2 Sec/channel |  |  |  |
 |  | 8 | 5 Sec/channel |  |  |  |
 |  | 9 | 10 Sec/channel |  |  |  |
 |  | 10 | 20 Sec/channel |  |  |  |
 |  | 11 | 30 Sec/channel |  |  |  |
 |  | 12 | 60 Sec/channel |  |  |  |
 |  | 13 | 90 Sec/channel |  |  |  |
 |  | 14 | 120 Sec/channel |  |  |  |
 |  | 15 | 300 Sec/channel |  |  |  |


Configuration by Detector Type With AmptekDC.ini

Configuration files can be associated to detector part numbers. The part number can then be selected from a list in the configuration dialog general page. A configuration file is associated to a part number by adding an entry to the "Amptek Detector Configuration" file (AmptekDC.ini).

AmptekDC.ini File Contents:

[Amptek Detector Configurations]

FS032=DET_CFG\FS032.cfg

FS082=DET_CFG\FS082.cfg

FSG32=DET_CFG\FSG32.cfg

FS111=DET_CFG\FS111.cfg

CS411=DET_CFG\CS411.cfg

FS532=DET_CFG\FS532.cfg

TC242=DET_CFG\TC242.cfg

RF5D7=DET_CFG\RF5D7.cfg

This uses a standard "Windows" configuration file format.

  • All entries are listed under the "Amptek Detector Configurations" section.

  • The key value is assigned the part number or configuration description.

  • The data value holds the file location relative the application directory.

  • Key/Data pair: "Part Number=Configuration File Location"

Any entries added into AmptekDC.ini will automatically be loaded into the ADMCA application.

AmptekDC.ini is located in the ADMCA application directory.

Detector configuration files are usually stored in the ADMCA application DET_CFG subdirectory.


Audible Counter

0,Off
1,Low
2,Medium
3,High


BLR CBO Fast

BLR: OFF
BLR:ON---DOWN:4:SLOW---UP:4:SLOW
BLR:ON---DOWN:4:SLOW---UP:16:MEDIUM
BLR:ON---DOWN:4:SLOW---UP:64:FAST
BLR:ON---DOWN:4:SLOW---UP:256:VERY FAST
BLR:ON---DOWN:16:MEDIUM---UP:4:SLOW
BLR:ON---DOWN:16:MEDIUM---UP:16:MEDIUM
BLR:ON---DOWN:16:MEDIUM---UP:64:FAST
BLR:ON---DOWN:16:MEDIUM---UP:256:VERY FAST
BLR:ON---DOWN:64:FAST---UP:4:SLOW
BLR:ON---DOWN:64:FAST---UP:16:MEDIUM
BLR:ON---DOWN:64:FAST---UP:64:FAST
BLR:ON---DOWN:64:FAST---UP:256:VERY FAST
BLR:ON---DOWN:256:VERY FAST---UP:4:SLOW
BLR:ON---DOWN:256:VERY FAST---UP:16:MEDIUM
BLR:ON---DOWN:256:VERY FAST---UP:64:FAST
BLR:ON---DOWN:256:VERY FAST---UP:256:VERY FAST


BLR CBO Normal

BLR:OFF
BLR:ON---DOWN:1:VERY SLOW---UP:1:VERY SLOW
BLR:ON---DOWN:1:VERY SLOW---UP:4:SLOW
BLR:ON---DOWN:1:VERY SLOW---UP:16:MEDIUM
BLR:ON---DOWN:1:VERY SLOW---UP:64:FAST
BLR:ON---DOWN:4:SLOW---UP:1:VERY SLOW
BLR:ON---DOWN:4:SLOW---UP:4:SLOW
BLR:ON---DOWN:4:SLOW---UP:16:MEDIUM
BLR:ON---DOWN:4:SLOW---UP:64:FAST
BLR:ON---DOWN:16:MEDIUM---UP:1:VERY SLOW
BLR:ON---DOWN:16:MEDIUM---UP:4:SLOW
BLR:ON---DOWN:16:MEDIUM---UP:16:MEDIUM
BLR:ON---DOWN:16:MEDIUM---UP:64:FAST
BLR:ON---DOWN:64:FAST---UP:1:VERY SLOW
BLR:ON---DOWN:64:FAST---UP:4:SLOW
BLR:ON---DOWN:64:FAST---UP:16:MEDIUM
BLR:ON---DOWN:64:FAST---UP:64:FAST


BLR Fast Values

0,63,BLR: OFF
1,64,BLR:ON---DOWN:4:SLOW---UP:4:SLOW
2,68,BLR:ON---DOWN:4:SLOW---UP:16:MEDIUM
3,72,BLR:ON---DOWN:4:SLOW---UP:64:FAST
4,76,BLR:ON---DOWN:4:SLOW---UP:256:VERY FAST
5,80,BLR:ON---DOWN:16:MEDIUM---UP:4:SLOW
6,84,BLR:ON---DOWN:16:MEDIUM---UP:16:MEDIUM
7,88,BLR:ON---DOWN:16:MEDIUM---UP:64:FAST
8,92,BLR:ON---DOWN:16:MEDIUM---UP:256:VERY FAST
9,96,BLR:ON---DOWN:64:FAST---UP:4:SLOW
10,100,BLR:ON---DOWN:64:FAST---UP:16:MEDIUM
11,104,BLR:ON---DOWN:64:FAST---UP:64:FAST
12,108,BLR:ON---DOWN:64:FAST---UP:256:VERY FAST
13,112,BLR:ON---DOWN:256:VERY FAST---UP:4:SLOW
14,116,BLR:ON---DOWN:256:VERY FAST---UP:16:MEDIUM
15,120,BLR:ON---DOWN:256:VERY FAST---UP:64:FAST
16,124,BLR:ON---DOWN:256:VERY FAST---UP:256:VERY FAST


BLR Normal Fast

BLR:OFF
BLR:ON DOWN:4:SLOW UP:4:SLOW
BLR:ON DOWN:4:SLOW UP:16:MEDIUM
BLR:ON DOWN:4:SLOW UP:64:FAST
BLR:ON DOWN:4:SLOW UP:256:VERY FAST
BLR:ON DOWN:16:MEDIUM UP:4:SLOW
BLR:ON DOWN:16:MEDIUM UP:16:MEDIUM
BLR:ON DOWN:16:MEDIUM UP:64:FAST
BLR:ON DOWN:16:MEDIUM UP:256:VERY FAST
BLR:ON DOWN:64:FAST UP:4:SLOW
BLR:ON DOWN:64:FAST UP:16:MEDIUM
BLR:ON DOWN:64:FAST UP:64:FAST
BLR:ON DOWN:64:FAST UP:256:VERY FAST
BLR:ON DOWN:256:VERY FAST UP:4:SLOW
BLR:ON DOWN:256:VERY FAST UP:16:MEDIUM
BLR:ON DOWN:256:VERY FAST UP:64:FAST
BLR:ON DOWN:256:VERY FAST UP:256:VERY FAST
BLR:OFF
BLR:ON DOWN:1:VERY SLOW UP:1:VERY SLOW
BLR:ON DOWN:1:VERY SLOW UP:4:SLOW
BLR:ON DOWN:1:VERY SLOW UP:16:MEDIUM
BLR:ON DOWN:1:VERY SLOW UP:64:FAST
BLR:ON DOWN:4:SLOW UP:1:VERY SLOW
BLR:ON DOWN:4:SLOW UP:4:SLOW
BLR:ON DOWN:4:SLOW UP:16:MEDIUM
BLR:ON DOWN:4:SLOW UP:64:FAST
BLR:ON DOWN:16:MEDIUM UP:1:VERY SLOW
BLR:ON DOWN:16:MEDIUM UP:4:SLOW
BLR:ON DOWN:16:MEDIUM UP:16:MEDIUM
BLR:ON DOWN:16:MEDIUM UP:64:FAST
BLR:ON DOWN:64:FAST UP:1:VERY SLOW
BLR:ON DOWN:64:FAST UP:4:SLOW
BLR:ON DOWN:64:FAST UP:16:MEDIUM
BLR:ON DOWN:64:FAST UP:64:FAST


DetReset Fast

Slow - 3.28mS
Slow - 1.64mS
Slow - 819uS
Slow - 410uS
Fast - 205uS
Fast - 102uS
Fast - 51.2uS
Fast - 25.6uS
OFF


DetReset Normal

Slow - 13.1mS
Slow - 6.55mS
Slow - 3.28mS
Slow - 1.64mS
Fast - 819uS
Fast - 410uS
Fast - 205uS
Fast - 102uS
OFF


Flattop Width Fast

0.05uS,0.1uS,0.2uS,0.4uS,0.8uS
0.10uS,0.2uS,0.4uS,0.8uS,1.6uS
0.15uS,0.3uS,0.6uS,1.2uS,2.4uS
0.20uS,0.4uS,0.8uS,1.6uS,3.2uS
0.25uS,0.5uS,1.0uS,2.0uS,4.0uS
0.30uS,0.6uS,1.2uS,2.4uS,4.8uS
0.35uS,0.7uS,1.4uS,2.8uS,5.6uS
0.40uS,0.8uS,1.6uS,3.2uS,6.4uS
0.45uS,0.9uS,1.8uS,3.6uS,7.2uS
0.50uS,1.0uS,2.0uS,4.0uS,8.0uS
0.55uS,1.1uS,2.2uS,4.4uS,8.8uS
0.60uS,1.2uS,2.4uS,4.8uS,9.6uS
0.65uS,1.3uS,2.6uS,5.2uS,10.4uS
0.70uS,1.4uS,2.8uS,5.6uS,11.2uS
0.75uS,1.5uS,3.0uS,6.0uS,12.0uS
0.80uS,1.6uS,3.2uS,6.4uS,12.8uS


MCS

0,10mS/channel
1,20mS/channel
2,50mS/channel
3,100mS/channel
4,200mS/channel
5,500mS/channel
6,1 Sec/channel
7,2 Sec/channel
8,5 Sec/channel
9,10 Sec/channel
10,20 Sec/channel
11,30 Sec/channel
12,60 Sec/channel
13,90 Sec/channel
14,120 Sec/channel
15,300 Sec/channel


Peaking Times Fast

0.2uS
0.4uS
0.6uS
0.8uS
1.0uS
1.2uS
1.4uS
1.6uS
2.0uS
2.4uS
2.8uS
3.2uS
4.0uS
4.8uS
5.6uS
6.4uS
8.0uS
9.6uS
11.2uS
12.8uS
16.0uS
19.2uS
22.4uS
25.6uS


Peaking Times Normal

0.8uS
1.6uS
2.4uS
3.2uS
4.0uS
4.8uS
5.6uS
6.4uS
8.0uS
9.6uS
11.2uS
12.8uS
16.0uS
19.2uS
22.4uS
25.6uS
32.0uS
38.4uS
44.8uS
51.2uS
64.0uS
76.8uS
89.6uS
102.4uS


PX4 controls not in DP4

PoleZero
InputOffset
InvertEnable
IndLED
IndBuzzer
PwrCtrl9V
PX4Aux
AudibleCounter
PreampPower
HV
TEC

HV Monitor
TEC Status Monitor


Fundamental Types

C++ Fundamental Types

Fundamental types in C++ are divided into three categories: integral, floating, and void. Integral types are capable of handling whole numbers. Floating types are capable of specifying values that may have fractional parts.

The void type describes an empty set of values. No variable of type void can be specified — it is used primarily to declare functions that return no values or to declare generic pointers to untyped or arbitrarily typed data. Any expression can be explicitly converted or cast to type void. However, such expressions are restricted to the following uses:

  • An expression statement.
  • The left operand of the comma operator.
  • The second or third operand of the conditional operator (? :).

The following table explains the restrictions on type sizes. These restrictions are independent of the Microsoft implementation.

Fundamental Types of the C++ Language

Category | Type | Contents
Integral | char | Type char is an integral type that usually contains members of the execution character set — in Microsoft C++, this is ASCII.
 |  | The C++ compiler treats variables of type char, signed char, and unsigned char as having different types. Variables of type char are promoted to int as if they are type signed char by default, unless the /J compilation option is used. In this case they are treated as type unsigned char and are promoted to int without sign extension.
 | bool | Type bool is an integral type that can have one of the two values true or false. Its size is unspecified.
 | short | Type short int (or simply short) is an integral type that is larger than or equal to the size of type char, and shorter than or equal to the size of type int.
 |  | Objects of type short can be declared as signed short or unsigned short. Signed short is a synonym for short.
 | int | Type int is an integral type that is larger than or equal to the size of type short int, and shorter than or equal to the size of type long.
 |  | Objects of type int can be declared as signed int or unsigned int. Signed int is a synonym for int.
 | __int n | Sized integer, where n is the size, in bits, of the integer variable. The value of n can be 8, 16, 32, or 64. (__int n is a Microsoft-specific keyword.)
 | long | Type long (or long int) is an integral type that is larger than or equal to the size of type int.
 |  | Objects of type long can be declared as signed long or unsigned long. Signed long is a synonym for long.
Floating | float | Type float is the smallest floating type.
 | double | Type double is a floating type that is larger than or equal to type float, but shorter than or equal to the size of type long double.1
 | long double1 | Type long double is a floating type that is equal to type double.
Wide-character | __wchar_t | A variable of __wchar_t designates a wide-character or multibyte character type. By default, wchar_t is a typedef for unsigned short; see /Zc:wchar_t for more information. Use the L prefix before a character or string constant to designate the wide-character-type constant.

1 The representation of long double and double is identical. However, long double and double are separate types.

The following table lists the amount of storage required for fundamental types in Microsoft C++.

Sizes of Fundamental Types

Type | Size
bool | 1 byte
char, unsigned char, signed char | 1 byte
short, unsigned short | 2 bytes
int, unsigned int | 4 bytes
__int n | 1, 2, 4, or 8 bytes depending on the value of n. __int n is Microsoft-specific.
long, unsigned long | 4 bytes
float | 4 bytes
double | 8 bytes
long double1 | 8 bytes
long long | Equivalent to __int64.

1 The representation of long double and double is identical. However, long double and double are separate types.


CSharp Built-in Data Types

The following table shows the keywords for built-in C# types, which are aliases of predefined types in the System namespace.

C# Type | .NET Framework type
bool | System.Boolean
byte | System.Byte
sbyte | System.SByte
char | System.Char
decimal | System.Decimal
double | System.Double
float | System.Single
int | System.Int32
uint | System.UInt32
long | System.Int64
ulong | System.UInt64
object | System.Object
short | System.Int16
ushort | System.UInt16
string | System.String

Remarks

All of the types in the table, except object and string, are referred to as simple types.

The C# type keywords and their aliases are interchangeable. For example, you can declare an integer variable by using either of the following declarations:

int x = 123;
System.Int32 x = 123;

To display the actual type for any C# type use the system method GetType(). For example, the following statement displays the system alias that represents the type of myVariable:

Console.WriteLine(myVariable.GetType());

You can also use the typeof operator.


CSharp Integral Data Types

The following table shows the sizes and ranges of the integral types, which constitute a subset of simple types.

Type | Range | Size
sbyte | -128 to 127 | Signed 8-bit integer
byte | 0 to 255 | Unsigned 8-bit integer
char | U+0000 to U+ffff | Unicode 16-bit character
short | -32,768 to 32,767 | Signed 16-bit integer
ushort | 0 to 65,535 | Unsigned 16-bit integer
int | -2,147,483,648 to 2,147,483,647 | Signed 32-bit integer
uint | 0 to 4,294,967,295 | Unsigned 32-bit integer
long | -9,223,372,036,854,775,808 to 9,223,372,036,854,775,807 | Signed 64-bit integer
ulong | 0 to 18,446,744,073,709,551,615 | Unsigned 64-bit integer

Remarks

If the value represented by an integer literal exceeds the range of ulong, a compilation error will occur.


Struct Member Alignment

Data Structure Alignment Topics

Contents:

  • Struct Member Alignment
  • Clusters in LabVIEW Do Not Line Up With Structures in Visual C++
  • Differences in Padding UDTs Between Visual Basic 5 and Visual Basic 6
  • C-Compiler Packing Issues
  • Structure Alignment By C++ Data Type

    • Struct Member Alignment

    Pack [1|2|4|8|16]

    The Struct Member Alignment (Pack n) controls how the members of a structure are packed into memory and specifies the same packing for all structures in a module. When you specify this option, each structure member after the first is stored on either the size of the member type or n-byte boundaries (where n is 1, 2, 4, 8, or 16), whichever is smaller.

    You should not use this option unless you have specific alignment requirements.

    Option | Result
Pack 1 | Packs structures on 1-byte boundaries
Pack 2 | Packs structures on 2-byte boundaries
Pack 4 | Packs structures on 4-byte boundaries
Pack 8 | Packs structures on 8-byte boundaries (C++ default)
Pack 16 | Packs structures on 16-byte boundaries
Pack | Specifies the same packing for all structures in a module. Pack is the same as Pack 1.

    The default pack size for Win32 and Win64 is Pack 8.

    The default pack size for Visual Basic 5 & 6 is Pack 4.

    The default pack size for LabView is Pack 1.

    Packing and alignment in structures created for applications can be adjusted to fit.

    • You can use #pragma pack to control structure packing in C++.
    • You can set the -Zp Struct Member Alignment (Visual C++).
    • Padding can be added to Visual Basic and LabView structures.

    Clusters in LabVIEW Do Not Line Up With Structures in Visual C++

    Problem:
    I am trying to pass a cluster from LabVIEW as a struct argument to a DLL function. I had LabVIEW generate the C skeleton code for me, so I am certain that my structure definition is correct. I keep noticing that some of the elements in the structure do not align properly, as if there were an offset of several bytes between objects in my structure. Sometimes this causes data to encroach on LabVIEW data pointers and often causes LabVIEW to crash. Why is this occurring?

    Solution:
    In Win-32 environments, LabVIEW stores cluster elements back to back with a packing size of 1 byte, as demonstrated in the LabVIEW Data Storage topic (linked below) in the LabVIEW Help. Meaning, regardless of which members are in the cluster, there are no extra bytes between one element and the next. The default settings for Visual Studio, however, will pack items according to their natural alignment and a default packing size of 8 bytes.

    Excerpt from Microsoft MSDN
    For types in memory, the default alignment is the same as its natural alignment

    • A base type such as short, float and __int64, and a pointer is aligned naturally if its representation starts at an address that is modulo its size. All of the currently supported base types have sizes 1,2,4, or 8 bytes. Pointers have a size of 4 bytes in 32-bit environments and 8 bytes in 64-bit environments.

    • A compound type is aligned naturally if each of its components is aligned naturally relative to the beginning of the type and if there are no unnecessary gaps (padding) between components.

    So the natural alignment of a type is equal to the biggest alignments of its components.

    What this means is that if you have a struct with an Int16 and an In32, there will be 2 bytes of padding after the Int16 because the Int32 is setting the natural alignment..

    The compiler will pack data according to the packing size or the natural alignment, whichever is smaller. Therefore, specifying a packing size greater than the natural alignment will have no effect on the actual packing. If you use the default packing size of 8 bytes in Visual C++, items will generally be aligned naturally.

    To work around this when passing data between LabVIEW and Visual C++ you can add dummy variables to your cluster in LabVIEW to act as padding. If you are using a cluster with an Int16 and an Int 32, you can place a second Int16 after the first as padding. In this manner, items in the LabVIEW memory space will properly line up with the what Visual C++ expects.

    Visual Studio uses natural alignment because it allows for slightly faster memory access. LabVIEW does not use natural alignment for reasons concerning cross platform and software compatibility. For more information about packing and alignment, consult Microsoft's MSDN: Storage and Alignment of Structures (linked below).

    Differences in Padding UDTs Between Visual Basic 5 and Visual Basic 6

    Summary

    The amount of memory allocated for a UDT in Visual Basic can be different in Visual Basic 6.0 and Visual Basic 5.0 depending on the data types used in the UDT and their order.

    More Information

    Both Visual Basic 5.0 and Visual Basic 6.0 use an alignment factor of 4. This means that every element of a UDT must start on a byte which is a multiple of the size of the element itself or a multiple of the alignment factor, whichever is less. For example, an element of type Integer must start on a byte address that is a multiple of 2, while an element of type Double must start on a byte address that is a multiple of 4.

    In addition, some compilers add padding bytes at the end of the UDT to make the size of the UDT a multiple of the alignment factor or a multiple of the largest data size used in the structure, whichever is less. For example, a UDT in which the largest data type is an Integer should have the total size of the UDT a multiple of 2 while an UDT in which the largest data type is a Double should have a size multiple of 4.

    The difference between Visual Basic 5.0 and Visual Basic 6.0 is that the Visual Basic 5.0 compiler only adds the required padding if you use an array of UDTs while the Visual Basic 6.0 compiler (and the C compiler) always do it regardless of whether or not you are using an array of structures. The Visual Basic 6.0 approach is consistent with the C approach.

    Programmers who use only Visual Basic, or who don't pass UDTs to functions written in other languages don't have to take this into consideration. However, programmers passing UDTs to functions written in other languages should understand this difference and evaluate how this can affect their applications.

    The following sample project demonstrates this difference:

    1. Create a new Standard EXE project. Form1 is created by default
    2. In the Project menu, select Add Module. Module1 will be created.
    3. In Module1, add the following code:

      4. Option Explicit
Type Type1
    m as Long
    i as Integer
End Type

Type Type2
    m as Long
    t1 as Type1
    i as Integer
End Type

Type Type3
    t1(0) as Type1
End Type
    4. On Form1, add a CommandButton.
    5. On the Command1_Click event, add the following code:
      6. Dim t1 as Type1
Dim t2 as Type2
Dim t3 as Type3

MsgBox "Size of Type1 is: " & LenB(t1)
MsgBox "Size of Type2 is: " & LenB(t2)
MsgBox "Size of Type3 is: " & LenB(t3)
    Run the project to see the size of each structure. You should see the following results:

    Type | VB5 | VB6
Type1 | 6 | 8
Type2 | 12 | 16
Type3 | 8 | 8

    Potential problems:

    The problem arises in Visual Basic 5.0 when you pass a structure of Type2 to a function written in C because the C compiler assumes Type1 as being of size 8 while Visual Basic 5.0 assumes size 6. The problem in this case is with the 3rd member of the structure (element i). In Visual Basic this member starts at the 11th byte of the structure while the C compiler assumes it to start at the 13th byte.

    Workaround:

    One possible workaround is to add filler elements at the end of the structure to make the size in Visual Basic match the size in C. In the preceeding case you could define the UDTs as follows:
    Type Type1
    m as Long
    i as Integer
    filler as Integer ' added to match UDT's size
End Type

 Type Type2
    m as Long
    t1 as Type1
    i as Integer
    filler as Integer ' added to match UDT's size
End Type

    Additional query words: UDType

    C-Compiler Packing Issues

    Packing levels affect the memory layout of types for both MIDL and the Microsoft C/C++ compiler in the same way. In Microsoft build environments, such as the build environment defined by VC++ or the Platform SDK, the default packing level for MIDL and C/C++ compilers is the same; the default packing level for the 32-bit and 64-bit Windows build environments is 8.

    Natural Alignment

    For types in memory, the default alignment is the same as its natural alignment.

    • A base type, such as short, float and __int64, and a pointer is aligned naturally if its representation starts at an address that is modulo its size. All the currently supported base types have sizes of 1, 2, 4 or 8. Pointers have a size of 4 in 32-bit environments and 8 in 64-bit environments.
    • A compound type is aligned naturally if each of its components is aligned naturally relative to the beginning of the type, and if there are no unnecessary gaps (padding) between components. Compound components, such as fields or elements, are recursed to pointer or base type components.

    A simple rule to help remember this behavior is that the natural alignment of a type is equal to the biggest alignments of its components.

    There is a connection between alignment and memory size of a type in languages like C or C++ and IDL as expressed by the operator sizeof(). The size is a multiple of the alignment (the minimal multiple spanning the type). This follows from an array representation in memory.

    Natural alignment is important because accessing misaligned data may cause an exception on some systems. Data can be marked for a safe manipulation when misaligned, but typically that involves a speed penalty that may be substantial on some platforms.

    Note In memory, objects of types with a natural alignment of n are guaranteed to be aligned properly when placed at addresses that are a multiple of n.

    Packing versus Alignment

    Specifying a packing level larger than the natural alignment of a type does not change the type alignment. Specifying a packing level smaller than the natural alignment reduces the type alignment to the packing level. As a result, the packed types may be placed in memory at addresses that are a multiple of the packing level (the reduced alignment) without causing a misalignment. This affects both simple types and component types. For compound types, the internal layout of the type may be affected, because the reduced alignment of the components may change the size of padding necessary for the proper alignment of the components, thus reducing the size of the type.

    A simple rule to help remember this behavior is that the new alignment of a packed type is the smaller of the packing level and its natural alignment. The size of the type is a multiple of the new alignment. The sizeof() operator returns the reduced size for packed types.

    For example, with packing level 2 a long becomes aligned at 2, and therefore may be placed at any even address, not only at the addresses that are a multiple of 4 as would be the case with natural alignment. A structure with a short and a long, packed at 2, does not need the internal gap between the short and the following long that was necessary for the natural alignment; hence, not only is the structure now aligned at 2, it also has its size reduced from 8 to 6.

    As an example, consider a compound type consisting of a 1-byte character, an integer 4 bytes long, and a 1-byte character:

    struct mystructtype
{
    char c1;  /* requires 1 byte  */
              /* 3 bytes of padding with natural alignment only */
    long l2;  /* requires 4 bytes */
    char c3;  /* requires 1 byte  */
              /* 3 bytes of padding with natural alignment only */
 } mystruct;

    This structure is naturally aligned at 4 and has the natural size of 12.

    For packing level 4 or greater, the structure mystruct is aligned at 4 and sizeof(struct mystructtype) is equal to 12. The structure will be misaligned if located in memory at an address that is not a multiple of 4.

    For packing level 2, the structure is aligned at 2 and its size is 8. The structure packed with level 2 will be misaligned if located in memory at an address that is not a multiple of 2.

    For packing level 1, the structure is aligned at 1 and its size is 6. The structure packed with level 1 can be placed anywhere without causing a misalignment fault.

    Structure Alignment By C++ Data Type

    Applications should generally align structure members at addresses that are "natural" for the data type and the processor involved. For example, a 4-byte data member should have an address that is a multiple of four.

    This principle is especially important when you write code for porting to multiple processors. A misaligned 4-byte data member, which is on an address that is not a multiple of four, causes a performance penalty with an 80386 processor and a hardware exception with a MIPS® RISC processor. In the latter case, although the system handles the exception, the performance penalty is significantly greater.

    The following guidelines ensure proper alignment for processors targeted by Win32:

    Type | Alignment
char | Align on byte boundaries
short (16-bit) | Align on even byte boundaries
int and long (32-bit) | Align on 32-bit boundaries
float | Align on 32-bit boundaries
double | Align on 64-bit boundaries
structures | Largest alignment requirement of any member
unions | Alignment requirement of the first member

    The compiler automatically aligns data in accordance with these requirements, inserting padding in structures up to the limit (default pack size) specified by the /Zp option or #pragma pack. For example, /Zp2 permits up to 1 byte of padding, /Zp4 permits up to 3 bytes of padding, and so on. The default pack size for Windows 3.x is 2, whereas the default for Win32 is 8. As a consequence:

    • If you have specified a packing limit with /Zp or #pragma pack, you may not get the proper alignment (the default value) for Win32.
    • The different default setting for Win32 can impact your source code by changing the offsets of some structure members. Examine your code closely to see whether you have hard-coded these offsets, or whether your code makes assumptions based on a certain default pack size.


Data Type Summary

VB5 Data Type Summary

The following table shows the supported data types, including storage sizes and ranges.

Data type | Storage size | Range
Byte | 1 byte | 0 to 255
Boolean | 2 bytes | True or False
Integer | 2 bytes | -32,768 to 32,767
Long (long integer) | 4 bytes | -2,147,483,648 to 2,147,483,647
Single (single-precision floating-point) | 4 bytes | -3.402823E38 to -1.401298E-45 for negative values; 1.401298E-45 to 3.402823E38 for positive values
Double (double-precision floating-point) | 8 bytes | -1.79769313486232E308 to -4.94065645841247E-324 for negative values; 4.94065645841247E-324 to 1.79769313486232E308 for positive values
Currency (scaled integer) | 8 bytes | -922,337,203,685,477.5808 to 922,337,203,685,477.5807
Decimal | 14 bytes | +/-79,228,162,514,264,337,593,543,950,335 with no decimal point; +/-7.9228162514264337593543950335 with 28 places to the right of the decimal; smallest non-zero number is +/-0.0000000000000000000000000001
Date | 8 bytes | January 1, 100 to December 31, 9999
Object | 4 bytes | Any Object reference
String (variable-length) | 10 bytes + string length | 0 to approximately 2 billion
String (fixed-length) | Length of string | 1 to approximately 65,400
Variant (with numbers) | 16 bytes | Any numeric value up to the range of a Double
Variant (with characters) | 22 bytes + string length | Same range as for variable-length String
User-defined (using Type) | Number required by elements | The range of each element is the same as the range of its data type.

Note Arrays of any data type require 20 bytes of memory plus 4 bytes for each array dimension plus the number of bytes occupied by the data itself. The memory occupied by the data can be calculated by multiplying the number of data elements by the size of each element. For example, the data in a single-dimension array consisting of 4 Integer data elements of 2 bytes each occupies 8 bytes. The 8 bytes required for the data plus the 24 bytes of overhead brings the total memory requirement for the array to 32 bytes.

A Variant containing an array requires 12 bytes more than the array alone.


Windows Data Types Win32 API

Win32 API

Windows Data Types

The data types supported by Microsoft Windows are used to define function return values, function and message parameters, and structure members. They define the size and meaning of these elements. For more information about the underlying C/C++ data types, see C++ Fundamental Data Types.

The following table contains the following types: character, integer, Boolean, pointer, and handle. The character, integer, and Boolean types are common to most C compilers. Most of the pointer-type names begin with a prefix of P or LP. Handles refer to a resource that has been loaded into memory.

For more information about handling 64-bit integers, see Windows Data Types Win64.

Term Description
ATOM Atom.

This type is declared in WinDef.h as follows:

typedef WORD ATOM;
BOOL Boolean variable (should be TRUE or FALSE).

This type is declared in WinDef.h as follows:

typedef int BOOL;
BOOLEAN Boolean variable (should be TRUE or FALSE).

This type is declared in WinNT.h as follows:

typedef BYTE BOOLEAN;
BYTE Byte (8 bits).

This type is declared in WinDef.h as follows:

typedef unsigned char BYTE;
CALLBACK Calling convention for callback functions.

This type is declared in WinDef.h as follows:

#define CALLBACK __stdcall
CHAR 8-bit Windows (ANSI) character.

This type is declared in WinNT.h as follows:

typedef char CHAR;
COLORREF Red, green, blue (RGB) color value (32 bits).

This type is declared in WinDef.h as follows:

typedef DWORD COLORREF;
CONST Variable whose value is to remain constant during execution.

This type is declared in WinDef.h as follows:

#define CONST const
DWORD 32-bit unsigned integer.

This type is declared in WinDef.h as follows:

typedef unsigned long DWORD;
DWORDLONG 64-bit unsigned integer.

This type is declared in WinNT.h as follows:

typedef ULONGLONG DWORDLONG;
DWORD_PTR Unsigned long type for pointer precision. Use when casting a pointer to a long type to perform pointer arithmetic. (Also commonly used for general 32-bit parameters that have been extended to 64 bits in 64-bit Windows. )

This type is declared in BaseTsd.h as follows:

typedef ULONG_PTR DWORD_PTR;
DWORD32 32-bit unsigned integer.

This type is declared in BaseTsd.h as follows:

typedef unsigned int DWORD32;
DWORD64 64-bit unsigned integer.

This type is declared in BaseTsd.h as follows:

typedef unsigned __int64 DWORD64;
FLOAT Floating-point variable.

This type is declared in WinDef.h as follows:

typedef float FLOAT;
HACCEL Handle to an accelerator table.

This type is declared in WinDef.h as follows:

typedef HANDLE HACCEL;
HALF_PTR Half the size of a pointer. Use within a structure that contains a pointer and two small fields.

This type is declared in Basetsd.h as follows:

#ifdef _WIN64
 typedef int HALF_PTR;
#else
 typedef short HALF_PTR;
#endif
HANDLE Handle to an object.

This type is declared in WinNT.h as follows:

typedef PVOID HANDLE;
HBITMAP Handle to a bitmap.

This type is declared in WinDef.h as follows:

typedef HANDLE HBITMAP;
HBRUSH Handle to a brush.

This type is declared in WinDef.h as follows:

typedef HANDLE HBRUSH;
HCOLORSPACE Handle to a color space.

This type is declared in WinDef.h as follows:

#if(WINVER >= 0x0400)
 typedef HANDLE HCOLORSPACE;
#endif
HCONV Handle to a dynamic data exchange (DDE) conversation.

This type is declared in Ddeml.h as follows:

typedef HANDLE HCONV;
HCONVLIST Handle to a DDE conversation list.

This type is declared in Ddeml.h as follows:

typedef HANDLE HCONVLIST;
HCURSOR Handle to a cursor.

This type is declared in WinDef.h as follows:

typedef HICON HCURSOR;
HDC Handle to a device context (DC).

This type is declared in WinDef.h as follows:

typedef HANDLE HDC;
HDDEDATA Handle to DDE data.

This type is declared in Ddeml.h as follows:

typedef HANDLE HDDEDATA;
HDESK Handle to a desktop.

This type is declared in WinDef.h as follows:

typedef HANDLE HDESK;
HDROP Handle to an internal drop structure.

This type is declared in ShellApi.h as follows:

typedef HANDLE HDROP;
HDWP Handle to a deferred window position structure.

This type is declared in WinUser.h as follows:

typedef HANDLE HDWP;
HENHMETAFILE Handle to an enhanced metafile.

This type is declared in WinDef.h as follows:

typedef HANDLE HENHMETAFILE;
HFILE Handle to a file opened by OpenFile, not CreateFile.

This type is declared in WinDef.h as follows:

typedef int HFILE;
HFONT Handle to a font.

This type is declared in WinDef.h as follows:

typedef HANDLE HFONT;
HGDIOBJ Handle to a GDI object.

This type is declared in WinDef.h as follows:

typedef HANDLE HGDIOBJ;
HGLOBAL Handle to a global memory block.

This type is declared in WinDef.h as follows:

typedef HANDLE HGLOBAL;
HHOOK Handle to a hook.

This type is declared in WinDef.h as follows:

typedef HANDLE HHOOK;
HICON Handle to an icon.

This type is declared in WinDef.h as follows:

typedef HANDLE HICON;
HINSTANCE Handle to an instance.

This type is declared in WinDef.h as follows:

typedef HANDLE HINSTANCE;
HKEY Handle to a registry key.

This type is declared in WinDef.h as follows:

typedef HANDLE HKEY;
HKL Input locale identifier.

This type is declared in WinDef.h as follows:

typedef HANDLE HKL;
HLOCAL Handle to a local memory block.

This type is declared in WinDef.h as follows:

typedef HANDLE HLOCAL;
HMENU Handle to a menu.

This type is declared in WinDef.h as follows:

typedef HANDLE HMENU;
HMETAFILE Handle to a metafile.

This type is declared in WinDef.h as follows:

typedef HANDLE HMETAFILE;
HMODULE Handle to a module. The value is the base address of the module.

This type is declared in WinDef.h as follows:

typedef HINSTANCE HMODULE;
HMONITOR Handle to a display monitor.

This type is declared in WinDef.h as follows:

if(WINVER >= 0x0500) typedef HANDLE HMONITOR;
HPALETTE Handle to a palette.

This type is declared in WinDef.h as follows:

typedef HANDLE HPALETTE;
HPEN Handle to a pen.

This type is declared in WinDef.h as follows:

typedef HANDLE HPEN;
HRESULT Return code used by interfaces. It is zero upon success and nonzero to represent an error code or status information.

This type is declared in WinNT.h as follows:

typedef LONG HRESULT;
HRGN Handle to a region.

This type is declared in WinDef.h as follows:

typedef HANDLE HRGN;
HRSRC Handle to a resource.

This type is declared in WinDef.h as follows:

typedef HANDLE HRSRC;
HSZ Handle to a DDE string.

This type is declared in Ddeml.h as follows:

typedef HANDLE HSZ;
HWINSTA Handle to a window station.

This type is declared in WinDef.h as follows:

typedef HANDLE WINSTA;
HWND Handle to a window.

This type is declared in WinDef.h as follows:

typedef HANDLE HWND;
INT 32-bit signed integer.

This type is declared in WinDef.h as follows:

typedef int INT;
INT_PTR Signed integer type for pointer precision. Use when casting a pointer to an integer to perform pointer arithmetic.

This type is declared in BaseTsd.h as follows:

#if defined(_WIN64)
 typedef __int64 INT_PTR;
#else
 typedef int INT_PTR;
#endif
INT32 32-bit signed integer.

This type is declared in BaseTsd.h as follows:

typedef signed int INT32;
INT64 64-bit signed integer.

This type is declared in BaseTsd.h as follows:

typedef signed __int64 INT64;
LANGID Language identifier.

This type is declared in WinNT.h as follows:

typedef WORD LANGID;
LCID Locale identifier.

This type is declared in WinNT.h as follows:

typedef DWORD LCID;
LCTYPE Locale information type.

This type is declared in WinNls.h as follows:

typedef DWORD LCTYPE;
LGRPID Language group identifier.

This type is declared in WinNls.h as follows:

typedef DWORD LGRPID;
LONG 32-bit signed integer.

This type is declared in WinNT.h as follows:

typedef long LONG;
LONGLONG 64-bit signed integer.

This type is declared in WinNT.h as follows:

#if !defined(_M_IX86)
 typedef __int64 LONGLONG;
#else
 typedef double LONGLONG;
#endif
LONG_PTR Signed long type for pointer precision. Use when casting a pointer to a long to perform pointer arithmetic.

This type is declared in BaseTsd.h as follows:

#if defined(_WIN64)
 typedef __int64 LONG_PTR;
#else
 typedef long LONG_PTR;
#endif
LONG32 32-bit signed integer.

This type is declared in BaseTsd.h as follows:

typedef signed int LONG32;
LONG64 64-bit signed integer.

This type is declared in BaseTsd.h as follows:

typedef __int64 LONG64;
LPARAM Message parameter.

This type is declared in WinDef.h as follows:

typedef LONG_PTR LPARAM;
LPBOOL Pointer to a BOOL.

This type is declared in WinDef.h as follows:

typedef BOOL far *LPBOOL;
LPBYTE Pointer to a BYTE.

This type is declared in WinDef.h as follows:

typedef BYTE far *LPBYTE;
LPCOLORREF Pointer to a COLORREF value.

This type is declared in WinDef.h as follows:

typedef DWORD *LPCOLORREF;
LPCSTR Pointer to a constant null-terminated string of 8-bit Windows (ANSI) characters.

This type is declared in WinNT.h as follows:

typedef __nullterminated CONST CHAR *LPCSTR;
LPCTSTR An LPCWSTR if UNICODE is defined, an LPCSTR otherwise.

This type is declared in WinNT.h as follows:

#ifdef UNICODE
 typedef LPCWSTR LPCTSTR;
#else
 typedef LPCSTR LPCTSTR;
#endif
LPCVOID Pointer to a constant of any type.

This type is declared in WinDef.h as follows:

typedef CONST void *LPCVOID;
LPCWSTR Pointer to a constant null-terminated string of 16-bit Unicode characters.

This type is declared in WinNT.h as follows:

typedef CONST WCHAR *LPCWSTR;
LPDWORD Pointer to a DWORD.

This type is declared in WinDef.h as follows:

typedef DWORD *LPDWORD;
LPHANDLE Pointer to a HANDLE.

This type is declared in WinDef.h as follows:

typedef HANDLE *LPHANDLE;
LPINT Pointer to an INT.

This type is declared in WinDef.h as follows:

typedef int *LPINT;
LPLONG Pointer to a LONG.

This type is declared in WinDef.h as follows:

typedef long *LPLONG;
LPSTR Pointer to a null-terminated string of 8-bit Windows (ANSI) characters.

This type is declared in WinNT.h as follows:

typedef CHAR *LPSTR;
LPTSTR An LPWSTR if UNICODE is defined, an LPSTR otherwise.

This type is declared in WinNT.h as follows:

#ifdef UNICODE
 typedef LPWSTR LPTSTR;
#else
 typedef LPSTR LPTSTR;
#endif
LPVOID Pointer to any type.

This type is declared in WinDef.h as follows:

typedef void *LPVOID;
LPWORD Pointer to a WORD.

This type is declared in WinDef.h as follows:

typedef WORD *LPWORD;
LPWSTR Pointer to a null-terminated string of 16-bit Unicode characters.

This type is declared in WinNT.h as follows:

typedef WCHAR *LPWSTR;
LRESULT Signed result of message processing.

This type is declared in WinDef.h as follows:

typedef LONG_PTR LRESULT;
PBOOL Pointer to a BOOL.

This type is declared in WinDef.h as follows:

typedef BOOL *PBOOL;
PBOOLEAN Pointer to a BOOL.

This type is declared in WinNT.h as follows:

typedef BOOLEAN *PBOOLEAN;
PBYTE Pointer to a BYTE.

This type is declared in WinDef.h as follows:

typedef BYTE *PBYTE;
PCHAR Pointer to a CHAR.

This type is declared in WinNT.h as follows:

typedef CHAR *PCHAR;
PCSTR Pointer to a constant null-terminated string of 8-bit Windows (ANSI) characters.

This type is declared in WinNT.h as follows:

typedef CONST CHAR *PCSTR;
PCTSTR A PCWSTR if UNICODE is defined, a PCSTR otherwise.

This type is declared in WinNT.h as follows:

#ifdef UNICODE
 typedef LPCWSTR PCTSTR;
#else
 typedef LPCSTR PCTSTR;
#endif
PCWSTR Pointer to a constant null-terminated string of 16-bit Unicode characters.

This type is declared in WinNT.h as follows:

typedef CONST WCHAR *PCWSTR;
PDWORD Pointer to a DWORD.

This type is declared in WinDef.h as follows:

typedef DWORD *PDWORD;
PDWORDLONG Pointer to a DWORDLONG.

This type is declared in WinNT.h as follows:

typedef DWORDLONG *PDWORDLONG;
PDWORD_PTR Pointer to a DWORD_PTR.

This type is declared in BaseTsd.h as follows:

typedef DWORD_PTR *PDWORD_PTR;
PDWORD32 Pointer to a DWORD32.

This type is declared in BaseTsd.h as follows:

typedef DWORD32 *PDWORD32;
PDWORD64 Pointer to a DWORD64.

This type is declared in BaseTsd.h as follows:

typedef DWORD64 *PDWORD64;
PFLOAT Pointer to a FLOAT.

This type is declared in WinDef.h as follows:

typedef FLOAT *PFLOAT;
PHALF_PTR Pointer to a HALF_PTR.

This type is declared in Basetsd.h as follows:

#ifdef _WIN64
 typedef HALF_PTR *PHALF_PTR;
#else
 typedef HALF_PTR *PHALF_PTR;
#endif
PHANDLE Pointer to a HANDLE.

This type is declared in WinNT.h as follows:

typedef HANDLE *PHANDLE;
PHKEY Pointer to an HKEY.

This type is declared in WinDef.h as follows:

typedef HKEY *PHKEY;
PINT Pointer to an INT.

This type is declared in WinDef.h as follows:

typedef int *PINT;
PINT_PTR Pointer to an INT_PTR.

This type is declared in BaseTsd.h as follows:

typedef INT_PTR *PINT_PTR;
PINT32 Pointer to an INT32.

This type is declared in BaseTsd.h as follows:

typedef INT32 *PINT32;
PINT64 Pointer to an INT64.

This type is declared in BaseTsd.h as follows:

typedef INT64 *PINT64;
PLCID Pointer to an LCID.

This type is declared in WinNT.h as follows:

typedef PDWORD PLCID;
PLONG Pointer to a LONG.

This type is declared in WinNT.h as follows:

typedef LONG *PLONG;
PLONGLONG Pointer to a LONGLONG.

This type is declared in WinNT.h as follows:

typedef LONGLONG *PLONGLONG;
PLONG_PTR Pointer to a LONG_PTR.

This type is declared in BaseTsd.h as follows:

typedef LONG_PTR *PLONG_PTR;
PLONG32 Pointer to a LONG32.

This type is declared in BaseTsd.h as follows:

typedef LONG32 *PLONG32;
PLONG64 Pointer to a LONG64.

This type is declared in BaseTsd.h as follows:

typedef LONG64 *PLONG64;
POINTER_32 32-bit pointer. On a 32-bit system, this is a native pointer. On a 64-bit system, this is a truncated 64-bit pointer.

This type is declared in BaseTsd.h as follows:

#if defined(_WIN64)
#define POINTER_32 __ptr32
#else
#define POINTER32
#endif
POINTER_64 64-bit pointer. On a 64-bit system, this is a native pointer. On a 32-bit system, this is a sign-extended 32-bit pointer.

Note that it is not safe to assume the state of the high pointer bit.

This type is declared in BaseTsd.h as follows:

#define POINTER_64 __ptr64
PSHORT Pointer to a SHORT.

This type is declared in WinNT.h as follows:

typedef SHORT *PSHORT;
PSIZE_T Pointer to a SIZE_T.

This type is declared in BaseTsd.h as follows:

typedef SIZE_T *PSIZE_T;
PSSIZE_T Pointer to a SSIZE_T.

This type is declared in BaseTsd.h as follows:

typedef SSIZE_T *PSSIZE_T;
PSTR Pointer to a null-terminated string of 8-bit Windows (ANSI) characters.

This type is declared in WinNT.h as follows:

typedef CHAR *PSTR;
PTBYTE Pointer to a TBYTE.

This type is declared in WinNT.h as follows:

typedef TBYTE *PTBYTE;
PTCHAR Pointer to a TCHAR.

This type is declared in WinNT.h as follows:

typedef TCHAR *PTCHAR;
PTSTR A PWSTR if UNICODE is defined, a PSTR otherwise.

This type is declared in WinNT.h as follows:

#ifdef UNICODE
 typedef LPWSTR PTSTR;
#else typedef LPSTR PTSTR;
#endif
PUCHAR Pointer to a UCHAR.

This type is declared in WinDef.h as follows:

typedef UCHAR *PUCHAR;
PUHALF_PTR Pointer to a UHALF_PTR.

This type is declared in Basetsd.h as follows:

#ifdef _WIN64
 typedef UHALF_PTR *PUHALF_PTR;
#else
 typedef UHALF_PTR *PUHALF_PTR;
#endif
PUINT Pointer to a UINT.

This type is declared in WinDef.h as follows:

typedef UINT *PUINT;
PUINT_PTR Pointer to a UINT_PTR.

This type is declared in BaseTsd.h as follows:

typedef UINT_PTR *PUINT_PTR;
PUINT32 Pointer to a UINT32.

This type is declared in BaseTsd.h as follows:

typedef UINT32 *PUINT32;
PUINT64 Pointer to a UINT64.

This type is declared in BaseTsd.h as follows:

typedef UINT64 *PUINT64;
PULONG Pointer to a ULONG.

This type is declared in WinDef.h as follows:

typedef ULONG *PULONG;
PULONGLONG Pointer to a ULONGLONG.

This type is declared in WinDef.h as follows:

typedef ULONGLONG *PULONGLONG;
PULONG_PTR Pointer to a ULONG_PTR.

This type is declared in BaseTsd.h as follows:

typedef ULONG_PTR *PULONG_PTR;
PULONG32 Pointer to a ULONG32.

This type is declared in BaseTsd.h as follows:

typedef ULONG32 *PULONG32;
PULONG64 Pointer to a ULONG64.

This type is declared in BaseTsd.h as follows:

typedef ULONG64 *PULONG64;
PUSHORT Pointer to a USHORT.

This type is declared in WinDef.h as follows:

typedef USHORT *PUSHORT;
PVOID Pointer to any type.

This type is declared in WinNT.h as follows:

typedef void *PVOID;
PWCHAR Pointer to a WCHAR.

This type is declared in WinNT.h as follows:

typedef WCHAR *PWCHAR;
PWORD Pointer to a WORD.

This type is declared in WinDef.h as follows:

typedef WORD *PWORD;
PWSTR Pointer to a null- terminated string of 16-bit Unicode characters.

This type is declared in WinNT.h as follows:

typedef WCHAR *PWSTR;
SC_HANDLE Handle to a service control manager database.

This type is declared in WinSvc.h as follows:

typedef HANDLE SC_HANDLE;
SC_LOCK Lock to a service control manager database.

This type is declared in WinSvc.h as follows:

typedef LPVOID SC_LOCK;
SERVICE_STATUS_HANDLE Handle to a service status value.

This type is declared in WinSvc.h as follows:

typedef HANDLE SERVICE_STATUS_HANDLE;
SHORT Short integer (16 bits).

This type is declared in WinNT.h as follows:

typedef short SHORT;
SIZE_T The maximum number of bytes to which a pointer can point. Use for a count that must span the full range of a pointer.

This type is declared in BaseTsd.h as follows:

typedef ULONG_PTR SIZE_T;
SSIZE_T Signed SIZE_T.

This type is declared in BaseTsd.h as follows:

typedef LONG_PTR SSIZE_T;
TBYTE A WCHAR if UNICODE is defined, a CHAR otherwise.

This type is declared in WinNT.h as follows:

#ifdef UNICODE
 typedef WCHAR TBYTE;
#else
 typedef unsigned char TBYTE;
#endif
TCHAR A WCHAR if UNICODE is defined, a CHAR otherwise.

This type is declared in WinNT.h as follows:

#ifdef UNICODE
 typedef WCHAR TCHAR;
#else
 typedef char TCHAR;
#endif
UCHAR Unsigned CHAR.

This type is declared in WinDef.h as follows:

typedef unsigned char UCHAR;
UHALF_PTR Unsigned HALF_PTR. Use within a structure that contains a pointer and two small fields.

This type is declared in Basetsd.h as follows:

#ifdef _WIN64
 typedef unsigned int UHALF_PTR;
#else
 typedef unsigned short UHALF_PTR;
#endif
UINT Unsigned INT.

This type is declared in WinDef.h as follows:

typedef unsigned int UINT;
UINT_PTR Unsigned INT_PTR.

This type is declared in BaseTsd.h as follows:

#if defined(_WIN64)
 typedef unsigned __int64 UINT_PTR;
#else
 typedef unsigned int UINT_PTR;
#endif
UINT32 Unsigned INT32.

This type is declared in BaseTsd.h as follows:

typedef unsigned int UINT32;
UINT64 Unsigned INT64.

This type is declared in BaseTsd.h as follows:

typedef usigned __int 64 UINT64;
ULONG Unsigned LONG.

This type is declared in WinDef.h as follows:

typedef unsigned long ULONG;
ULONGLONG 64-bit unsigned integer.

This type is declared in WinNT.h as follows:

#if !defined(_M_IX86)
 typedef unsigned __int64 ULONGLONG;
#else
 typedef double ULONGLONG
#endif
ULONG_PTR Unsigned LONG_PTR.

This type is declared in BaseTsd.h as follows:

#if defined(_WIN64)
 typedef unsigned __int64 ULONG_PTR;
#else
 typedef unsigned long ULONG_PTR;
#endif
ULONG32 Unsigned LONG32.

This type is declared in BaseTsd.h as follows:

typedef unsigned int ULONG32;
ULONG64 Unsigned LONG64.

This type is declared in BaseTsd.h as follows:

typedef unsigned __int64 ULONG64;
USHORT Unsigned SHORT.

This type is declared in WinDef.h as follows:

typedef unsigned short USHORT;
USN Update sequence number (USN).

This type is declared in WinNT.h as follows:

typedef LONGLONG USN;
VOID Any type.

This type is declared in WinNT.h as follows:

#define VOID void
WCHAR 16-bit Unicode character.

This type is declared in WinNT.h as follows:

typedef wchar_t WCHAR;
WINAPI Calling convention for system functions.

This type is declared in WinDef.h as follows:

#define WINAPI __stdcall
WORD 16-bit unsigned integer.

This type is declared in WinDef.h as follows:

typedef unsigned short WORD;
WPARAM Message parameter.

This type is declared in WinDef.h as follows:

typedef UINT_PTR WPARAM;


Windows Types Win64

Win64 API

Windows Types

There are three classes of data types: fixed-precision data types, pointer-precision types, and specific-precision pointers. These types were added to the development environment (specifically, to Basetsd.h) to allow developers to prepare for 64-bit Microsoft Windows well before its introduction. These new types were derived from the basic C-language integer and long types, so they work in existing code. Therefore, use these data types in your code now, test your code on 32-bit Windows, and recompile with the 64-bit compiler when targeting 64-bit Windows.

There is an additional benefit to adopting these data types now: it will make your code more robust. To use these data types, you must scan your code for potentially unsafe pointer usage, polymorphism, and data definitions. To be safe, use the new types. For example, when a variable is of type ULONG_PTR, it is clear that it will be used for casting pointers for arithmetic operations or polymorphism. It is not possible to indicate such usage directly by using the existing data types. You can do this by using derived type naming or Hungarian notation, but both techniques are prone to errors.

Fixed Precision

Fixed-precision data types are the same length in both 32- and 64-bit Windows. To help you remember this, their precision is part of the name of the data type. The following are the fixed-precision data types.

Term | Description
DWORD32 | 32-bit unsigned integer
DWORD64 | 64-bit unsigned integer
INT32 | 32-bit signed integer
INT64 | 64-bit signed integer
LONG32 | 32-bit signed integer
LONG64 | 64-bit signed integer
UINT32 | Unsigned INT32
UINT64 | Unsigned INT64
ULONG32 | Unsigned LONG32
ULONG64 | Unsigned LONG64

Pointer Precision

As the pointer precision changes (that is, as it becomes 32 bits on 32-bit Windows and 64 bits with 64-bit Windows), these data types reflect the precision accordingly. Therefore, it is safe to cast a pointer to one of these types when performing pointer arithmetic; if the pointer precision is 64 bits, the type is 64 bits. The count types also reflect the maximum size to which a pointer can refer. The following are the pointer-precision and count types.

Term | Description
DWORD_PTR | Unsigned long type for pointer precision.
HALF_PTR | Half the size of a pointer. Use within a structure that contains a pointer and two small fields.
INT_PTR | Signed integer type for pointer precision.
LONG_PTR | Signed long type for pointer precision.
SIZE_T | The maximum number of bytes to which a pointer can refer. Use for a count that must span the full range of a pointer.
SSIZE_T | Signed SIZE_T.
UHALF_PTR | Unsigned HALF_PTR.
UINT_PTR | Unsigned INT_PTR.
ULONG_PTR | Unsigned LONG_PTR.

Specific Pointer-Precision Types

There are also new pointer types that explicitly size the pointer. Be cautious when using pointers in 64-bit code: If you declare the pointer using a 32-bit type, the operating system creates the pointer by truncating a 64-bit pointer. (All pointers are 64 bits on 64-bit Windows.)

Term | Description
POINTER_32 | A 32-bit pointer. On 32-bit Windows, this is a native pointer. On 64-bit Windows, this is a truncated 64-bit pointer.
POINTER_64 | A 64-bit pointer. On 64-bit Windows, this is a native pointer. On 32-bit Windows, this is a sign-extended 32-bit pointer. Note that it is not safe to assume the state of the high pointer bit.


DPPAPI Data Stucture Byte Alignment

Pack 1 Position (LabView) | Pack 4 Position (VB 5,6) | Byte Position (Hex) | Auto PAD (Bytes) | Byte Count | // @struct DPP_CONFIG_SETTINGS | DPP Configuration Settings Storage Type | Group
 | No PAD Needed |  |  |  | typedef struct _DPP_CONFIG_SETTINGS { |  |
 |  | 0x00 |  | 1 | byte AcqMode; | // @field acquisition mode 0=MCA;1=MCS | //MCA Properties
 |  | 0x01 |  | 1 | byte MCSTimebase; | // @field MCS timebase value (0-15) see CAcqMode |
 |  | 0x02 |  | 1 | byte MCAChannels; | // @field number of channels 4=256;3=512;2=1024;1=2048;0=4096;5=8192 |
 |  | 0x03 |  | 1 | byte BufferSelect; | // @field Holds Buffer Sel A&B;Buffer Sel Hardware;see DPPBufferSelect |
 |  | 0x04 |  | 1 | byte TTLGate; | // @field gate input settings; determines events included/excluded from spectrum; see DPPGate |
 |  | 0x05 |  | 1 | byte SlowThreshold; | // @field Slow ch threshold; Events w/amp lower not added to spectrum |
Insert 2 Byte Pad |  | 0x08 | 2 | 4 | long PresetTime; | // @field var holds preset time; used in usb |
 |  | 0x0C |  | 4 | long PresetCount; | // @field preset count in selected channels; ch are set in SCA8 |
 |  | 0x10 |  | 32 | long SCA[8]; | // @field SCA values; LL; UL; and Enable are stored together |
 |  | 0x30 |  | 1 | byte TimeToPeak; | // @field TimeToPeak register setting | //Shaping Properties
 |  | 0x31 |  | 1 | byte Decimation; | // @field decimation setting for pulse shaping |
 |  | 0x32 |  | 1 | byte FlatTop; | // @field flatop register setting |
 |  | 0x33 |  | 1 | byte PUREnable; | // @field pile-up rejection enabled |
 |  | 0x34 |  | 1 | byte FastThreshold; | // @field Fast Ch Threshold; events w/fch amp below this are rejected |
 |  | 0x35 |  | 1 | byte RTDSlow; | // @field Risetime Discrimination slow threshold |
 |  | 0x36 |  | 1 | byte RTDOn; | // @field Turns RTD on; and sets the amplitude and timing thresholds |
 |  | 0x37 |  | 1 | byte RTDFast; | // @field RTD Time Threshold;Events w/HWHM wider than this are rejected |
 |  | 0x38 |  | 1 | byte BLR; | // @field Baseline Restoration; see udBLR.Value notes for values |
 |  | 0x39 |  | 1 | byte BaselineOn; | // @field use autobaseline during detector reset |
 |  | 0x3A |  | 1 | byte CoarseGain; | // @field stores current coarse gain value | //Gain PZ Properties
Insert 1 Byte Pad |  | 0x3C | 1 | 4 | long FineGain; | // @field stores current fine gain value |
 |  | 0x40 |  | 4 | long PoleZero; | // @field pole zero adjust value |
 |  | 0x44 |  | 4 | long InputOffset; | // @field input offset |
 |  | 0x48 |  | 1 | byte InputPolarity; | // @field use InvertEnable during detector reset |
 |  | 0x49 |  | 1 | byte DetReset; | // @field detector reset lockout period |
Insert 2 Byte Pad |  | 0x4C | 2 | 4 | long TEC; | // @field TEC temperature setting (displayed in Kelvin) | //Power Properties
 |  | 0x50 |  | 1 | byte HVEnabled; | // @field high voltage setting enable |
Insert 3 Byte Pad |  | 0x54 | 3 | 4 | long HV; | // @field high voltage setting value |
 |  | 0x58 |  | 1 | byte PreampPower; | // @field preamp power select value (5v or 8.5v) |
 |  | 0x59 |  | 1 | byte AnalogOut; | // @field dac enabled and DAC output type;(stobed peak;shaped pulse;dec inp;fast ch) | //Misc Properties
 |  | 0x5A |  | 1 | byte OutputOffset; | // @field Output DAC offset; -64…+63;(signed)(D7-D1) (-500mV to +492mV) |
 |  | 0x5B |  | 1 | byte AuxOut; | // @field Aux output type |
 |  | 0x5C |  | 1 | byte AudibleCounter; | // @field audio volume setting |
Can PAD 3 Bytes if needed | 3 Bytes, Can Ignore | 0x60 Total | 3 |  | } DPP_CONFIG_SETTINGS; *LP_DPP_CONFIG_SETTINGS; |  |
 |  |  |  |  | // @struct DPP_STATUS | DPP Status Storage Type |
 |  |  |  |  | typedef struct _DPP_STATUS { |  |
 |  | 0x00 |  | 8 | double FPGA; | // @field FPGA | // Identification
 |  | 0x08 |  | 8 | double Firmware; | // @field firmware revision |
 |  | 0x10 |  | 8 | double SerialNumber; | // @field unit serial number |
 |  | 0x18 |  | 1 | byte StatDevInd; | // @field device indicator from status block (0=dp4;1=px4) |
 |  | 0x19 |  | 1 | byte BootStatus; | // @field boot status byte (PwrBtnConfig;SwConfigRcvd;McaEnabled) | // Configuration
 |  | 0x1A |  | 1 | byte PwrBtnConfig; | // @field dpp has loaded config from power button |
 |  | 0x1B |  | 1 | byte SwConfigRcvd; | // @field software has sent valid config to unit since startup |
 |  | 0x1C |  | 1 | byte SetFastThreshDone; | // @field DPP tune fast thresh has successfully done | // Tuning
 |  | 0x1D |  | 1 | byte SetSlowThreshDone; | // @field DPP tune slow thresh has successfully done (NOT USED) |
 |  | 0x1E |  | 1 | byte SetInputOffsetDone; | // @field DPP tune input offset has successfully done |
Insert 1 Byte Pad |  | 0x20 | 1 | 8 | double BoardTemp; | // @field board temperature monitor value | // Monitors
 |  | 0x28 |  | 8 | double HVMonitor; | // @field high voltage monitor value |
 |  | 0x30 |  | 8 | double TECMonitor; | // @field TEC temperature monitor value (displayed in Kelvin) |
 |  | 0x38 |  | 8 | double FastCount; | // @field fast channel count | // Acquisition Parameters
 |  | 0x40 |  | 8 | double SlowCount; | // @field slow channel count |
 |  | 0x48 |  | 8 | double AccumulationTime; | // @field real time duration of present data acquisition interval |
 |  | 0x50 |  | 1 | byte StatMcaEnabled; | // @field mca enabled status; high during acq; preset time resets flag | // Acquisition Mode
 |  | 0x51 |  | 1 | byte MCSDone; | // @field MCS done flag 1=finished; 0=not finished |
 |  | 0x52 |  | 1 | byte PresetCountExpired; | // @field indicates presets counts have been reached |
Can PAD 5 Bytes if needed | 1 Byte, Can Ignore | 0x58 Total | 5 |  | } DPP_STATUS; *LP_DPP_STATUS; |  |
 |  |  |  |  | // @struct DPP_BOOT_STATUS | DPP Boot Options Status Storage Type |
 |  |  |  |  | typedef struct _DPP_BOOT_OPTIONS { |  |
 |  | 0x00 |  | 2 | USHORT BootFlags; | // @field Boot flags (MSB currently unused) |
 |  | 0x02 |  | 2 | USHORT HVDACSet; | // @field HV DAC setting (not used in PX4 mode) |
 |  | 0x04 |  | 2 | USHORT TECDACSet; | // @field TEC DAC setting (not used in PX4 mode) |
 |  | 0x06 |  | 2 | USHORT InputOffsetTuning; | // @field Input offset DAC setting (not used in PX4 mode) |
 |  | 0x08 |  | 2 | USHORT uCTempCal; | // @field uC temp cal |
 |  | 0x0A |  | 2 | USHORT SpectrumOffset; | // @field Spectrum offset |
 |  | 0x0C Total |  |  | } DPP_BOOT_OPTIONS; *LP_DPP_BOOT_OPTIONS; |  |


PadStruc - Byte Align/Pad C++ Structures

PadStruc calculates padding needed by applications interfacing to C/C++ DLLs.

  • Tests C++ Structures for byte alignment by PACK TYPE.

  • Generates padding instructions by PACK TYPE.

  • Instructions:

    1. Paste the C/C++ data structure variables into the left window. One variable per line.

    2. Enter the byte Pack data alignment values (C++ is by default Pack 8).

    3. Click the Pad Structure button to calculate the padding needed.

    4. The results are displayed in a text box and saved to a file in csv format.

  • Visual Basic 5 source code.


CONFIG_SETTINGS DPP Configuration Settings Padding Instructions

CppVar | VarSizeBytes | VarPad | VarStart | VarStartHex | PadNeeded
byte AcqMode; | 1 | 0 | 0 | 0x00 |
byte MCSTimebase; | 1 | 0 | 1 | 0x01 |
byte MCAChannels; | 1 | 0 | 2 | 0x02 |
byte BufferSelect; | 1 | 0 | 3 | 0x03 |
byte TTLGate; | 1 | 0 | 4 | 0x04 |
byte SlowThreshold; | 1 | 0 | 5 | 0x05 |
long PresetTime; | 4 | 2 | 8 | 0x08 | PAD Needed 2 Bytes
long PresetCount; | 4 | 0 | 12 | 0x0C |
long SCA[8]; | 32 | 0 | 16 | 0x10 |
byte TimeToPeak; | 1 | 0 | 48 | 0x30 |
byte Decimation; | 1 | 0 | 49 | 0x31 |
byte FlatTop; | 1 | 0 | 50 | 0x32 |
byte PUREnable; | 1 | 0 | 51 | 0x33 |
byte FastThreshold; | 1 | 0 | 52 | 0x34 |
byte RTDSlow; | 1 | 0 | 53 | 0x35 |
byte RTDOn; | 1 | 0 | 54 | 0x36 |
byte RTDFast; | 1 | 0 | 55 | 0x37 |
byte BLR; | 1 | 0 | 56 | 0x38 |
byte BaselineOn; | 1 | 0 | 57 | 0x39 |
byte CoarseGain; | 1 | 0 | 58 | 0x3A |
long FineGain; | 4 | 1 | 60 | 0x3C | PAD Needed 1 Bytes
long PoleZero; | 4 | 0 | 64 | 0x40 |
long InputOffset; | 4 | 0 | 68 | 0x44 |
byte InputPolarity; | 1 | 0 | 72 | 0x48 |
byte DetReset; | 1 | 0 | 73 | 0x49 |
long TEC; | 4 | 2 | 76 | 0x4C | PAD Needed 2 Bytes
byte HVEnabled; | 1 | 0 | 80 | 0x50 |
long HV; | 4 | 3 | 84 | 0x54 | PAD Needed 3 Bytes
byte PreampPower; | 1 | 0 | 88 | 0x58 |
byte AnalogOut; | 1 | 0 | 89 | 0x59 |
byte OutputOffset; | 1 | 0 | 90 | 0x5A |
byte AuxOut; | 1 | 0 | 91 | 0x5B |
byte AudibleCounter; | 1 | 0 | 92 | 0x5C |


DPP_STATUS DPP Status Padding Instructions

CppVar | VarSizeBytes | VarPad | VarStart | VarStartHex | PadNeeded
double FPGA; | 8 | 0 | 0 | 0x00 |
double Firmware; | 8 | 0 | 8 | 0x08 |
double SerialNumber; | 8 | 0 | 16 | 0x10 |
byte StatDevInd; | 1 | 0 | 24 | 0x18 |
byte BootStatus; | 1 | 0 | 25 | 0x19 |
byte PwrBtnConfig; | 1 | 0 | 26 | 0x1A |
byte SwConfigRcvd; | 1 | 0 | 27 | 0x1B |
byte SetFastThreshDone; | 1 | 0 | 28 | 0x1C |
byte SetSlowThreshDone; | 1 | 0 | 29 | 0x1D |
byte SetInputOffsetDone; | 1 | 0 | 30 | 0x1E |
double BoardTemp; | 8 | 1 | 32 | 0x20 | PAD Needed 1 Bytes
double HVMonitor; | 8 | 0 | 40 | 0x28 |
double TECMonitor; | 8 | 0 | 48 | 0x30 |
double FastCount; | 8 | 0 | 56 | 0x38 |
double SlowCount; | 8 | 0 | 64 | 0x40 |
double AccumulationTime; | 8 | 0 | 72 | 0x48 |
byte StatMcaEnabled; | 1 | 0 | 80 | 0x50 |
byte MCSDone; | 1 | 0 | 81 | 0x51 |
byte PresetCountExpired; | 1 | 0 | 82 | 0x52 |


DP5 C++ Cut/Paste Updates For DppApi

Amptek DppAPI (C)2008 - Wednesday, December 31, 2008

Changes from 1.0.1.4 to 1.0.2.6

- The DPPAPI has been updated to include the DP5.

- See the following DP5 documents for DP5 reference:

                  DP5 Software Migration A3.pdf

                  DP5 Product Changes B1.pdf

- The device type value has been changed

- A generic a generic DPP Vendor Request has been added

- FPGA clock functions have been added (DP5 only)

///////////////////////////////////////////////////////////////////////////////

// New DPP/DP5 Functions

///////////////////////////////////////////////////////////////////////////////

///////////////////////////////////////////////////////////////////////////////

// SendDPPVendorRequest -  Sends a generic DPP Vendor Request to the default usb device

void __stdcall SendDppVendorRequest(void * objptr, int Request, int Value);

///////////////////////////////////////////////////////////////////////////////

// Get80MHzMode -  get 80MHzMode for DP5 only, returns true if DP5 and in 80MHzMode

// Run GetStatusStruct or GetStatusString before running Get80MHzMode

long __stdcall Get80MHzMode(void * objptr);

///////////////////////////////////////////////////////////////////////////////

// SetFPGAClockDefault -  set 80MHzMode for DP5 only

void __stdcall SetFPGAClockDefault(void * objptr, BOOLEAN b80MHzMode, byte DPPDeviceType);

// determining the device type:

      indDPP5 = (byte)(StatusLst.Firmware >= 5.0);  //DPP5 20071023 indicates DPP5 type device

      DppDevice = ((indDPP5 * 2) + (StatusLst.StatDevInd * 1)) + 1;

// new device type values

enum DeviceType {

      devtypNONE = 0,         // no dpp device

      devtypDP4 = 1,          // dp4

      devtypPX4 = 2,          //px4

      devtypDP4EMUL = 3,      // dp5 (dp4 emulation)

      devtypPX4EMUL = 4 // dp5 (px4 emulation)

};

// !!!! new device values must be used for functions requiring a device type value !!!!!

/////////////////////////////////////////////////

// The FPGA Clock Default must be set to

// correctly read DP5 configuration files

/////////////////////////////////////////////////

      // Run GetStatusStruct or GetStatusString before running Get80MHzMode

      Dpp80MHzMode = (BOOLEAN) Get80MHzMode(objDppApi);                 // get clock value

      SetFPGAClockDefault (objDppApi, Dpp80MHzMode, DppDevice);   // set clock value

CString GetDeviceNameFromVal(int DeviceTypeVal) {

    CString cstrDeviceType;

      switch(DeviceTypeVal) {

            case 1:

            cstrDeviceType = "DP4";

                  break;

            case 2:

            cstrDeviceType = "PX4";

                  break;

            case 3:

            cstrDeviceType = "DP4EMUL";

                  break;

            case 4:

            cstrDeviceType = "DP5";

                  break;

            default:           // unknown

            cstrDeviceType = "";

                  break;

      }

    return cstrDeviceType;

}

// an example of the OLD configuration read

void OnBnClickedConfigButton_OLD() {

      int numdev;                                                             // number of usb devices

      void * objDppApi;                                                 // pointer to dpp api

      CString cstrStatus;                                                     // status display string

      long FilenameLen;                                                 //

      byte DppDevice;

      DPP_STATUS StatusLst;

      GetDlgItem(IDC_CONFIG_BUTTON)->EnableWindow(false);   // disable button until done

      objDppApi = OpenDppApi();                                         // Create/Open DPPAPI

      numdev = OpenUSBDevice(objDppApi);                          // Open USB communications

      if (numdev > 0) {

            GetStatusStruct(objDppApi, true, &StatusLst);   // get device status

            cstrStatus.Format("(s/n %7i)",(ULONG)StatusLst.SerialNumber);

            if (StatusLst.SerialNumber < 1) {

                  GetDlgItem(IDC_STATUS_STATIC)->SetWindowText("Device status error.");

            } else {

                  if(PromptFileName()) {                                // get the configuration filename

                        DppDevice = StatusLst.StatDevInd;

                        FilenameLen = (long)m_csCurrentFile.GetLength();

                        GetConfigFromFile(objDppApi, m_csCurrentFile, FilenameLen, DppDevice);

                        SendConfigToDpp(objDppApi);

                        GetDlgItem(IDC_STATUS_STATIC)->SetWindowText("Configuration loaded from file and sent to device. " + cstrStatus);

                  } else {

                        GetDlgItem(IDC_STATUS_STATIC)->SetWindowText("No configuration file selected.");

                  }

            }

      } else {

            GetDlgItem(IDC_STATUS_STATIC)->SetWindowText("No devices detected.");

      }

      CloseUSBDevice (objDppApi);                                       // 7. close usb

      CloseDppApi (objDppApi);                              // 8. close DPPAPI

      Sleep(750);

      GetDlgItem(IDC_CONFIG_BUTTON)->EnableWindow(true);

}

// Example of the new configuration read

void OnBnClickedConfigButton_NEW() {

      int numdev;                                                             // number of usb devices

      void * objDppApi;                                                 // pointer to dpp api

      CString cstrStatus;                                                     // status display string

      long FilenameLen;                                                 //

      byte DppDevice;

      byte indDPP5;

      DPP_STATUS StatusLst;

      BOOLEAN Dpp80MHzMode;

      GetDlgItem(IDC_CONFIG_BUTTON)->EnableWindow(false);   // disable button until done

      objDppApi = OpenDppApi();                                         // Create/Open DPPAPI

      numdev = OpenUSBDevice(objDppApi);                          // Open USB communications

      if (numdev > 0) {

            GetStatusStruct(objDppApi, true, &StatusLst);   // get device status

            cstrStatus.Format("(s/n %7i)",StatusLst.SerialNumber);

            if (StatusLst.SerialNumber < 1) {                     // check if device status can be read

                  GetDlgItem(IDC_STATUS_STATIC)->SetWindowText("Device status error.");

            } else {                                                          // device is communicating, get the config file

                  if(PromptFileName()) {                                // get the configuration filename, if any config dpp

                        DppDevice = StatusLst.StatDevInd;         // determine device type (0=dp4,1=px4)

                        //////////////////////////////////////////////////////////////////////////////

                        //////////////////////////////////////////////////////////////////////////////

                        //////////////////////////////////////////////////////////////////////////////

                        indDPP5 = (byte)(StatusLst.Firmware >= 5.0);  //DPP5 20071023 indicates DPP5 type device

                        DppDevice = ((indDPP5 * 2) + (StatusLst.StatDevInd * 1)) + 1;

                        // Run GetStatusStruct or GetStatusString before running Get80MHzMode

                        Dpp80MHzMode = (BOOLEAN) Get80MHzMode(objDppApi);

                        SetFPGAClockDefault (objDppApi, Dpp80MHzMode, DppDevice);

                        //////////////////////////////////////////////////////////////////////////////

                        //////////////////////////////////////////////////////////////////////////////

                        //////////////////////////////////////////////////////////////////////////////

                        FilenameLen = (long)m_csCurrentFile.GetLength();      // get configuration filename buffer length

                        GetConfigFromFile(objDppApi, m_csCurrentFile, FilenameLen, DppDevice); // load cfg into dppapi

                        SendConfigToDpp(objDppApi);                                                                     // send cfg to dpp

                        GetDlgItem(IDC_STATUS_STATIC)->SetWindowText("Configuration loaded from file and sent to device. " + cstrStatus);

                  } else {

                        GetDlgItem(IDC_STATUS_STATIC)->SetWindowText("No configuration file selected.");

                  }

            }

      } else {

            GetDlgItem(IDC_STATUS_STATIC)->SetWindowText("No devices detected.");

      }

      CloseUSBDevice (objDppApi);                                       // close usb

      CloseDppApi (objDppApi);                              // close DPPAPI

      Sleep(750);

      GetDlgItem(IDC_CONFIG_BUTTON)->EnableWindow(true);

}


DP5 Product Changes Abstract

DP5 Information for Developers Using the DPPAPI

This document contains DP5 Information for Developers Using the DPPAPI. This information is from the DP5 Product Changes guide.

Contents

1. DP5 Enhanced Digital Processor Product Migration Guide. 2

2. Frequently Asked Questions. 3

2.1 What Performance enhancements will be found in the DP5 vs. the DP4?. 3

2.2 Is the DP5 Software backward compatible with the DP4?. 3

2.3 How were these enhancements achieved?. 3

3. Using the Boot Manager 4

4. Uploading Firmware and Software. 7

1. DP5 Enhanced Digital Processor Product Migration Guide

Amptek Inc is introducing a family of enhanced X-ray spectroscopy products, based on a new generation digital pulse processor, the DP5. The DP5 will provide better performance, new signal processing features, improved data processing algorithms, faster data transfers, and simpler interfacing. Amptek has also developed an enhanced power supply board for the detectors and preamplifiers, the PC5. Products now available using the DP5 and PC5 include:

1. The X-123SDD, a significantly enhanced X-123 which uses the new silicon drift detector (SDD), the DP5 digital processor, and a new PC5 power supply module.

2. The DP5/PC5 combination, used primarily by OEMs with Amptek’s detectors and preamplifiers.

3. The DP5 as a standalone unit.

The DP5 implements all of the features and performance of the DP4, with many enhancements. Communication protocols and software are compatible with the DP4 and PX4. Specifically, accessing new features of the DP5 requires software changes but software written for the DP4 will work with minor changes. The ADMCA and the DPPAPI communicate to the DP5 in the PX4 emulation mode. This is the recommend emulation mode. The PX4 emulation mode provides access to the enhanced features of the DP5.

DP5

DP5/PC5 stack

X-123SDD

2. Frequently Asked Questions

2.1 What Performance enhancements will be found in the DP5 vs. the DP4?

· Faster peaking time available, allowing higher input count rates. Shortest peaking time is 0.2 msec (equivalent to 80 nsec shaping time).

· Additional peaking times are available, with over 350 settings covering 0.2 msec to 102 msec.

· Reduced dead time allowing higher throughput. Dead time is typically 10% shorter.

· Dead time due to USB transfers is significantly reduced.

· Improved dead time measurement for more accurate corrections at high rate.

· Fast channel peaking time as short as 0.1 msec (40 nsec shaping time). This improves pile-up rejection, measurement of incoming count rate, and risetime discrimination.

· Larger gain range, with all ranges overlapping. (16 analog gains, from 1x to 100x.)

· Lower noise analog prefilter. This improves resolution with the lowest noise detectors.

· Input offset, input polarity, and preamp pole zero under software control.

· Software control of the offset channel in the output spectrum, permitting zero offset.

2.2 Is the DP5 Software backward compatible with the DP4?

As close as feasible but some changes are inevitable.

· A new release of Amptek’s ADMCA software incorporates the DP5 interface, over USB. With ADMCA, one can access all of the DP5’s features in the same manner as the DP4 or PX4.

· The DP5 uses FLASH memory to store its power-up configuration and some parameters which are unsupported by the legacy DP4 & PX4 protocols (for example, switching to 80MHz operation to access the fastest peaking times, selecting 115k/57.6k RS232 operation, etc.) These options can be selected via the standard serial interfaces.

· For users who have written or are writing their own software, there are a few options.

o        To use the new functions and features of the DP5, new data packets and communications libraries are required. This implies some software changes for USB.

o        With USB, the DP5 recognizes the same packets for commanding and for readout of spectra and status packets. Readout of configuration and of oscilloscope packets requires minor software changes. (The DP5 microcontroller supports fewer USB ‘endpoints’ or ‘pipes’ than the DP4 microcontroller, so a few required remapping.)

2.3 How were these enhancements achieved?

· The DP4’s ADC and digital processor operated at a 20 MHz clock rate. The DP5 can be clocked at 20 or 80 MHz. The higher clock rates permit the faster peaking times in both the main and fast channels but the unit dissipates more power in this mode. For systems not requiring the fastest peaking times or operating at the higher rates, the 20 MHz clock can be used to reduce power.

· A number of improvements were made to the digital signal processing algorithms and to the analog prefilter. Amptek has conducted significant in-house research and development on digital signal processors since the release of initial DP4 and has tailored the design to meet the unique needs of many customers. These developments were folded into the new DP5.

3. Using the Boot Manager

The DP5 Boot Manger application is used for changing the various non-volatile settings in the DP5. In addition, it can read the current configuration of the DP5 and display the various settings. To make use of the DP5 Boot Manager, it must first be installed from the Amptek CDROM. Run ‘setup.exe’ from \Additional DPP Software\DP5\DP5BootManager\SWSETUP on the CDROM to install the application. The DP5 Boot Manager only operates via the USB interface.

After installing the application, connect the USB cable and apply power to the DP5. Clicking the ‘Get Boot Options From DPP’ button will display the current Boot Options from the DP5. Below is an example of a DP5 with an Amptek SDD detector.

3.1.1 Boot Flags

To change the individual Boot Flags, click the ‘Change Boot Flags’ button, which displays the window shown below. After changing the Boot Flags, click the ‘OK’ button. Then, on the main Boot Manager screen, click ‘Set DP5 Boot Flags’ to send the new Boot Flags to the DP5. The meaning of the individual Boot Flags is discussed below.

Boot Device Mode

o           PX4: In the PX4 emulation mode, the DP5 uses the HV, TEC, Input Offset and ADC Invert settings from the configuration packet. ADMCA requires the PX4 Emulation Mode, and will switch to this mode if it detects that the DP5 is configured in DP4 Emulation Mode. [In the PX4 Emulation Mode, the HV, TEC and Input Offset Boot Options are ignored, since these are taken from the configuration packet.]

o           DP4: Since the HV, TEC, Input Offset and ADC Invert settings don’t exist in the DP4 configuration packet, these settings come from the HV, TEC and Input Offset Boot Options.

Note: This setting requires the DP5 to be power-cycled to take effect.

Boot Configuration State

o           Boot unconfigured: In this mode, upon power-up, the DP5 will be in an unconfigured state. If present, the PC5 and detector will not be powered on until the first configuration packet is received. Also, the shaper, MCA, etc. are not configured. [After power-up, the status packet byte 23, bit D1 indicates whether the device is configured or unconfigured.]

o           Use Nonvolatile Configuration: Upon power-up, the DP5 will use the last configuration it received before it was powered off. It will turn on all supplies, including the PC5 HV & TEC supplies (if present, and if these were previously configured to be powered on). [The HV & TEC supplies will be turned on approximately 2 seconds after power is applied.] The DP5 will be ready to take data, once the detector has cooled.

Note: This setting requires the DP5 to be power-cycled to take effect.

RS232 Baud Rate

o           57,600: This primarily exists for backward compatibility with DP4/PX4 RS232 applications.

o           115,200: Recommended, for higher-speed transfers.

Note: This setting requires the DP5 to be power-cycled to take effect.

FPGA Clock

o           20MHz: Operating the DP5 at 20MHz consumes less power than 80MHz and allows longer peaking times (up to 102us), but limits throughput, minimum peaking time (0.8us), etc.

o           80MHz: This is the recommended clock rate for SDD detectors; it allows faster peaking times (min 0.2us) and higher throughput than 20MHz, but requires a bit more power.

Note: This setting is ‘live’ and will take effect immediately.

HV Polarity

The polarity of the HV supply on the PC5 is not under software control; it is configured in hardware, via jumpers set at the factory. This software configuration setting tells the DP5 what polarity is required, and the DP5 will not allow the PC5 to turn on if its polarity doesn’t match the Boot Flag.

o           Negative: Amptek’s SDD detectors require negative HV.

o           Postive: All other Amptek detectors require positive HV.

Note: This setting requires the DP5 to be power-cycled to take effect.

ADC Invert

This setting is only used in DP4 Emulation Mode. In PX4 Emulation Mode, the polarity is commanded via the configuration packet.

o           Inverting: Used for SDDs and other positive-pulse preamps. (ADC Inversion, combined with the DP5’s inverting front-end results in a non-inverting input.)

o           Non-inverting: Used with negative-pulse preamps (all Amptek non-SDD preamps.)

Note: This setting requires the DP5 to be power-cycled to take effect.

Fast Channel Shaping

o           Normal: The fast channel peaking time is 400nS (for a 20MHz clock) or 100nS (at 80MHz).

o           4x Slower: The fast channel peaking time is 1.6uS (for a 20MHz clock) or 400nS (at 80MHz).

Note: This setting requires the DP5 to be power-cycled to take effect.

Spectrum Offset

o           None: No spectrum offset is applied – the spectrum zero is derived soley from BLR.

o           Use Offset: The Boot Option ‘Spectrum Offset’ is added to BLR. This shifts the spectrum left or right along the horizontal axis. This permits channel “zero” to have “zero” energy.

Note: This setting is ‘live’ and will take effect immediately. To change the spectrum offset, set this option to ‘Use Offset”, click ‘OK’, then ‘Set DP5 Boot Flags.’ Next, read the boot flags again by selecting the ‘Get Boot Options from DPP’ button. This will enable the ‘DP5 Spectrum Offset’ box, where the offset channel can be entered and set.

Peak Detect

o           Max only (normal operation): This is the correct setting for normal operation.

o           Max and min: This allows the peak detect (and MCA) to capture local minima of the shaped pulse stream, in addition to local maxima. This is useful for capturing the ‘noise Gaussian’ for determining the true spectrum zero. (The slow threshold must be set very low to accomplish this.)

Note: This setting is ‘live’ and will take effect immediately. It is also volatile – it will reset to ‘Max only’ the next time the DP5 is powered on.

MCA Channel

o           Slow channel (normal operation): This is the correct setting for normal operation.

o           Fast channel: This sets the source for the MCA to the fast channel, rather than the slow channel. The fast channel does not have BLR or a pole-zero, but this setting does allow some insight into the operation of the fast channel.

Note: This setting is ‘live’ and will take effect immediately. It is also volatile – it will reset to ‘Slow channel’ the next time the DP5 is powered on.

4. Uploading Firmware and Software

One of the major upgrades of the DP5 (compared to the PX4 and DP4) is the ability to upload new FPGA and microcontroller firmware through the RS232 interface. An FPGA upload takes approximately 40 seconds and a microcontroller code upload takes around 3 seconds.

To upload updated firmware:

1. New firmware files will need to be acquired, either via email from Amptek, or via the Amptek.com website.[DS1]

2. Install the DP5Loader application from the Amptek CD. The installer is located at \Additional DPP Software\DP5\DP5 Upload Utility\SWSETUP\SETUP.EXE on the CDROM.

3. Connect the 9-pin-to-stereo-plug RS232 cable that came with the DP5 between a PC serial port and the DP5, and apply power to the DP5.

4. Run DP5Loader.EXE (which you installed in Step #2).

5. Double-click the COM port that the DP5 is connected to.

6. Click 'Check Device Communications / Get Status'. This will show 'READY' if it successfully finds the DP5, or ERROR if not. For example, these screen shots show updating a DP5 from FW 5.02 & FP 5.02 to FW 5.03 & FP 5.03:

7. Select upload type "FPGA".

8. Click the 'Upload FPGA/uC HEX File' and select the FPGA programming file ('_dp5_fpga_v502.mcs' for example. All FPGA programming files have an .mcs extension.) It will take around 40 seconds to program at 115kbaud.

9. The program says 'Reboot and check device'. Power cycle the DP5.

10. Click 'Exit.'

11. Run DP5Loader.EXE again.

12. Click 'Check Device Communications / Get Status'. It should now show the version number of the FPGA you uploaded (5.3, for the example below), and the old Firmware version.

13. Select upload type "uC".

14. Click the 'Upload FPGA/uC HEX File' and select the microcontroller programming file ('dp5_uC_v503.hex' for example – uC programming files have the .hex extension.) It will take around 4 seconds to program at 115kbaud.

15. The program says 'Reboot and check device'. Power cycle the DP5 again and exit the program.

16. Run DP5Loader.EXE again and click 'Check Device Communications / Get Status' to confirm the Firmware & FPGA versions – in this example, Firmware 5.3 & FPGA 5.3. All done!


DP5 VB Cut/Paste Updates For DppApi

Changes from 1.0.1.4 to 1.0.2.6 DppApi

The DPPAPI has been updated to include the DP5.

A detailed explanation is provided below.

1.0 - New DPP/DP5 Functions

      FPGA clock functions have been added (DP5 only)

      A generic a generic DPP Vendor Request has been added

2.0 - The device type value has been changed

3.0 - Read the DP5 status before configuring or reading configuration files.

      If you are working with DP5 configurations file only, set the FPGA clock

      before reading configuration files.

      This enables the DppApi to the interpret the correct configuration values.

4.0 - FYI... More helpful information:

            DPP API Reference

            1.1.4 The DPPAPI Device Index

            1.1.5 DPP Status

            1.1.6 DPP Configuration

            1.1.7 DP5 Configuration Notes

            1.1.8 DP5 Boot Options

'=============================================================

'1.0 New DPP/DP5 Functions

' Get80MHzMode -  get 80MHzMode for DP5 only, returns true if DP5 and in 80MHzMode

' Run GetStatusStruct or GetStatusString before running Get80MHzMode

PublicDeclare Function Get80MHzMode Lib "DppApi.dll" (ByVal objptr As Long) As Long

' SetFPGAClockDefault -  set 80MHzMode for DP5 only

PublicDeclare Sub SetFPGAClockDefault Lib "DppApi.dll" (ByVal objptr As Long, ByVal b80MHzMode As Integer, ByVal DppDeviceType As Byte)

' SendDPPVendorRequest -  Sends a generic DPP Vendor Request to the default usb device

PublicDeclare Sub SendDppVendorRequest Lib "DppApi.dll" (ByVal objptr As Long, ByVal Request As Integer, ByVal value As Integer)

'=============================================================

'=============================================================

'2.0 The DPP Device Type

' determining the device type:

      'a quick way to get the serial number and device type is to use GetUSBDppDeviceInfo

      DppDevice = GetUSBDppDeviceInfo(objDppApi, USBDevNum, DppSerialNumber) ' get device information

'OR

      indDPP5 = (StatusLst.Firmware >= 5.0)  'DPP5 20071023 indicates DPP5 type device

      DppDevice = ((indDPP5 * 2) + (StatusLst.StatDevInd * 1)) + 1

' new device type values

'Amptek DPP Device Types

PublicConst DPPNONE = &H0    ' no dpp device

PublicConst DPPDP4 = &H1     'dp4

PublicConst DPPPX4 = &H2     'px4

PublicConst DPPDP4EMUL = &H3 'dp5 (dp4 emulation)

PublicConst DPPDP5 = &H4     'dp5 (px4 emulation)

' !!!! new device values must be used for functions requiring a device type value !!!!!

'=============================================================

'=============================================================

'3.0 Read DP5 Status or set the FPGA clock before configuration.

      NOTE 1: Reading the DP5 Status from the DP5 automatically sets the DppApi FPGA Clock Mode.

      NOTE 2: The FPGA clock only applies to the DP5.

' The FPGA Clock Default must be set to correctly read DP5 configuration files.

' Run GetStatusStruct or GetStatusString before running Get80MHzMode

Dpp80MHzMode = Get80MHzMode(objDppApi)                      ' get clock value

SetFPGAClockDefault objDppApi, Dpp80MHzMode, DppDevice      ' set clock value

' --- Example of the OLD configuration read ---

'loads a configuration form file

PrivateSub cmdConfigLoadFromFile_Click()

    Dim strFileName As String

    Dim lenFilename As Long

    Dim DppDeviceType As Byte

    If (objDppApi = 0) Then Exit Sub            'exit sub if api is not present

    If (dlgOpen(cmnDlg, dlgCFG_Filter)) Then

        strFileName = cmnDlg.filename

        lenFilename = Len(strFileName)

        DppDeviceType = Abs(OptDPPType(0).value * 0) + Abs(OptDPPType(1).value * 1)

        GetConfigFromFile objDppApi, strFileName, lenFilename, DppDeviceType

        UpdateConfigDisplay

        EnableControls True

        pnlStatus = "Configuration loaded from file."

    Else

        pnlStatus = "File load cancelled."

    End If

EndSub

' Example of the new configuration read with no device attached

'loads a configuration form file

PrivateSub cmdConfigLoadFromFile_Click()

    Dim strFileName As String

    Dim lenFilename As Long

    Dim DppDeviceType As Byte

    If (objDppApi = 0) Then Exit Sub            'exit sub if api is not present

    If (dlgOpen(cmnDlg, dlgCFG_Filter)) Then

        strFileName = cmnDlg.filename

        lenFilename = Len(strFileName)

        DppDeviceType = GetOption(OptDPPType) + 1

        If (DppDeviceType > DPPPX4) Then

            fraFPGAClock.Visible = True

        Else

            fraFPGAClock.Visible = False

        End If

        If ((DppDeviceType = DPPDP4EMUL) Or (DppDeviceType = DPPDP5)) Then

            Dpp80MHzMode = GetOption(optFPGAClock)

            SetFPGAClockDefault objDppApi, Dpp80MHzMode, DppDeviceType

        End If

        GetConfigFromFile objDppApi, strFileName, lenFilename, DppDeviceType

        UpdateConfigDisplay

        EnableControls True

        pnlStatus = "Configuration loaded from file."

    Else

        pnlStatus = "File load cancelled."

    End If

EndSub

'=============================================================

'=============================================================

4.0 - FYI... More helpful information:

DP4/PX4/DP5 Digital Pulse Processor API Reference

1.1.4 The DPPAPI Device Index

The DPPAPI stores a copy of the DPP device index to determine which USB device to communicate to. Only two functions can change this value, OpenDppApi and OpenUSBDeviceEx. The DPPAPI device index defaults to one when the DPPAPI is first opened (OpenDppApi). Calls to OpenUSBDeviceEx changes the DPPAPI device index to the selected device.

OpenUSBDevice always opens the first device if only one device is used and opens the last index called by OpenUSBDeviceEx otherwise. The DPPAPI device index can be reset by reopening the DPPAPI or calling OpenUSBDeviceEx with an index of one.

1.1.5 DPP Status

The status can be read in a number of formats. Status formats include display string, byte block, and status structure. DPP status includes identification, configuration, monitor, and acquisition information. GetStatusStruct returns the status in a structure. Status returned in a status structure can tested and displayed. Example functions are provided demonstrating how to check the DPP status.

1.1.6 DPP Configuration

The DPP and the DPPAPI must each have a working configuration to perform data acquisition. The DPP and the DPPAPI can get their configurations from different sources. The simplest example is a PX4 that has been configured at power-up by holding the power button down until the device beeps twice. The PX4 configuration has been loaded at power-up, so the only remaining configuration task is to get the configuration being used from the PX4 by calling GetConfigFromDpp. This copies the configuration stored in the PX4 hardware and loads the configuration into the DPPAPI program. Even though the PX4 is configured, the DPPAPI must have the configuration to properly acquire data and perform configuration management.

1.1.7 DP5 Configuration Notes

The DP5 has additional features that add more functionality. The FPGA Clock (DP5 ONLY) allows for more control over peaking time. The DP5 FPGA 80MHz Clock Mode indicator must be set to correctly interpret DP5 configuration file settings. The FPGA 80MHz Clock indicator is set when a DPP status command is issued and a DPP device is attached or when SetFPGAClockDefault sets this value. SetFPGAClockDefault is needed when editing DP5 configuration files without a DP5 device. Get80MHzMode reads the DP5 FPGA 80MHz Clock Mode indicator. The DP5 FPGA Clock setting has 2 speeds, 20MHz (normal speed = 1) and 80MHz (high speed = 1). Always read the status before configuring a DP5.

1.1.8 DP5 Boot Options

DP5 Boot Options allow new configuration options not available with either the DP4 or the PX4. GetBootOptionsStruct reads the DP5 Boot Options. DP5 Boot Options can be changed calling SendDppVendorRequest with corresponding Vendor Request values.

'=============================================================


DP4/PX4/DP5 RTD Controls

Rise Time Discrimination (RTD)

DP4/PX4 RTD Controls

RTD Off/On: Enables/disables RTD.

RTD (Slow) Threshold: If RTD is enabled, sets the RTD slow threshold. This threshold applies to the slow channel. Only events exceeding this threshold will be analyzed by the RTD circuit; all events below this threshold are accepted.

RTD Fast Threshold: If RTD is enabled, sets the HWHM for the fast channel. Only events with a HWHM below this value will be accepted.

DP5 RTD Controls

RTD Off/On: Enables/disables RTD.

RTD Ratio: If RTD is enabled, compares the fast channel peak height to the slow channel peak height. If this ratio is sufficiently high (fast risetime), the event is accepted. If this ratio is low, the event is rejected.

RTD Slow Threshold: If RTD is enabled, sets the RTD slow threshold. This threshold applies to the slow channel. Only events exceeding this threshold will be analyzed by the RTD circuit; all events below this threshold are accepted.


modDP5AdditionalFeatures - VB DP5 Additional Features Cut/Paste Updates

Attribute VB_Name = "modDP5AdditionalFeatures"

Option Explicit

'The PX4 configuration file values are the same for the DP5 except for:

'

'1. The DP5 Coarse Gain value goes from 0-15 (See DP5 Gain Control Index).

'2. Peaking Time, Flat Top Width, BLR, and Detector Reset are PX4 values

'   at 20MHzMode and INTERPRETED as 4x faster in 80MHzMode.

'3. RTD has new settings

'

'

'---------------------------------------------------------------------

'1. DP5 Coarse Gain

'---------------------------------------------------------------------

'If you are using the gain helper function GetCoarseGainTextFromSpin,

'These DP5 Coarse Gain values are automatically generated.

'

'Rise Time Discrimination

'RTD Threshold: 0.00% FS

'RTD Fast HWHM: 10

'RTD Ratio=0.0%

'RTD Slow Thresh=19% FS

'DP5 Gain Control Index

'0-1.00

'1-2.22

'2-3.78

'3-5.26

'4-6.56

'5-8.39

'6-10.1

'7-11.31

'8-14.56

'9-17.77

'10-22.42

'11-30.83

'12-38.18

'13-47.47

'14-66.26

'15-102.01

'

'

'---------------------------------------------------------------------

'2. The DPPAPI uses the b80MHzMode flag to indicate the FPGA CLock Mode.

'----------------------------------------------------------------------

' The DP5 has enhanced features. Running the DP5 FPGA Clock

' in 20MHzMode uses the PX4 values.  Running the DP5 in 80MHzMode

' represents 4x faster values.

'

'Run GetStatusStruct or GetStatusString before running Get80MHzMode.

'---------------------------------------------------------------------

'The DP5 has enhanced features

'Running the DP5 in 20MHzMode uses the PX4 values

'Running the DP5 in 80MHzMode represents 4x faster values

Public Sub LoadDP5_NormalOrFastControls()

    GetTempConfigSettings objDppApi, CfgSet, 1     'get the config settings to setup dialog

    Set80MHzModeCfg objDppApi

    LoadPeakingTimes b80MHzMode, cboTimeToPeak

    LoadBLR b80MHzMode, cboBLR

    LoadDetReset b80MHzMode, cboReset

End Sub

Private Sub Set80MHzModeCfg(objDppApi As Long)

    If (objDppApi = 0) Then Exit Sub            'only run if api is already running

    'Run GetStatusStruct or GetStatusString before running Get80MHzMode.

    b80MHzMode = CBool(Get80MHzMode(objDppApi))

End Sub

Public Sub LoadPeakingTimes(b80MHzMode As Boolean, cboList As ComboBox)

    If (b80MHzMode) Then

        FastPeakingTimes cboList

    Else

        NormalPeakingTimes cboList

    End If

End Sub

Public Sub FastPeakingTimes(cboList As ComboBox)

    cboList.Clear

    cboList.AddItem "0.2uS"

    cboList.AddItem "0.4uS"

    cboList.AddItem "0.6uS"

    cboList.AddItem "0.8uS"

    cboList.AddItem "1.0uS"

    cboList.AddItem "1.2uS"

    cboList.AddItem "1.4uS"

    cboList.AddItem "1.6uS"

    cboList.AddItem "2.0uS"

    cboList.AddItem "2.4uS"

    cboList.AddItem "2.8uS"

    cboList.AddItem "3.2uS"

    cboList.AddItem "4.0uS"

    cboList.AddItem "4.8uS"

    cboList.AddItem "5.6uS"

    cboList.AddItem "6.4uS"

    cboList.AddItem "8.0uS"

    cboList.AddItem "9.6uS"

    cboList.AddItem "11.2uS"

    cboList.AddItem "12.8uS"

    cboList.AddItem "16.0uS"

    cboList.AddItem "19.2uS"

    cboList.AddItem "22.4uS"

    cboList.AddItem "25.6uS"

End Sub

Public Sub NormalPeakingTimes(cboList As ComboBox)

    cboList.Clear

    cboList.AddItem "0.8uS"

    cboList.AddItem "1.6uS"

    cboList.AddItem "2.4uS"

    cboList.AddItem "3.2uS"

    cboList.AddItem "4.0uS"

    cboList.AddItem "4.8uS"

    cboList.AddItem "5.6uS"

    cboList.AddItem "6.4uS"

    cboList.AddItem "8.0uS"

    cboList.AddItem "9.6uS"

    cboList.AddItem "11.2uS"

    cboList.AddItem "12.8uS"

    cboList.AddItem "16.0uS"

    cboList.AddItem "19.2uS"

    cboList.AddItem "22.4uS"

    cboList.AddItem "25.6uS"

    cboList.AddItem "32.0uS"

    cboList.AddItem "38.4uS"

    cboList.AddItem "44.8uS"

    cboList.AddItem "51.2uS"

    cboList.AddItem "64.0uS"

    cboList.AddItem "76.8uS"

    cboList.AddItem "89.6uS"

    cboList.AddItem "102.4uS"

End Sub

Public Sub LoadFlatTopWidth(b80MHzMode As Boolean, Decimation As Byte, cboFlatTop As ComboBox)

    Dim dblPeakingMult As Double

    Dim dblFlatTop As Double

    Dim idxFlatTop As Integer

    Dim strFormat As String

    dblPeakingMult = 1#

    strFormat = "0.0"

    If (b80MHzMode) Then

        dblPeakingMult = 0.25

        If (Decimation = 1) Then strFormat = "0.00"

    End If

    cboFlatTop.Clear

    For idxFlatTop = 1 To 16

        dblFlatTop = (idxFlatTop * 0.1 * (2 ^ Decimation)) * dblPeakingMult

        cboFlatTop.AddItem Trim(Format(dblFlatTop, strFormat) + "uS")

    Next idxFlatTop

End Sub

Public Sub LoadBLR(b80MHzMode As Boolean, cboList As ComboBox)

    If (b80MHzMode) Then

        FastBLR cboList

    Else

        NormalBLR cboList

    End If

End Sub

Public Sub FastBLR(cboList As ComboBox)

    cboList.Clear

    cboList.AddItem "BLR: OFF"

    cboList.AddItem "BLR:ON---DOWN:4:SLOW---UP:4:SLOW"

    cboList.AddItem "BLR:ON---DOWN:4:SLOW---UP:16:MEDIUM"

    cboList.AddItem "BLR:ON---DOWN:4:SLOW---UP:64:FAST"

    cboList.AddItem "BLR:ON---DOWN:4:SLOW---UP:256:VERY FAST"

    cboList.AddItem "BLR:ON---DOWN:16:MEDIUM---UP:4:SLOW"

    cboList.AddItem "BLR:ON---DOWN:16:MEDIUM---UP:16:MEDIUM"

    cboList.AddItem "BLR:ON---DOWN:16:MEDIUM---UP:64:FAST"

    cboList.AddItem "BLR:ON---DOWN:16:MEDIUM---UP:256:VERY FAST"

    cboList.AddItem "BLR:ON---DOWN:64:FAST---UP:4:SLOW"

    cboList.AddItem "BLR:ON---DOWN:64:FAST---UP:16:MEDIUM"

    cboList.AddItem "BLR:ON---DOWN:64:FAST---UP:64:FAST"

    cboList.AddItem "BLR:ON---DOWN:64:FAST---UP:256:VERY FAST"

    cboList.AddItem "BLR:ON---DOWN:256:VERY FAST---UP:4:SLOW"

    cboList.AddItem "BLR:ON---DOWN:256:VERY FAST---UP:16:MEDIUM"

    cboList.AddItem "BLR:ON---DOWN:256:VERY FAST---UP:64:FAST"

    cboList.AddItem "BLR:ON---DOWN:256:VERY FAST---UP:256:VERY FAST"

End Sub

Public Sub NormalBLR(cboList As ComboBox)

    cboList.Clear

    cboList.AddItem "BLR: OFF"

    cboList.AddItem "BLR:ON---DOWN:1:VERY SLOW---UP:1:VERY SLOW"

    cboList.AddItem "BLR:ON---DOWN:1:VERY SLOW---UP:4:SLOW"

    cboList.AddItem "BLR:ON---DOWN:1:VERY SLOW---UP:16:MEDIUM"

    cboList.AddItem "BLR:ON---DOWN:1:VERY SLOW---UP:64:FAST"

    cboList.AddItem "BLR:ON---DOWN:4:SLOW---UP:1:VERY SLOW"

    cboList.AddItem "BLR:ON---DOWN:4:SLOW---UP:4:SLOW"

    cboList.AddItem "BLR:ON---DOWN:4:SLOW---UP:16:MEDIUM"

    cboList.AddItem "BLR:ON---DOWN:4:SLOW---UP:64:FAST"

    cboList.AddItem "BLR:ON---DOWN:16:MEDIUM---UP:1:VERY SLOW"

    cboList.AddItem "BLR:ON---DOWN:16:MEDIUM---UP:4:SLOW"

    cboList.AddItem "BLR:ON---DOWN:16:MEDIUM---UP:16:MEDIUM"

    cboList.AddItem "BLR:ON---DOWN:16:MEDIUM---UP:64:FAST"

    cboList.AddItem "BLR:ON---DOWN:64:FAST---UP:1:VERY SLOW"

    cboList.AddItem "BLR:ON---DOWN:64:FAST---UP:4:SLOW"

    cboList.AddItem "BLR:ON---DOWN:64:FAST---UP:16:MEDIUM"

    cboList.AddItem "BLR:ON---DOWN:64:FAST---UP:64:FAST"

End Sub

Public Sub LoadDetReset(b80MHzMode As Boolean, cboList As ComboBox)

    If (b80MHzMode) Then

        FastDetReset cboList

    Else

        NormalDetReset cboList

    End If

End Sub

Public Sub FastDetReset(cboList As ComboBox)

    cboList.Clear

    cboList.AddItem "Slow - 3.28mS"

    cboList.AddItem "Slow - 1.64mS"

    cboList.AddItem "Slow - 819uS"

    cboList.AddItem "Slow - 410uS"

    cboList.AddItem "Fast - 205uS"

    cboList.AddItem "Fast - 102uS"

    cboList.AddItem "Fast - 51.2uS"

    cboList.AddItem "Fast - 25.6uS"

    cboList.AddItem "OFF"

End Sub

Public Sub NormalDetReset(cboList As ComboBox)

    cboList.Clear

    cboList.AddItem "Slow - 13.1mS"

    cboList.AddItem "Slow - 6.55mS"

    cboList.AddItem "Slow - 3.28mS"

    cboList.AddItem "Slow - 1.64mS"

    cboList.AddItem "Fast - 819uS"

    cboList.AddItem "Fast - 410uS"

    cboList.AddItem "Fast - 205uS"

    cboList.AddItem "Fast - 102uS"

    cboList.AddItem "OFF"

End Sub

'---------------------------------------------------------------------

'3. RTD has new settings

'---------------------------------------------------------------------

'

' DP4/PX4 RTD Controls: RTD (Slow) Threshold, RTD Fast HWHM

' DP5 RTD Controls: RTD Ratio, RTD Slow Threshold

'

Public Sub RTDSlowStr(mRTDSlow As Integer)

    Dim dblRTDSlow As Double

    If (DppDevice > DPPPX4) Then

        dblRTDSlow = CDbl((CDbl(mRTDSlow) / 64# * 100#))

        lblRTDSlow = "RTD Ratio=" & Format(dblRTDSlow, "0.0") & "%"

    Else

        dblRTDSlow = CDbl((CDbl(mRTDSlow) * 100# / 512# * 100#) / 100#)

        lblRTDSlow = "RTD Threshold=" & Format(dblRTDSlow, "0.00") & "% FS"

    End If

End Sub

Public Sub RTDFastStr(mRTDFast As Integer)

    Dim dblRTDFast As Double

    If (DppDevice > DPPPX4) Then

        dblRTDFast = CDbl((CDbl(mRTDFast - 4#) * 16# / 512#) * 100#)

        lblRTDFast = "RTD Slow Thres=" & Format(dblRTDFast, "0") & "% FS"

    Else

        lblRTDFast = "RTD Fast HWHM=" & mRTDFast

    End If

End Sub


DppApi.h Header File

#pragma once

#if !defined(DPPAPI_H)

#define DPPAPI_H

//--------------------------------------------------------------------------------------

// @doc DPPAPI

//

// Amptek _ DPP API Function Prototypes

//

// @module _ DPPAPI Introduction | Interface to the DPP Application functions.

//

// The DP4/PX4/DP5 Digital Pulse Processor API (DPPAPI) is the Application

// Programming Interface Library for Amptek DP4, PX4 and DP5 Digital

// Pulse Processors (DPPs).

//

// Copyright (c)2005, 2007, 2009 Amptek, All Rights Reserved

//

// @devnote Application programs invoke DPPAPI functions to establish

// communication with DPP, control its operation, and retrieve data.

// DPPAPI is distributed in two forms, as an object link library (.LIB)

// or Dynamic Link Library (.DLL).  The application executable programs (.EXE)

// are created by linking the application code with one of these libraries

// statically or dynamically (see Microsoft documentation about program linking).

// The applications can be developed in C, Visual Basic or many other languages.

//

// @devnote Version: v20050729_1423

//

// @head3 _ DPPAPI Introduction |

// @index struct func | DPPAPI

//

//--------------------------------------------------------------------------------------

#include "stdafx.h"

// @struct DPP_CONFIG_SETTINGS | DPP Configuration Settings Storage Type

typedef struct _DPP_CONFIG_SETTINGS {

    //MCA Properties

      byte AcqMode;                 // @field acquisition mode 0=MCA,1=MCS

      byte MCSTimebase;       // @field MCS timebase value (0-15) see CAcqMode

      byte MCAChannels;       // @field number of channels 4=256,3=512,2=1024,1=2048,0=4096,5=8192

      byte BufferSelect;            // @field Holds Buffer Sel A&B,Buffer Sel Hardware,see DPPBufferSelect

      byte TTLGate;                 // @field gate input settings, determines events included/excluded from spectrum, see DPPGate

      byte SlowThreshold;           // @field Slow ch threshold, Events w/amp lower not added to spectrum

      long PresetTime;        // @field var holds preset time, used in usb

      long PresetCount;       // @field preset count in selected channels, ch are set in SCA8

      long SCA[8];                  // @field SCA values, LL, UL, and Enable are stored together

    //Shaping Properties

      byte TimeToPeak;        // @field TimeToPeak register setting

      byte Decimation;        // @field decimation setting for pulse shaping

      byte FlatTop;                 // @field flatop register setting

      byte PUREnable;               // @field pile-up rejection enabled

      byte FastThreshold;           // @field Fast Ch Threshold, events w/fch amp below this are rejected

      byte RTDSlow;                 // @field Risetime Discrimination slow threshold

      byte RTDOn;                   // @field Turns RTD on, and sets the amplitude and timing thresholds

      byte RTDFast;                 // @field RTD Time Threshold,Events w/HWHM wider than this are rejected

      byte BLR;                     // @field Baseline Restoration, see udBLR.Value notes for values

      byte BaselineOn;        // @field use autobaseline during detector reset

    //Gain PZ Properties

      byte CoarseGain;        // @field stores current coarse gain value

      long FineGain;                // @field stores current fine gain value

      long PoleZero;                // @field pole zero adjust value

      long InputOffset;       // @field input offset

      byte InputPolarity;           // @field use InvertEnable during detector reset

      byte DetReset;                // @field detector reset lockout period

    //Power Properties

      long TEC;                     // @field TEC temperature setting (displayed in Kelvin)

      byte HVEnabled;               // @field high voltage setting enable

      long HV;                      // @field high voltage setting value

      byte PreampPower;       // @field preamp power select value (5v or 8.5v)

    //Misc Properties

      byte AnalogOut;               // @field dac enabled and DAC output type,(stobed peak,shaped pulse,dec inp,fast ch)

      byte OutputOffset;            // @field Output DAC offset, -64…+63,(signed)(D7-D1) (-500mV to +492mV)

      byte AuxOut;                  // @field Aux output type

      byte AudibleCounter;    // @field audio volume setting

} DPP_CONFIG_SETTINGS, *LP_DPP_CONFIG_SETTINGS;

// @struct DPP_STATUS | DPP Status Storage Type

typedef struct _DPP_STATUS {

      // Identification

      double FPGA;                        // @field FPGA

      double Firmware;              // @field firmware revision

      double SerialNumber;                // @field unit serial number

      byte StatDevInd;              // @field device indicator from status block (0=dp4,1=px4)

      // Configuration

      byte BootStatus;              // @field boot status byte (PwrBtnConfig,SwConfigRcvd,McaEnabled)

      byte PwrBtnConfig;                  // @field dpp has loaded config from power button

      byte SwConfigRcvd;                  // @field software has sent valid config to unit since startup

      // Tuning

      byte SetFastThreshDone;       // @field DPP tune fast thresh has successfully done

      byte SetSlowThreshDone;       // @field DPP tune slow thresh has successfully done (NOT USED)

      byte SetInputOffsetDone;      // @field DPP tune input offset has successfully done

      // Monitors

      double BoardTemp;             // @field board temperature monitor value

      double HVMonitor;             // @field high voltage monitor value

      double TECMonitor;                  // @field TEC temperature monitor value (displayed in Kelvin)

      // Acquisition Parameters

      double FastCount;             // @field fast channel count

      double SlowCount;             // @field slow channel count

      double AccumulationTime;      // @field real time duration of present data acquisition interval

      // Acquisition Mode

      byte StatMcaEnabled;          // @field mca enabled status, high during acq, preset time resets flag

      byte MCSDone;                       // @field MCS done flag 1=finished, 0=not finished

      byte PresetCountExpired;      // @field indicates presets counts have been reached

} DPP_STATUS, *LP_DPP_STATUS;

// @struct DPP_BOOT_STATUS | DPP Boot Options Status Storage Type

typedef struct _DPP_BOOT_OPTIONS {

      USHORT BootFlags;             // @field Boot flags (MSB currently unused)

      USHORT HVDACSet;              // @field HV DAC setting (not used in PX4 mode)

      USHORT TECDACSet;             // @field TEC DAC setting (not used in PX4 mode)

      USHORT InputOffsetTuning;     // @field Input offset DAC setting (not used in PX4 mode)

      USHORT uCTempCal;             // @field uC temp cal

      USHORT SpectrumOffset;        // @field Spectrum offset

} DPP_BOOT_OPTIONS, *LP_DPP_BOOT_OPTIONS;

// =================================================================================

// === DPPAPI Constructor Functions ================================================

// =================================================================================

// @doc CONSTRUCT

//

// @module DPPAPI Constructor Functions | Opens the DPP Application functions.

//

// DPPAPI Constructor Functions create, initialize and close the DPPAPI.  Opening the

// DPPAPI with OpenDppApi creates and initializes an instance of the DPPAPI.  The

// DPPAPI instance manages and stores DPP data, configurations, and controls

// communication.

//

// Copyright (c)2005, 2007 Amptek, All Rights Reserved

//

// @devnote All other DPPAPI functions need the DPPAPI to be opened before being

// called.  When all DPPAPI operations are completed and before the application

// is closed, the DPPAPI must be closed with CloseDppApi.

//

// @head3 DPPAPI Constructor Functions |

// @index func | CONSTRUCT

//--------------------------------------------------------------------------------------

// @func Creates and initializes an instance of the DPPAPI.

// @rdesc Returns an object pointer handle to the DPPAPI.

void * __stdcall OpenDppApi();

// @func Closes the current instance of the DPPAPI.

void __stdcall CloseDppApi(

                                    void * objptr)                      // @parm Pointer to the DPPAPI.

                                       ;

// =================================================================================

// === USB Manager Functions =======================================================

// =================================================================================

// @doc USB

//

// @module USB Manager Functions | USB Manager Functions provide USB device control.

//

// USB Manager Functions provide USB device control.  All USB communications to the

// DPP require that the USB device be open for the corresponding DPP.  When a USB

// device is opened with OpenUSBDevice communications are opened to the DPP.  All

// USB functions are handled within the DPPAPI.

//

// Copyright (c)2005, 2007 Amptek, All Rights Reserved

//

// @devnote Once all USB operations are completed and before the DPPAPI is closed

// the USB device should be closed with CloseUSBDevice.  The number of USB device

// connections can be monitored with MonitorUSBDppDevices.  If a device has been

// disconnected, MonitorUSBDppDevices will indicate the number of devices has

// decreased and appropriate action can be taken.

//

// @head3 USB Manager Functions |

// @index func | USB

//--------------------------------------------------------------------------------------

// @func Opens the USB current device for communications.

// @rdesc Returns the number of Amptek USB devices detected.

int __stdcall OpenUSBDevice(

                                          void * objptr)                // @parm Pointer to the DPPAPI.

                                          ;

// @func Opens the USB selected device for communications.

// @rdesc Returns the number of Amptek USB devices detected.

int __stdcall OpenUSBDeviceEx(

                                          void * objptr,                // @parm Pointer to the DPPAPI.

                                          long Device)                  // @parm selected USB DPP device

                                          ;

// @func Closes the USB current device for communications.

void __stdcall CloseUSBDevice(

                                            void * objptr)        // @parm Pointer to the DPPAPI.

                                            ;

// @func Monitors the USB current device to determine if connected and communicating.

// @rdesc Returns the number of Amptek USB devices detected.

int __stdcall MonitorUSBDppDevices(

                                                   void * objptr) // @parm Pointer to the DPPAPI.

                                                   ;

// @func Get device information (serial number and type) for the selected usb device.

// @rdesc Returns the type Amptek USB device detected.

//

//     Amptek DPP USB devices

//

//         DPPNONE = 0x0            // none

//

//         DPPDP4 = 0x1             // DP4

//

//         DPPPX4 = 0x2             // PX4

//

//         DPPDP4EMUL = 0x3         // DP5 with DP4 Emulation

//

//         DPPPX4EMUL = 0x4         // DP5 with PX4 Emulation (Same as DPPDP5)

//

//         DPPDP5 = 0x4             // DP5 with PX4 Emulation

//

//

int __stdcall GetUSBDppDeviceInfo(

                                          void * objptr,                // @parm Pointer to the DPPAPI.

                                          long Device,                  // @parm selected USB DPP device

                                          long *lSerialNumber)    // @parm serial number of device

                                          ;

// =================================================================================

// === Configuration Transfer Functions ============================================

// =================================================================================

// @doc CONFIG

//

// @module Configuration Transfer Functions | Configuration Transfer Functions

// provide device configuration services.

//

// Configuration Transfer Functions sets and transfers configurations to and

// from the current DPP, the DPPAPI and selected Amptek DPP configuration files.

//

// Copyright (c)2005, 2007 Amptek, All Rights Reserved

//

// @devnote The DPPAPI and the current DPP must be configured before data

// acquisition operations can begin.

//

// @head3 Configuration Transfer Functions |

// @index func | CONFIG

//--------------------------------------------------------------------------------------

// @func Loads the stored configuration from the DPP USB into the DPPAPI.

void __stdcall GetConfigFromDpp(

                                                void * objptr)                // @parm Pointer to the DPPAPI.

                                                ;

// @func Sends the current configuration from the DPPAPI to the DPP USB.

void __stdcall SendConfigToDpp(

                                             void * objptr)             // @parm Pointer to the DPPAPI.

                                             ;

// @func Loads the stored configuration read from the DPP (stored in a byte block) into the DPPAPI.

void __stdcall GetConfigFromBuffer(

                                                void * objptr,                // @parm Pointer to the DPPAPI.

                                                UCHAR ConfigBuffer[],   // configuration buffer read from the dpp stored in a byte block

                                                byte DPPDeviceType)     // the current device type (default is 1=DP4)

                                                ;

// @func Sends the current configuration from the DPPAPI to a configuration buffer.

void __stdcall SendConfigToBuffer(

                                             void * objptr,             // @parm Pointer to the DPPAPI.

                                             UCHAR ConfigBuffer[],      // dppapi configuration stored in a byte block

                                             long *Preset)              // preset setting

                                             ;

// @func Loads a configuration from a DPP configuration file into the DPPAPI.

// @devnote DPP Device Type (1=DP4,2=PX4,3=DP5(DP4 Emulation),4=DP5(Px4 Emulation))

// If no device type or an invalid device type is selected, DPPDeviceType defaults to PX4.

void __stdcall GetConfigFromFile(

                                                 void * objptr,         // @parm Pointer to the DPPAPI.

                                                 LPCSTR pszFilename,    // @parm Dpp configuration filename.

                                                 LONG cSize,                  // @parm Character buffer size.

                                                 byte DPPDeviceType)    // @parm DPP Device Type

                                                 ;

// @func Sends the current configuration from the DPPAPI to a DPP configuration file.

void __stdcall SaveConfigToFile(

                                                void * objptr,                // @parm Pointer to the DPPAPI.

                                                LPCSTR pszFilename,           // @parm Dpp configuration filename.

                                                LONG cSize)                   // @parm Character buffer size.

                                                ;

// @func Creates display formatted copy of the current DPPAPI configuration.

void __stdcall GetConfigString(

                                             void * objptr,                   // @parm Pointer to the DPPAPI.

                                             LPSTR pszConfig,                 // @parm Configuration display string.

                                             LONG cSize)                      // @parm Character buffer size.

                                             ;

// @func Copies selected configuration to a DPP_CONFIG_SETTINGS structure.

// @devnote If UpdateCurrent is selected, the configuration is copied from the

// current DPPAPI configuration settings.  If UpdateCurrent is not selected,

// the last temporary configuration storage is used.

void __stdcall GetTempConfigSettings(

                                                       void * objptr,                     // @parm Pointer to the DPPAPI.

                                                       DPP_CONFIG_SETTINGS *CfgSet, // @parm Configuration settings.

                                                       BOOLEAN CurrentUpdate)             // @parm Current settings update.

                                                       ;

// @func Copies the selected settings from a DPP_CONFIG_SETTINGS data structure.

// @devnote If UpdateCurrent is selected, the temporary configuration is also copied

// to the current DPPAPI configuration settings.  Current DPPAPI configuration settings

// can be used to configure the DPP or be saved to a configuration file for storage.

void __stdcall SetTempConfigSettings(

                                                       void * objptr,                     // @parm Pointer to the DPPAPI.

                                                       DPP_CONFIG_SETTINGS *CfgSet, // @parm Configuration settings.

                                                       BOOLEAN CurrentUpdate)             // @parm Current settings update.

                                                       ;

// @func Creates a display formatted copy of the temporary DPPAPI configuration.

void __stdcall GetTempConfigString(

                                                   void * objptr,             // @parm Pointer to the DPPAPI.

                                                   LPSTR pszConfig,     // @parm Configuration display string.

                                                   LONG cSize)                // @parm Character buffer size.

                                                   ;

// @func Gets FPGA 80MHz Clock Mode for DP5 only, returns true if is a DP5 and in 80MHz Mode.

// @devnote The FPGA 80MHz Clock Mode indicator is set when a DPP status command is issued

// and a DPP device is attached or when SetFPGAClockDefault sets this value.  The DP5 FPGA 80MHz

// Clock Mode must be set to correctly interpret DP5 configuration file settings.

//

//Run GetStatusStruct or GetStatusString before running Get80MHzMode

//

long __stdcall Get80MHzMode(

                                          void * objptr)                      // @parm Pointer to the DPPAPI.

                                          ;

// @func Sets FPGA 80MHz Clock Mode indicator for DP5 only

// @devnote The DP5 FPGA 80MHz Clock Mode indicator must be set to correctly interpret

// DP5 configuration file settings.  The FPGA 80MHz Clock indicator is set when a

// DPP status command is issued and a DPP device is attached or when SetFPGAClockDefault

// sets this value.  SetFPGAClockDefault is needed when editing DP5 configuration files without

// a DP5 device.

//

void __stdcall SetFPGAClockDefault(

                                                   void * objptr,       // @parm Pointer to the DPPAPI.

                                                   BOOLEAN b80MHzMode,  // @parm 80MHz Mode indicator.

                                                   byte DPPDeviceType)  // @parm DPP Device Type.

                                                   ;

// =================================================================================

// === Status Indicator Functions ==================================================

// =================================================================================

// @doc STATUS

//

// @module Status Indicator Functions | Status Indicator Functions monitor and

// display DPP device information.

//

// Status information is read as a block of data and is converted into display values.

// Status information includes device identification, spectrum accumulation status,

// monitors, and boot status.

//

// Copyright (c)2005, 2007 Amptek, All Rights Reserved

//

// @head3 Status Indicator Functions |

// @index func | STATUS

//--------------------------------------------------------------------------------------

// @func Gets a copy of the current status and stores the data in a string.

// @devnote A spectrum buffer (A or B) is selected to determine which group

// of Spectrum Accumulation Status information to return.

void __stdcall GetStatusString(

                                             void * objptr,             // @parm Pointer to the DPPAPI.

                                             BOOLEAN isBufferA,         // @parm Spectrum data buffer selector.

                                             LPSTR pszStatus,                 // @parm Status character string.

                                             LONG cSize)                      // @parm Character buffer size.

                                             ;

// @func Gets a copy of the current status and stores the data in a string.

// @devnote A spectrum buffer (A or B) is selected to determine which group

// of Spectrum Accumulation Status information to return.

void __stdcall GetStatusStringFromBuffer(

                                             void * objptr,             // @parm Pointer to the DPPAPI.

                                             BOOLEAN isBufferA,         // @parm Spectrum data buffer selector.

                                             LPSTR pszStatus,                 // @parm Status character string.

                                             LONG cSize,                      // @parm Character buffer size.

                                             UCHAR Status[])                  // @parm Status buffer.

                                             ;

// @func Requests the current DPP device and spectrum status raw data.

// @devnote A spectrum buffer (A or B) is selected to determine which group

// of Spectrum Accumulation Status information to return.

void __stdcall GetStatusBuffer(

                                             void * objptr,             // @parm Pointer to the DPPAPI.

                                             BOOLEAN isBufferA,         // @parm Spectrum data buffer selector.

                                             UCHAR Status[])                  // @parm Status buffer.

                                             ;

// @func Returns the current DPP device and spectrum status data in a status structure.

// @devnote A spectrum buffer (A or B) is selected to determine which group

// of Spectrum Accumulation Status information to return.

void __stdcall GetStatusStruct(

                                             void * objptr,                   // @parm Pointer to the DPPAPI.

                                             BOOLEAN isBufferA,               // @parm Spectrum data buffer selector.

                                             DPP_STATUS *StatusStruct)  // @parm Status structure.

                                             ;

///////////////////////////////////////////////////////////////////////////////

// GetBootOptionsStruct -  get the bott option settings of usb device, return in a boot options structure

void __stdcall GetBootOptionsStruct(void * objptr, BOOLEAN isBufferA, DPP_BOOT_OPTIONS *BootOptionsStruct);

// @func Returns the current DPP device and spectrum status data in a status structure.

// @devnote A spectrum buffer (A or B) is selected to determine which group

// of Spectrum Accumulation Status information to return.

void __stdcall GetStatusStructFromBuffer(

                                             void * objptr,                   // @parm Pointer to the DPPAPI.

                                             BOOLEAN isBufferA,               // @parm Spectrum data buffer selector.

                                             DPP_STATUS *StatusStruct,  // @parm Status structure.

                                             UCHAR Status[])                  // @parm Status buffer.

                                             ;

// @func Processes raw status data and stores the status data in the DPPAPI.

// @devnote The raw status data is read from the DPP by calling GetStatusBuffer.

// ProcessStatusBuffer is used to update the DPPAPI to the current DPP status

// without requesting status display information.

void __stdcall ProcessStatusBuffer(

                                                   void * objptr,       // @parm Pointer to the DPPAPI.

                                                   UCHAR Status[])            // @parm Status buffer.

                                                   ;

// @func Processes raw status data, stores the status data in the DPPAPI,

// and returns a status display string.

// @devnote The raw status data is read from the DPP by calling GetStatusBuffer.

// DisplayStatusBuffer is used to update the DPPAPI to the current DPP status

// and request status display information.

void __stdcall DisplayStatusBuffer(

                                                   void * objptr,       // @parm Pointer to the DPPAPI.

                                                   UCHAR Status[],            // @parm Status buffer.

                                                   LPSTR pszStatus,           // @parm Status character string.

                                                   LONG cSize)                // @parm Character buffer size.

                                                   ;

// @func Creates a MCA acquisition file string that includes all

// configuration and status settings.

// @devnote This function formats the additional information for MCA

// spectrum file storage.  This settings string is appended to the end of

// the DPP MCA spectrum file after the spectrum data section.  This

// information is used by the Amptek acquisition software.

void __stdcall CreateMCAFileDPPSettings(

                                                            void * objptr,          // @parm Pointer to the DPPAPI.

                                                            LPSTR pszSettings,  // @parm DPP devices settings.

                                                            LONG cSize)             // @parm Character buffer size.

                                                            ;

// =================================================================================

// === Data Acquisition Functions ==================================================

// =================================================================================

// @doc DATAACQ

//

// @module Data Acquisition Functions | Control data acquisition.

//

// Spectrum information is read as a block of data and is converted into

// histogram ready display values.

//

// Copyright (c)2005, 2007 Amptek, All Rights Reserved

//

// @head3 Data Acquisition Functions |

// @index func | DATAACQ

//--------------------------------------------------------------------------------------

// @func Get the USB DPP spectrum data.

// @rdesc Returns the number of spectrum channels.

int __stdcall GetDppData(

                                    void * objptr,                      // @parm Pointer to the DPPAPI.

                                    long DataBuffer[])                  // @parm Holds the DPP spectrum data.

                                    ;

// @func Clears the USB DPP spectrum data.

void __stdcall ClearDppData(

                                          void * objptr,                // @parm Pointer to the DPPAPI.

                                          BOOLEAN isBufferA)            // @parm Spectrum data buffer selector.

                                          ;

// @func Pauses the USB DPP spectrum data.

void __stdcall PauseDppData(

                                          void * objptr,                // @parm Pointer to the DPPAPI.

                                          BOOLEAN boolPauseData)  // @parm Pause the spectrum data.

                                          ;

// @func Process the USB DPP spectrum data.

// @rdesc Returns the number of spectrum channels.

int __stdcall ProcessDppData(

                                    void * objptr,                      // @parm Pointer to the DPPAPI.

                                    long DataBuffer[],                  // @parm Holds the DPP spectrum data.

                                    UCHAR RawData[],              // @parm Holds pre-processed spectra data.

                                    UINT ByteCount)                     // @parm Holds pre-processed spectra data byte count.

                                    ;

// =================================================================================

// === Configuration Helper Functions ==============================================

// =================================================================================

// @doc CFGHELPER

//

// @module Configuration Helper Functions | help in the display, control and

// conversion of DPP configuration data.

//

// All of the configuration settings have underlying support classes.

// Configuration Helper Functions tap some of the functionality of the underlying

// classes.  The goal is to reduce the amount of support coding necessary to a minimum.

//

// Copyright (c)2005, 2007 Amptek, All Rights Reserved

//

// @head3 Configuration Helper Functions |

// @index func | CFGHELPER

//--------------------------------------------------------------------------------------

// @func Creates an up-down spin control value from a coarse gain display string.

void __stdcall GetCoarseGainSpinFromText(

                                                               void * objptr,       // @parm Pointer to the DPPAPI.

                                                               byte *Spin,          // @parm Up-down spin control setting.

                                                               LPCSTR pszCoarseGain)  // @parm Coarse gain value string.

                                                               ;

// @func Creates a coarse gain display string from a selected up-down spin control value.

void __stdcall GetCoarseGainTextFromSpin(

                                                               void * objptr, // @parm Pointer to the DPPAPI.

                                                               byte Spin,           // @parm Up-down spin control setting.

                                                               LPSTR pszCoarseGain, // @parm Coarse gain value string.

                                                               LONG cSize)          // @parm Character buffer size.

                                                               ;

// @func Creates an output offset display string from a selected up-down spin control value.

void __stdcall GetOutputOffsetTextFromSpin(

                                                               void * objptr, // @parm Pointer to the DPPAPI.

                                                               byte Spin,           // @parm Up-down spin control setting.

                                                               LPSTR pszOffset, // @parm Output offset value string.

                                                               LONG cSize)          // @parm Character buffer size.

                                                               ;

// @func Creates an up-down spin control value from an output offset display string.

void __stdcall GetOutputOffsetSpinFromText(

                                                               void * objptr,       // @parm Pointer to the DPPAPI.

                                                               byte *Spin,          // @parm Up-down spin control setting.

                                                               LPCSTR pszOffset)// @parm Output offset value string.

                                                               ;

// @func Creates a preset time display string from a preset time value.

void __stdcall GetPresetTimeStringFromVal(

                                                              void * objptr,        // @parm Pointer to the DPPAPI.

                                                              long lPresetTime,     // @parm Preset time in tenths of a second.

                                                              LPSTR pszPresetTime,  // @parm Preset time display string.

                                                              LONG cSize)                 // @parm Character buffer size.

                                                              ;

// @func Calculates a preset time value from a preset time display string.

void __stdcall GetPresetTimeValFromString(

                                                              void * objptr,       // @parm Pointer to the DPPAPI.

                                                              long *lPresetTime,    // @parm Preset time in tenths of a second.

                                                              LPCSTR pszPresetTime) // @parm Preset time display string.

                                                              ;

// @func Creates slow threshold percent and channel display strings from an up-down spin control value.

void __stdcall GetSlowThreshStringsFromSpin(

                                                                  void * objptr,          // @parm Pointer to the DPPAPI.

                                                                  byte Spin,              // @parm Up-down spin control setting.

                                                                  LPSTR pszPercent,   // @parm Slow threshold percent display string.

                                                                  LONG cSizePer,          // @parm Size of the percent character buffer.

                                                                  LPSTR pszChannels,      // @parm Slow threshold channel position display string.

                                                                  LONG cSizeChan)         // @parm Size of the channel character buffer.

                                                                  ;

// @func Calculates the up-down spin control value for a given slow threshold percent value.

void __stdcall GetSlowThreshSpinFromPercent(

                                                                  void * objptr,          // @parm Pointer to the DPPAPI.

                                                                  double dblPercent,      // @parm Slow threshold percent of full energy scale.

                                                                  byte *Spin)             // @parm Up-down spin control setting.

                                                                  ;

// @func Calculates the up-down spin control value for a given slow threshold channel value.

void __stdcall GetSlowThreshSpinFromChannel(

                                                                  void * objptr,          // @parm Pointer to the DPPAPI.

                                                                  double dblChannel,      // @parm Slow threshold spectrum channel.

                                                                  byte *Spin)             // @parm Up-down spin control setting.

                                                                  ;

// @func Calculates the time-to-peak and decimation values from an up-down spin control value.

void __stdcall GetTimeToPeakDecimationFromSpin(

                                                                        void * objptr,          // @parm Pointer to the DPPAPI.

                                                                        byte *TimeToPeak,   // @parm Time-to-peak value.

                                                                        byte *Decimation,   // @parm Decimation value.

                                                                        byte Spin)              // @parm Up-down spin control setting.

                                                                        ;

// @func Converts a time-to-peak value to an up-down spin control setting.

// @devnote When a time-to-peak value is known it may be necessary to remotely

// set an up-down spin control.  GetTimeToPeakSpinFromValues uses a time-to-peak

// value a known decimation value to calculate the correct control setting.

void __stdcall GetTimeToPeakSpinFromValues(

                                                                  void * objptr,          // @parm Pointer to the DPPAPI.

                                                                  byte TimeToPeak,    // @parm Time-to-peak value.

                                                                  byte Decimation,    // @parm Decimation value.

                                                                  byte *Spin)             // @parm Up-down spin control setting.

                                                                  ;

// =================================================================================

// === PX4 Text Functions ==========================================================

// =================================================================================

// @doc PX4TEXT

//

// @module PX4 Text Functions | Sets and reads text stored in the PX4.

//

// PX4 Text Functions works for PX4 with FPGA/Firmware Version 3.13 and above.

//

// Copyright (c)2005, 2007 Amptek, All Rights Reserved

//

// @head3 PX4 Text Functions |

// @index func | PX4TEXT

//--------------------------------------------------------------------------------------

// @func Sets the PX4 stored text.

void __stdcall SetPX4Text(

                                          void * objptr,          // @parm Pointer to the DPPAPI.

                                          LPCSTR pszPX4Text)  // @parm PX4 text string.

                                          ;

// @func Gets the PX4 stored text.

void __stdcall GetPX4Text(

                                          void * objptr,          // @parm Pointer to the DPPAPI.

                                          LPSTR pszPX4Text, // @parm PX4 text string.

                                          LONG cSize)             // @parm Character buffer size.

                                          ;

// =================================================================================

// === DP5 Text Functions ==========================================================

// =================================================================================

// @doc DP5TEXT

//

// @module DP5 Text Functions | Sets and reads text stored in the DP5.

//

// DP5 Text Functions works for DP5 only.

//

// Copyright (c)2005, 2009 Amptek, All Rights Reserved

//

// @head3 DP5 Text Functions |

// @index func | DP5TEXT

//--------------------------------------------------------------------------------------

// @func Sets the DP5 stored text.

void __stdcall SetDP5Text(

                                          void * objptr,          // @parm Pointer to the DPPAPI.

                                          LPCSTR pszDP5Text)  // @parm DP5 text string.

                                          ;

// @func Gets the DP5 stored text.

void __stdcall GetDP5Text(

                                          void * objptr,          // @parm Pointer to the DPPAPI.

                                          LPSTR pszDP5Text, // @parm DP5 text string.

                                          LONG cSize)             // @parm Character buffer size.

                                          ;

// =================================================================================

// === DPP Tune Functions ==========================================================

// =================================================================================

// @doc DPPTUNE

//

// @module DPP Tune Functions | Tunes the fast threshold (DP4/PX4/DP5) and

// input offset (PX4/DP5 only).

//

// PX4 with FPGA/Firmware greater than Version 3.13 or DP4 with FPGA/Firmware greater

// than Version 4.00 required.

//

// @devnote The source must be removed to auto tune the fast threshold.  Status flags

// are provided to indicate a tuning function successful completion. (See DPP_STATUS.)

//

// Copyright (c)2005-2009 Amptek, All Rights Reserved

//

// @head3 DPP Tune Functions |

// @index func | DPPTUNE

//--------------------------------------------------------------------------------------

// @func Tunes the fast threshold.

//

// @devnote The source must be removed before tuning the fast threshold.

//

// The status flag SetFastThreshDone is set (=TRUE) if the fast threshold tuning

// was successful.  If the fast threshold tuning was successful, the configuration

// must be read back using GetConfigFromDpp to update the DppApi copy of

// the configuration.

//

void __stdcall TuneFastThreshold(

                                          void * objptr)          // @parm Pointer to the DPPAPI.

                                          ;

// @func Sets initial values for PX4 input offset tuning. (PX4 only.)

void __stdcall TuneInputOffsetInit(

                                          void * objptr)          // @parm Pointer to the DPPAPI.

                                          ;

// @func Tunes the input offset. (PX4/DP5 only.)

// @devnote Input Offset MUST be properly set before running TuneInputOffset.

// The initial input offset setting is based on the current input polarity and

// polezero configuration settings.  The TuneInputOffsetInit function checks

// these values and sets the initial input offset value.

//

// The status flag SetInputOffsetDone is set (=TRUE) if the input offset tuning

// was successful.  If the input offset tuning was successful, the configuration

// must be read back using GetConfigFromDpp to update the DppApi copy of

// the configuration.

//

// (See the DppApi Reference and the PX4/DP5 Hardware Description for details.)

//

//    Possible input offset tune start settings:

//

//          SET TO -2.048V (= 0000) IF THE Input Polarity is NEGATIVE(-) and PoleZero > 0

//

//          SET TO -0.100V (= 1948) IF THE Input Polarity is NEGATIVE(-) and PoleZero = 0

//

//          SET TO +0.100V (= 2148) IF THE Input Polarity is POSITIVE(+) and PoleZero = 0

//

//          SET TO +2.042V (= 4090) IF THE Input Polarity is POSITIVE(+) and PoleZero > 0

//

//

void __stdcall TuneInputOffset(

                                          void * objptr)          // @parm Pointer to the DPPAPI.

                                          ;

// =================================================================================

// === DPP USB Additional Functions ================================================

// =================================================================================

// @doc DPPUSBADDFUNC

//

// @module DPP USB Additional Functions | Send Dpp USB Vendor Request (DP4/PX4/DP5).

//

// @devnote Additonal functions are available through Dpp USB Vendor Requests.

// This is an advanced function and is not supported.  See DP4/PX4/DP5 user manuals for

// Vendor Request function details.

//

// Copyright (c)2005-2009 Amptek, All Rights Reserved

//

// @head3 DPP USB Additional Functions |

// @index func | DPPUSBADDFUNC

//--------------------------------------------------------------------------------------

// @func Sends a generic DPP Vendor Request to the default usb device.

//

// @devnote The function SendDppVendorRequest is determined by the Request parameter.

// See DP4/PX4/DP5 user manuals for Vendor Request function details.

//

//     Boot Option Vendor Requests:

//

//         BootOptSetBootFlags = 0x92           //Set DP5 boot options

//

//         BootOptSetPC5HV = 0x93               //Set PC5 HV

//

//         BootOptPC5TECTemp = 0x94             //Set PC5 TEC temperature

//

//         BootOptDP5InputOffset = 0x95         //Set DP5 input offset

//

//         BootOptSetDP5uCtrADC = 0x96          //Set DP5 microcontroller ADC/Temperature calibration (RESERVED)

//

//         BootOptSetDP5SpectrumOffset = 0x97   //Set DP5 spectrum offset

//

//

void __stdcall SendDppVendorRequest(

                                                      void * objptr,    // @parm Pointer to the DPPAPI.

                                                      int Request,      // @parm Vendor request.

                                                      int Value)        // @parm Vendor request value.

                                                      ;

// =================================================================================

// === DPPAPI Setup Notes ==============================================

// =================================================================================

// @doc DPPAPISU

//

// @module DPPAPI Setup Notes | Additional setup notes.

//

// Application programs invoke DPPAPI functions to establish DPP communications,

// control DPP operations, and retrieve spectrum data. The DPPAPI is distributed

// with an import library (.LIB), and a dynamic link library (.DLL) and a type

// library (.TLB).

//

// Applications can be developed with the DPPAPI in C, Visual Basic and many other

// programming languages.

//

// The C language representation of DPPAPI functions are defined in the DppApi.h

// header file.  These files are provided with the DPPAPI libraries.  The USB

// drivers provided with your Amptek DPP must be installed and the usbdrvd.dll

// must be accessible to the DPPAPI in order to function properly.

//

// Copyright (c)2005, 2007 Amptek, All Rights Reserved

//

// @head3 DPPAPI Setup Notes |

// @index func | DPPAPISU

//--------------------------------------------------------------------------------------

///////////////////////////////////////////////////////////////////////////////

// PX4 Diode Calibration Functions

///////////////////////////////////////////////////////////////////////////////

// SendDiodeCal -  Sends a specified diode cal value to the default usb device

// internal use only !!!!

void __stdcall SendDiodeCalVal(void * objptr, int DCalVal);

// GetDiodeCalVal -  Gets the diode cal monitor value.  This value is created during

// status message processing.  Status block must be processed before reading.

void __stdcall GetDiodeCalVal(void * objptr, double *DblCalVal);

#endif // !defined(DPPAPI_H)


VB DppApi Interface modDppApi

VB DppApi Interface Module - modDppApi.bas

Attribute VB_Name = "modDppApi"

Option Explicit

'Amptek DppApi v1.0.2.6 04/29/2009

Private Declare Sub Sleep Lib "kernel32" (ByVal dwMilliseconds As Long)

Public Type COORD   'The co-ordinates in Long

    X As Long

    Y As Long

End Type

'----- Plot Data -----

Public PlotCursor As COORD

Public HasPlotCursorSupport As Boolean

'Amptek DPP Device Types

''''Public Const DPPDP4 = &H0

''''Public Const DPPPX4 = &H1

Public Const DPPNONE = &H0

Public Const DPPDP4 = &H1

Public Const DPPPX4 = &H2

Public Const DPPDP4EMUL = &H3

Public Const DPPDP5 = &H4

Public Const BootOptSetBootFlags = &H92         'Set DP5 boot options*

Public Const BootOptSetPC5HV = &H93             'Set PC5 HV

Public Const BootOptPC5TECTemp = &H94           'Set PC5 TEC temperature

Public Const BootOptDP5InputOffset = &H95       'Set DP5 input offset

Public Const BootOptSetDP5uCtrADC = &H96        'Set DP5 microcontroller ADC/Temperature calibration (RESERVED)

Public Const BootOptSetDP5SpectrumOffset = &H97 'Set DP5 spectrum offset

'indicates type and version of device currently connected to

Public DppDevice As Integer

Public DppFirmwareRev As Double

Public DppFPGARev As Double

Public Dpp80MHzMode As Integer

Public DppSerialNumber As Long

'Gain Range Constants

Public Const DP4MINGAIN = 6#    ' dp4 5x-150x    (5.7143-142.8572 required for continuous range)

Public Const DP4MAXGAIN = 142#

Public Const PX4MINGAIN = 4#    ' px4 3x-687.25x (3.0975x-703.5375x based on calculated values)

Public Const PX4MAXGAIN = 700#

'Fine Gain UpDown Control Ranges

Public Const FineGainMin = 6144       ' default fine gain settings

Public Const FineGainMax = 10240

'Coarse Gain UpDown Control Ranges

Public Const CoarseGainMin = 0          ' lowest coarse gain setting is always 0

Public Const DP4CoarseGainMax = 3       ' dp4 gain control settings 0-3

Public Const PX4CoarseGainMax = 27      ' px4 gain control settings 0-27

Public Const DP5CoarseGainMax = 15          ' DP5 gain control settings 0-15

Public CfgEditUpdatesDone As Boolean

Public XLCfgUpdatesDone As Boolean

'' --------------------------------------------------------------------------------------

''  DppConfigSettingsType

'' --------------------------------------------------------------------------------------

Public Type DPP_CONFIG_SETTINGS

    ' MCA Properties

    AcqMode As Byte           ' acquisition mode 0=MCA,1=MCS

    MCSTimebase As Byte       ' MCS timebase value (0-15) see CAcqMode

    MCAChannels As Byte       ' number of channels 4=256,3=512,2=1024,1=2048,0=4096,5=8192

    BufferSelect As Byte      ' Holds Buffer Sel A&B,Buffer Sel Hardware,see DPPBufferSelect

    TTLGate As Byte           ' gate input settings, determines events included/excluded from spectrum, see DPPGate

    SlowThreshold As Byte     ' Slow ch threshold, Events w/amp lower not added to spectrum

    PresetTime As Long        ' var holds preset time, used in usb

    PresetCount As Long       ' preset count in selected channels, ch are set in SCA8

    SCA(0 To 7) As Long       ' SCA values, LL, UL, and Enable are stored together

    ' Shaping Properties

    TimeToPeak As Byte        ' TimeToPeak register setting

    Decimation As Byte        ' decimation setting for pulse shaping

    FlatTop As Byte           ' flatop register setting

    PUREnable As Byte         ' pile-up rejection enabled

    FastThreshold As Byte     ' Fast Ch Threshold, events w/fch amp below this are rejected

    RTDSlow As Byte           ' Risetime Discrimination slow threshold

    RTDOn As Byte             ' Turns RTD on, and sets the amplitude and timing thresholds

    RTDFast As Byte           ' RTD Time Threshold,Events w/HWHM wider than this are rejected

    BLR As Byte               ' Baseline Restoration, see udBLR.Value notes for values

    BaselineOn As Byte        ' use autobaseline during detector reset

    ' Gain PZ Properties

    CoarseGain As Byte        ' stores current coarse gain value

    FineGain As Long          ' stores current fine gain value

    PoleZero As Long          ' pole zero adjust value

    InputOffset As Long       ' input offset

    InputPolarity As Byte     ' use InvertEnable during detector reset

    DetReset As Byte          ' detector reset lockout period

    ' Power Properties

    TEC As Long               ' TEC temperature setting (displayed in Kelvin)

    HVEnabled As Byte         ' high voltage setting enable

    HV As Long                ' high voltage setting value

    PreampPower As Byte       ' preamp power select value (5v or 8.5v)

    ' Misc Properties

    AnalogOut As Byte         ' dac enabled and DAC output type,(stobed peak,shaped pulse,dec inp,fast ch)

    OutputOffset As Byte      ' Output DAC offset, -64…+63,(signed)(D7-D1) (-500mV to +492mV)

    AuxOut As Byte            ' Aux output type

    AudibleCounter As Byte    ' audio volume setting

End Type

'' --------------------------------------------------------------------------------------

''  DppStatusType (DPP_STATUS) DPP Status Storage Type

'' --------------------------------------------------------------------------------------

Public Type DPP_STATUS

    ' Identification

    FPGA As Double              ' FPGA

    Firmware As Double          ' firmware revision

    SerialNumber As Double      ' unit serial number

    StatDevInd As Byte          ' device indicator from status block (0=dp4,1=px4)

    ' Configuration

    BootStatus As Byte          ' boot status byte (PwrBtnConfig,SwConfigRcvd,McaEnabled)

    PwrBtnConfig As Byte        ' dpp has loaded config from power button

    SwConfigRcvd As Byte        ' software has sent valid config to unit since startup

    ' Tuning

    SetFastThreshDone As Byte   ' DPP tune fast thresh has successfully done

    SetSlowThreshDone As Byte   ' DPP tune slow thresh has successfully done

    SetInputOffsetDone As Byte  ' DPP tune input offset has successfully done

    ' Monitors

    BoardTemp As Double         ' board temperature monitor value

    HVMonitor As Double         ' high voltage monitor value

    TECMonitor As Double        ' TEC temperature monitor value (displayed in Kelvin)

    ' Acquisition Parameters

    FastCount As Double         ' fast channel count

    SlowCount As Double         ' slow channel count

    AccumulationTime As Double  ' real time duration of present data acquisition interval

    ' Acquisition Mode

    StatMcaEnabled As Byte      ' mca enabled status, high during acq, preset time resets flag

    MCSDone As Byte             ' MCS done flag 1=finished, 0=not finished

    PresetCountExpired As Byte  ' indicates presets counts have been reached

End Type

'' --------------------------------------------------------------------------------------

''  DppBootOptions (DPP_BOOT_OPTIONS) DPP Boot Options Status Storage Type

'' --------------------------------------------------------------------------------------

Public Type DPP_BOOT_OPTIONS

    BootFlags As Integer           'Boot flags

    HVDACSet As Integer            'HV DAC setting (not used in PX4 mode)

    TECDACSet As Integer           'TEC DAC setting (not used in PX4 mode)

    InputOffsetTuning As Integer   'Input offset DAC setting (not used in PX4 mode)

    uCTempCal As Integer           'uC temp cal (Reserved, do not change)

    SpectrumOffset As Integer      'Spectrum offset

End Type

'these flags are used to track changes made to settings in the configuration dialog

Public Enum DppConfigDataChanged

    cfgNone

    'MCA

    cfgAcqMode

    cfgMCSTimebase

    cfgMCAChannels

    cfgBufferSelect

    cfgGate

    cfgPresetTime

    cfgSlowThreshold

    cfgPresetCount

    cfgSCA

    'Shaping

    'cfgShaping

    cfgTimeToPeak

    cfgFlatTop

    cfgPUREnable

    cfgFastThreshold

    cfgRTD

    cfgBLR

    cfgBaselineOn

    'Gain PZ

    cfgCoarseGain

    cfgFineGain

    cfgPoleZero

    cfgInputOffset

    cfgInputPolarity

    cfgDetReset

    'Power

    cfgTEC

    cfgHV

    cfgPreampPower

    'Misc

    cfgDAC

    cfgOffset

    cfgAuxOut

    cfgAudibleCounter

    cfgModified

    cfgAll

End Enum

'pointer to the DPP API

Public objDppApi As Long

Public Declare Sub InitCommonControls Lib "comctl32.dll" () 'forces load of common controls

'=== Create/Destroy Dpp Api ======================================================

Public Declare Function OpenDppApi Lib "DppApi.dll" () As Long

Public Declare Sub CloseDppApi Lib "DppApi.dll" (ByVal objptr As Long)

'=================================================================================

'=== USB Messaging Functions =====================================================

Public Declare Function OpenUSBDevice Lib "DppApi.dll" (ByVal objptr As Long) As Integer

Public Declare Function OpenUSBDeviceEx Lib "DppApi.dll" (ByVal objptr As Long, ByVal Device As Long) As Integer

Public Declare Sub CloseUSBDevice Lib "DppApi.dll" (ByVal objptr As Long)

Public Declare Function MonitorUSBDppDevices Lib "DppApi.dll" (ByVal objptr As Long) As Integer

Public Declare Function GetUSBDppDeviceInfo Lib "DppApi.dll" (ByVal objptr As Long, ByVal Device As Long, ByRef lSerialNumber As Long) As Integer

'=================================================================================

'=== DPP Configuration ===========================================================

Public Declare Sub GetConfigFromDpp Lib "DppApi.dll" (ByVal objptr As Long)

Public Declare Sub SendConfigToDpp Lib "DppApi.dll" (ByVal objptr As Long)

Public Declare Sub GetConfigFromFile Lib "DppApi.dll" (ByVal objptr As Long, ByVal pszFilename As String, ByVal cSize As Long, ByVal DppDeviceType As Byte)

Public Declare Sub SaveConfigToFile Lib "DppApi.dll" (ByVal objptr As Long, ByVal pszFilename As String, ByVal cSize As Long)

Public Declare Sub GetConfigString Lib "DppApi.dll" (ByVal objptr As Long, ByVal pszConfig As String, ByVal cSize As Long)

Public Declare Sub GetConfigFromBuffer Lib "DppApi.dll" (ByVal objptr As Long, ByVal ConfigBuffer As Long, ByVal DppDeviceType As Byte)

Public Declare Sub SendConfigToBuffer Lib "DppApi.dll" (ByVal objptr As Long, ByVal ConfigBuffer As Long, ByRef Preset As Long)

'=================================================================================

'=== DPP Status ==================================================================

Public Declare Sub GetStatusString Lib "DppApi.dll" (ByVal objptr As Long, ByVal isBufferA As Integer, ByVal pszStatus As String, ByVal DisplaySize As Long)

Public Declare Sub GetStatusBuffer Lib "DppApi.dll" (ByVal objptr As Long, ByVal isBufferA As Integer, ByVal Status As Long)

Public Declare Sub ProcessStatusBuffer Lib "DppApi.dll" (ByVal objptr As Long, ByVal Status As Long)

Public Declare Sub DisplayStatusBuffer Lib "DppApi.dll" (ByVal objptr As Long, ByVal Status As Long, ByVal pszStatus As String, ByVal DisplaySize As Long)

Public Declare Sub CreateMCAFileDPPSettings Lib "DppApi.dll" (ByVal objptr As Long, ByVal pszSettings As String, ByVal cSize As Long)

Public Declare Sub GetStatusStruct Lib "DppApi.dll" (ByVal objptr As Long, ByVal isBufferA As Integer, ByRef StatusStruct As DPP_STATUS)

Public Declare Sub GetBootOptionsStruct Lib "DppApi.dll" (ByVal objptr As Long, ByVal isBufferA As Integer, ByRef BootOptionsStruct As DPP_BOOT_OPTIONS)

Public Declare Sub GetStatusStringFromBuffer Lib "DppApi.dll" (ByVal objptr As Long, ByVal isBufferA As Integer, ByVal pszStatus As String, ByVal cSize As Long, ByVal Status As Long)

Public Declare Sub GetStatusStructFromBuffer Lib "DppApi.dll" (ByVal objptr As Long, ByVal isBufferA As Integer, ByRef StatusStruct As DPP_STATUS, ByVal Status As Long)

'=================================================================================

'=== DPP Data Acquisition ========================================================

Public Declare Function GetDppData Lib "DppApi.dll" (ByVal objptr As Long, ByVal DataBuffer As Long) As Integer

Public Declare Sub ClearDppData Lib "DppApi.dll" (ByVal objptr As Long, ByVal isBufferA As Integer)

Public Declare Sub PauseDppData Lib "DppApi.dll" (ByVal objptr As Long, ByVal boolPauseData As Integer)

Public Declare Function ProcessDppData Lib "DppApi.dll" (ByVal objptr As Long, ByVal DataBuffer As Long, ByVal RawData As Long, ByVal ByteCount As Long) As Integer

'=================================================================================

'=== Configuration Settings ======================================================

Public Declare Sub GetCoarseGainSpinFromText Lib "DppApi.dll" (ByVal objptr As Long, ByRef Spin As Byte, ByVal pszCoarseGain As String)

Public Declare Sub GetCoarseGainTextFromSpin Lib "DppApi.dll" (ByVal objptr As Long, ByVal Spin As Byte, ByVal pszCoarseGain As String, ByVal TextSize As Long)

Public Declare Sub GetTempConfigSettings Lib "DppApi.dll" (ByVal objptr As Long, ByRef CfgSet As DPP_CONFIG_SETTINGS, ByVal CurrentUpdate As Integer)

Public Declare Sub SetTempConfigSettings Lib "DppApi.dll" (ByVal objptr As Long, ByRef CfgSet As DPP_CONFIG_SETTINGS, ByVal CurrentUpdate As Integer)

Public Declare Sub GetTempConfigString Lib "DppApi.dll" (ByVal objptr As Long, ByVal pszConfig As String, ByVal cSize As Long)

Public Declare Sub GetOutputOffsetTextFromSpin Lib "DppApi.dll" (ByVal objptr As Long, ByVal Spin As Byte, ByVal pszOffset As String, ByVal TextSize As Long)

Public Declare Sub GetOutputOffsetSpinFromText Lib "DppApi.dll" (ByVal objptr As Long, ByRef Spin As Byte, ByVal pszOffset As String)

Public Declare Sub GetPresetTimeStringFromVal Lib "DppApi.dll" (ByVal objptr As Long, ByVal lPresetTime As Long, ByVal pszPresetTime As String, ByVal cSize As Long)

Public Declare Sub GetPresetTimeValFromString Lib "DppApi.dll" (ByVal objptr As Long, ByRef lPresetTime As Long, ByVal pszPresetTime As String)

Public Declare Sub GetSlowThreshStringsFromSpin Lib "DppApi.dll" (ByVal objptr As Long, ByVal Spin As Byte, ByVal pszPercent As String, ByVal cSizePer As Long, ByVal pszChannels As String, ByVal cSizeChan As Long)

Public Declare Sub GetSlowThreshSpinFromPercent Lib "DppApi.dll" (ByVal objptr As Long, ByVal dblPercent As Double, ByRef Spin As Byte)

Public Declare Sub GetSlowThreshSpinFromChannel Lib "DppApi.dll" (ByVal objptr As Long, ByVal dblChannel As Double, ByRef Spin As Byte)

Public Declare Sub GetTimeToPeakDecimationFromSpin Lib "DppApi.dll" (ByVal objptr As Long, ByRef TimeToPeak As Byte, ByRef Decimation As Byte, ByVal Spin As Byte)

Public Declare Sub GetTimeToPeakSpinFromValues Lib "DppApi.dll" (ByVal objptr As Long, ByVal TimeToPeak As Byte, ByVal Decimation As Byte, ByRef Spin As Byte)

'=================================================================================

'=== PX4 Text Message ======================================================

Public Declare Sub SetPX4Text Lib "DppApi.dll" (ByVal objptr As Long, ByVal pszPX4Test As String)

Public Declare Sub GetPX4Text Lib "DppApi.dll" (ByVal objptr As Long, ByVal pszPX4Test As String, ByVal TextSize As Long)

'=================================================================================

'=== DP5 Text Message ======================================================

Public Declare Sub SetDP5Text Lib "DppApi.dll" (ByVal objptr As Long, ByVal pszDP5Test As String)

Public Declare Sub GetDP5Text Lib "DppApi.dll" (ByVal objptr As Long, ByVal pszDP5Test As String, ByVal TextSize As Long)

'=================================================================================

'=== DP4/PX4 Tune Functions  ===============================================

Public Declare Sub TuneFastThreshold Lib "DppApi.dll" (ByVal objptr As Long)

Public Declare Sub TuneInputOffsetInit Lib "DppApi.dll" (ByVal objptr As Long)

Public Declare Sub TuneInputOffset Lib "DppApi.dll" (ByVal objptr As Long)

'=================================================================================

'=== PX4 Test Functions  ===================================================

Public Declare Sub SendDiodeCalVal Lib "DppApi.dll" (ByVal objptr As Long, ByVal DCalVal As Integer)

Public Declare Sub GetDiodeCalVal Lib "DppApi.dll" (ByVal objptr As Long, ByRef DblCalVal As Double)

'=================================================================================

'=== DPP/DP5 Functions  ====================================================

Public Declare Sub SendDppVendorRequest Lib "DppApi.dll" (ByVal objptr As Long, ByVal Request As Integer, ByVal value As Integer)

'Run GetStatusStruct or GetStatusString before running Get80MHzMode

Public Declare Function Get80MHzMode Lib "DppApi.dll" (ByVal objptr As Long) As Long

Public Declare Sub SetFPGAClockDefault Lib "DppApi.dll" (ByVal objptr As Long, ByVal b80MHzMode As Integer, ByVal DppDeviceType As Byte)

'=================================================================================

Public DPPAPIBUSY As Boolean

Public Sub SetAPIBusyFlag(isBusy As Boolean)

    DPPAPIBUSY = isBusy

    If (DPPAPIBUSY) Then Sleep (1000)   'give chance for requesta to finish

End Sub

Public Function DPPTypeFromStatus(ByRef StatusStruct As DPP_STATUS) As Integer

    Dim indDPP5 As Long             'DPP5 20071023

    If (StatusStruct.SerialNumber < 1) Then Exit Function

    indDPP5 = Abs(StatusStruct.Firmware >= 5#)  'DPP5 20071023 indicates DPP5 type device

    DPPTypeFromStatus = ((indDPP5 * 2) + (StatusStruct.StatDevInd * 1)) + 1

End Function

Public Function DPPTypeString(DPPDeviceVal As Integer) As String

    Select Case (DPPDeviceVal)

        Case DPPDP4

            DPPTypeString = "DP4"

        Case DPPPX4

            DPPTypeString = "PX4"

        Case DPPDP4EMUL

            DPPTypeString = "DP4 EMUL"

        Case DPPDP5

            DPPTypeString = "DP5"

        Case Else

            DPPTypeString = "DPP"   'default

    End Select

End Function

Public Function GetDPPTypeFromString(strDPPDeviceIn As String) As Integer

    Dim strDPPDevice As String

    strDPPDevice = UCase(strDPPDeviceIn)

    Select Case (strDPPDevice)

        Case "DP4"

            GetDPPTypeFromString = DPPDP4

        Case "GAMMARAD"

            GetDPPTypeFromString = DPPDP4

        Case "PX4"

            GetDPPTypeFromString = DPPPX4

        Case "DP4 EMUL"

            GetDPPTypeFromString = DPPDP4EMUL

        Case "DP4EMUL"

            GetDPPTypeFromString = DPPDP4

        Case "DP5"

            GetDPPTypeFromString = DPPDP5

        Case "PX4 EMUL"

            GetDPPTypeFromString = DPPDP5

        Case "PX4EMUL"

            GetDPPTypeFromString = DPPDP5

        Case "DPP"

            GetDPPTypeFromString = DPPPX4

        Case "X-123"

            GetDPPTypeFromString = DPPDP4

        Case "X123"

            GetDPPTypeFromString = DPPDP4

        Case "X-123 SDD"

            GetDPPTypeFromString = DPPDP5

        Case "X123 SDD"

            GetDPPTypeFromString = DPPDP5

        Case "X-123SDD"

            GetDPPTypeFromString = DPPDP5

        Case "X123SDD"

            GetDPPTypeFromString = DPPDP5

        Case Else

            GetDPPTypeFromString = DPPNONE

    End Select

End Function


byte AcqMode;
byte MCSTimebase;
byte MCAChannels;
byte BufferSelect;
byte TTLGate;
byte SlowThreshold;
long PresetTime;
long PresetCount;
long SCA[8];
byte TimeToPeak;
byte Decimation;
byte FlatTop;
byte PUREnable;
byte FastThreshold;
byte RTDSlow;
byte RTDOn;
byte RTDFast;
byte BLR;
byte BaselineOn;
byte CoarseGain;
long FineGain;
long PoleZero;
long InputOffset;
byte InputPolarity;
byte DetReset;
long TEC;
byte HVEnabled;
long HV;
byte PreampPower;
byte AnalogOut;
byte OutputOffset;
byte AuxOut;
byte AudibleCounter;


double FPGA;
double Firmware;
double SerialNumber;
byte StatDevInd;,1=px4),
byte BootStatus;,SwConfigRcvd,McaEnabled)
byte PwrBtnConfig;
byte SwConfigRcvd;
byte SetFastThreshDone;
byte SetSlowThreshDone;
byte SetInputOffsetDone;
double BoardTemp;
double HVMonitor;
double TECMonitor;
double FastCount;
double SlowCount;
double AccumulationTime;
byte StatMcaEnabled;, high during acq, preset time resets flag
byte MCSDone;, 0=not finished,
byte PresetCountExpired;