// CDppConfig.h : header file // //-------------------------------------------------------------------------------------- //@doc CDppConfig // //@module DppConfig.h | DPP (DP4, PX4) Device Configuration Functions // //This class has software functionality for DPP (DP4, PX4) Device //Configuration management. The CDppConfig Class is the main repository //for DPP device configuration data. The CDppConfig Class can store and copy //a DPP device configuration. The current DPP device configuration can //also be saved to a string for display. // //The CDppConfig Class does processing of configuration data //for transmission to a DPP device. The processed configuration buffer can be //transmitted to the DPP by serial communications port or by USB. // //The CDppConfig Class also stores and processes status messages and //live spectral data requested from a DPP device. // // Copyright (c)2004 Amptek, All Rights Reserved // //@devnote // //@devnote Version: 20040709_0927 // //@head3 CDppConfig Members | //@index | CDppConfig // //-------------------------------------------------------------------------------------- #pragma once #define COUNT_OFFSET 1 // new dp4/px4 with fix //#define USB_DATA_SIZE (24576 + COUNT_OFFSET) #define USB_BUFFER_SIZE (64 + COUNT_OFFSET) #define USB_SCOPE_SIZE 2048 #define USB_CFG_IN_SIZE (512 + COUNT_OFFSET) const int DP5_TO_PX4_CONTROL_INDEX[16] = {26,27,0,1,2,4,5,6,7,8,9,11,12,14,15,17}; //@class DPP (DP4, PX4) Device Configuration Functions class CDppConfig { private: //---SetDPPConfigBuffer Buffer------------------------------------------------------ unsigned char Config[USB_BUFFER_SIZE]; //@cmember config data buffer //---gen config vars---------------------------------------------------------------- long MCAData[8192]; //@cmember holds the live spectra data unsigned char MCARaw[24576]; //@cmember holds pre-processed spectra data public: CDppConfig(void); //@cmember constructor ~CDppConfig(void); //@cmember destructor bool isCfgChanged; //@cmember indicates the data in this class has been changed BOOL DisplayCfg; BOOL CfgReadBack; BOOL DisplaySca; BOOL ScaReadBack; BOOL SaveCfg; BOOL PrintCfg; int Port; //@cmember current com port, -1=none,0=usb,1=com1,2=com2,... //---Process Status Vars------------------------------------------------------------------ //long SlowCount; //@cmember slow channel count (from status) //long FastCount; //@cmember fast channel count (from status) double SlowCount; //@cmember slow channel count (from status) double GPCount; //@cmember slow channel count (from status) double FastCount; //@cmember fast channel count (from status) double AccumulationTime; //@cmember real time duration of present data acquisition interval double RealTime; //@cmember real time duration of present data acquisition interval double LiveTime; //@cmember live time //---ConfigureDPP Vars-------------------------------------------------------------------- unsigned char Firmware; //@cmember firmware revision unsigned char Build; bool isDPP5; //@cmember DPP5 indicator // DPP5 20070926 //long SerialNumber; //@cmember unit serial number unsigned long SerialNumber; //@cmember unit serial number long Preset; //@cmember var holds preset time, used in usb double PresetRt; //@cmember var holds preset time, used in usb double PresetLt; //@cmember var holds preset time, used in usb double PresetAcq; //@cmember var holds preset time, used in usb CString strPresetCmd; CString strPresetVal; //---SetDPPConfigBuffer Vars----------------------------------------------------------------------- int Avg; //@cmember holds decimation setting for pulse shaping int FlatTop; //@cmember flatop register setting double FlatTopUS; unsigned char DetReset; //@cmember detector reset lockout period unsigned char SlowChThreshold; //@cmember Slow ch threshold, Events w/amp lower not added to spectrum double SlowThresholdPct; unsigned char FastChThreshold; //@cmember Fast Ch Threshold, events w/fch amp below this are rejected long Offset; //@cmember Output DAC offset, -64…+63,(signed) (-500mV to +492mV) unsigned char DAC_Enable; //@cmember dac enabled int DAC; //@cmember DAC output type,(stobed peak,shaped pulse,dec inp,fast ch) int MCA; //@cmember number of channels 4=256,3=512,2=1024,1=2048,0=4096,5=8192 long mcaCH; //@cmember actual number of channels 0,256,512,1024,2048,4096,8192 BOOL MCAEnable; //@cmember mca enabled setting BOOL PUREnable; //@cmember pile-up rejection enabled int Rise; //@cmember risetime register setting double RiseUS; BOOL BaselineOn; //@cmember use autobaseline during detector reset unsigned char RTDSlow; //@cmember Risetime Discrimination slow threshold int Gain; //@cmember analog gain setting (0=10,1=20,2=50,3=100) unsigned char RTDOn; //@cmember Turns RTD on, and sets the amplitude and timing thresholds unsigned char RTDFast; //@cmember RTD Time Threshold,Events w/HWHM wider than this are rejected unsigned char BLR; //@cmember Baseline Restoration, see udBLR.Value notes for values unsigned char FPGA; //@cmember fpga revision unsigned char Gate; //@cmember gate input settings, determines events included/excluded from spectrum, see DPPGate unsigned char BufferSelect; //@cmember Holds Buffer Sel A&B,Buffer Sel Hardware,see DPPBufferSelect unsigned char AcqMode; //@cmember acquisition mode 0=MCA,1=MCS unsigned char MCSEnable; //@cmember MCS Enable (Always ON, Gate Signal-if low prevents counts to current mcs channel) unsigned char MCSTimebase; //@cmember MCS timebase value (0-15) see CAcqMode BOOL MCSDone; //@cmember MCS done flag 1=finished, 0=not finished BOOL PresetRtDone; BOOL PresetLtDone; BOOL isPresetAcq; // need to test if MCAEnabled==FALSE is Preset Acq Expired // NOTE: current mcs processing channel stored in slow counts //Status packet offset 28, bit 6 is the 'MCS Done' flag. 1=finished, 0=not finished. //(D7 of this byte is the 'Auto Input Offset Searching/locked' flag.) //---PX4 Vars----------------------------------------------------------------------------- // power prop page vars bool TECEnabled; //@cmember Enable TEC long TEC; //@cmember TEC temperature setting (displayed in Kelvin) double TECMonitor; //@cmember TEC temperature monitor value CString TECMonitorCStr; //@cmember TEC temperature monitor display CString BOOL HVEnabled; //@cmember high voltage setting enable long HV; //@cmember high voltage setting value double HVMonitor; //@cmember high voltage monitor value CString HVMonitorCStr; //@cmember high voltage monitor display CString BOOL XR100; //@cmember XR100 control value (obsolete) BOOL SEL8_5V; //@cmember preamp power select value (5v or 8.5v) // gainpz prop page vars ----------------------------------------------------- long PoleZero; //@cmember pole zero adjust value long PX4InputOffset; //@cmember input offset //long PX4CoarseGain; long PX4FineGain; //@cmember fine gain BOOL InvertEn; //@cmember use InvertEnable during detector reset // misc prop page vars --------------------------------------------------------- BOOL IndLED; //@cmember *changed to audio1 volume setting BOOL IndBuzzer; //@cmember *changed to audio0 volume setting BOOL PwrCtrl9V; //@cmember 9V power enable, always set to ON BOOL PwrCtrl5VA; //@cmember 5VA power enable, no longer used, always set to false int AuxOut; //@cmember Aux output type unsigned long PresetCount; //@cmember preset count in selected channels, ch are set in SCA8 unsigned long SCA[8]; //@cmember SCA values, LL, UL, and Enable are stored together int BoardTemp; //@cmember board temperature monitor value CString BoardTempCStr; //@cmember board temperature monitor display CString unsigned char BootStatus; //@cmember boot status byte (PwrBtnConfig,SwConfigRcvd,McaEnabled) bool PwrBtnConfig; //@cmember dpp has loaded config from power button BOOL SwConfigRcvd; //@cmember software has sent valid config to unit since startup BOOL StatMcaEnabled; //@cmember mca en, high during acq, preset time resets flag int DeviceType; //@cmember device type 0=mca8ka,1=dp4,2=px4,3=DP5(DP4 emul),4=DP5 (PX4 Emulation) bool isDeltaMode; //@cmember false=MCA mode, true=Delta mode double GainDelta; //@cmember increment/decrement value for px4 toolbar/menu gain change function double PX4Gain; //@cmember stores current gain value for px4 toolbar/menu gain change function CString strGainDisplayValue; //@cmember stores display CString for px4 toolbar/menu gain change function // added to px4 -------------------------------------------------------------- int HVRangeInd; //@cmember HV range indicator from status block (0=750V,1=1500V) int StatDevInd; //@cmember device indicator from status block (0=dp4,1=px4) BOOL PresetCountExpired; //@cmember indicates presets counts have been reached bool NavPanelUpdate; //@cmember indicates NavPanel Needs update bool HwCfgFromDLG; //@cmember hardware configuration from dialog settings CString strPercentDeadTime; //@cmember holds Percent Dead Time display value for info panel CString StartTime; //@cmember px4 data acquisition start time in CString format int USBDataRefreshRate; //@cmember usb data read timer interval // refresh flags for dialog boxes, eliminates unwanted overwrites due to new data refreshes bool RefreshDppGeneral; //@cmember refresh general property page bool RefreshDppMCA; //@cmember refresh MCA property page bool RefreshDppShaping; //@cmember refresh shaping property page bool RefreshDppPower; //@cmember refresh power property page bool RefreshDppGainPZ; //@cmember refresh gainpz property page bool RefreshDppMisc; //@cmember refresh misc property page bool RefreshDppTest; //@cmember refresh dpptest property page double DCal; //DCal bool ScopeTriggerFalling; //@cmember scope trigger int ScopeTriggerPosition; //@cmember scope position //unsigned char Scope[512]; //@cmember scope display unsigned char Scope[USB_SCOPE_SIZE]; //@cmember scope display BOOL UpdateScopeCfg; //@cmember scope indicates scope cfg needs update BOOL LoadRestartInProgress; //@cmember the config dialog is restart with a cfg dlg loaded config CString LoadRestartStatus; //@cmember the config dialog restart status message BOOL LoadRestartInputOffset; //@cmember the config dialog is restart with a cfg dlg loaded config BOOL LoadRestartInputOffsetSlow; //@cmember the config dialog is restart with a cfg dlg loaded config BOOL LoadRestartFastThresh; //@cmember the config dialog is restart with a cfg dlg loaded config BOOL LoadRestartSlowThresh; //@cmember the config dialog is restart with a cfg dlg loaded config BOOL SetFastThreshDone; //@cmember DPP tune fast thresh has successfully done BOOL SetInputOffsetDone; //@cmember DPP tune input offset has successfully done long ProcessUSBData(); int CfgModCount; // configuration modified count for CPropertySheet CString GetDeviceNameFromVal(int DeviceTypeVal); // DPP5 20071018 double UCHARVersionToDouble(unsigned char Version); // DPP5 20071015 //Status packet BootBlock //DPP5 20071105 double bb_DeadTimeCounter; //0x2F-0x2C deadtime counter 50nS/count USHORT bb_DiodeCalDACSet; //0x30-31 Diode Cal DAC setting USHORT bb_TECCurrentLimit; //0x32-33 TEC current limit DAC setting (not used in DP5) USHORT bb_BootFlags; //0x34-35 Boot flags (MSB currently unused) USHORT bb_HVDACSet; //0x36-37 HV DAC setting (not used in PX4 mode) USHORT bb_TECDACSet; //0x38-39 TEC DAC setting (not used in PX4 mode) USHORT bb_InputOffsetTuning; //0x3A-3B Input offset DAC setting (not used in PX4 mode) (not currently used - testing to see if constant value works) USHORT bb_uCTempCal; //0x3C-3D uC temp cal, or something like that (not used yet) USHORT bb_SpectrumOffset; //0x3E-3F Spectrum offset (not used yet, added a boot flag bit (D1) to indicate whether to use this) BOOL NeedsDP5ReBoot; BOOL b80MHzMode; BOOL b80MHzModeCfg; BOOL bFPGAAutoClock; // configuration indicator support BOOL bGammaRadHVMode; // GammaRad HV BOOL bConfigHVPolarity; // Detector HV Polarity, for setup warnings double dblConfigHV; // Detector HV, for test dialog data BOOL bPC5Detected; // PC5 connected,PX5 HV Pwr Error BOOL bBootHVPolarity; // HV Polarity from status packet BOOL bAnalogPolarity; // Analog Input Polarity, for setup warnings // DP5 oscilloscope support CString strAnalogOut; CString strInputOffset; CString strOutputOffset; CString strScopeGain; CString strTriggerSource; CString strTriggerPosition; CString strTriggerSlope; CString strMcaMode; };