VERSION 5.00 Object = "{A32A88B3-817C-11D1-A762-00AA0044064C}#1.0#0"; "mscecomdlg.dll" Object = "{481BA4A3-56F2-11D1-A1AB-00C04FA87A04}#1.0#0"; "MSCECOMM.DLL" Object = "{25C953A7-5464-11D1-A714-00AA0044064C}#1.0#0"; "MSCEFILE.DLL" Object = "{338D5EA5-4BBD-11D1-9A7D-00C04FAD5AEC}#1.0#0"; "mscepicture.dll" Object = "{F7DEA2C9-BA8F-446E-A292-B4840F3BD661}#1.0#0"; "mscemenubar.dll" Begin VB.Form frmPlot Appearance = 0 'Flat BackColor = &H80000005& BorderStyle = 1 'Fixed Single Caption = "Amptek PX4/DP4 MCA" ClientHeight = 3540 ClientLeft = 600 ClientTop = 2940 ClientWidth = 3510 ForeColor = &H80000008& LockControls = -1 'True ScaleHeight = 3540 ScaleWidth = 3510 ShowOK = -1 'True Begin VBCE.Frame fraDeviceConfiguration Height = 3495 Left = 0 TabIndex = 0 Top = 0 Width = 3495 _cx = 6174 _cy = 6174 BackColor = -2147483643 BorderStyle = 1 Caption = "Device Configuration" Enabled = -1 'True BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} Name = "Tahoma" Size = 8.25 Charset = 0 Weight = 400 Underline = 0 'False Italic = 0 'False Strikethrough = 0 'False EndProperty ForeColor = -2147483640 ClipControls = -1 'True Begin VBCE.Frame Frame17 Height = 495 Left = 1800 TabIndex = 4 Top = 180 Width = 1575 _cx = 2778 _cy = 873 BackColor = -2147483643 BorderStyle = 1 Caption = "DPP Type" Enabled = -1 'True BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} Name = "Tahoma" Size = 8.25 Charset = 0 Weight = 400 Underline = 0 'False Italic = 0 'False Strikethrough = 0 'False EndProperty ForeColor = -2147483640 ClipControls = -1 'True Begin VBCE.OptionButton btnPX4 Height = 195 Left = 120 TabIndex = 6 Top = 240 Width = 615 _cx = 2143 _cy = 873 BackColor = -2147483643 Caption = "PX4" Enabled = -1 'True BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} Name = "Tahoma" Size = 8.25 Charset = 0 Weight = 400 Underline = 0 'False Italic = 0 'False Strikethrough = 0 'False EndProperty ForeColor = -2147483640 Alignment = 0 Value = 0 'False End Begin VBCE.OptionButton btnDP4 Height = 195 Left = 840 TabIndex = 5 Top = 240 Width = 615 _cx = 2143 _cy = 873 BackColor = -2147483643 Caption = "DP4" Enabled = -1 'True BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} Name = "Tahoma" Size = 8.25 Charset = 0 Weight = 400 Underline = 0 'False Italic = 0 'False Strikethrough = 0 'False EndProperty ForeColor = -2147483640 Alignment = 0 Value = 0 'False End End Begin MenuBarLib.MenuBar ceMenuBar Left = 0 Top = 3480 _cx = 6165 _cy = 609 Enabled = -1 'True NewButton = 0 'False End Begin VBCE.Frame Frame4 Height = 495 Left = 120 TabIndex = 20 Top = 180 Width = 1575 _cx = 2778 _cy = 873 BackColor = -2147483643 BorderStyle = 1 Caption = "Count Mode" Enabled = -1 'True BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} Name = "Tahoma" Size = 8.25 Charset = 0 Weight = 400 Underline = 0 'False Italic = 0 'False Strikethrough = 0 'False EndProperty ForeColor = -2147483640 ClipControls = -1 'True Begin VBCE.OptionButton btnCountTotal Height = 195 Left = 780 TabIndex = 22 Top = 240 Width = 725 _cx = 1279 _cy = 344 BackColor = -2147483643 Caption = "Total" Enabled = -1 'True BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} Name = "Tahoma" Size = 8.25 Charset = 0 Weight = 400 Underline = 0 'False Italic = 0 'False Strikethrough = 0 'False EndProperty ForeColor = -2147483640 Alignment = 0 Value = 0 'False End Begin VBCE.OptionButton btnCountDelta Height = 195 Left = 60 TabIndex = 21 Top = 240 Width = 735 _cx = 1296 _cy = 344 BackColor = -2147483643 Caption = "Delta" Enabled = -1 'True BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} Name = "Tahoma" Size = 8.25 Charset = 0 Weight = 400 Underline = 0 'False Italic = 0 'False Strikethrough = 0 'False EndProperty ForeColor = -2147483640 Alignment = 0 Value = 0 'False End End Begin VBCE.Label lblTmr Height = 210 Left = 120 TabIndex = 37 Top = 720 Visible = 0 'False Width = 495 _cx = 873 _cy = 370 AutoSize = 0 'False BackColor = -2147483643 BackStyle = 0 BorderStyle = 0 Caption = "Timer" Enabled = -1 'True BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} Name = "Tahoma" Size = 8.25 Charset = 0 Weight = 400 Underline = 0 'False Italic = 0 'False Strikethrough = 0 'False EndProperty ForeColor = -2147483640 Alignment = 0 UseMnemonic = -1 'True WordWrap = 0 'False End Begin VBCE.Label lblMsPerCh Height = 210 Left = 855 TabIndex = 34 Top = 720 Visible = 0 'False Width = 855 _cx = 1508 _cy = 370 AutoSize = 0 'False BackColor = -2147483643 BackStyle = 0 BorderStyle = 0 Caption = "msec/chan" Enabled = -1 'True BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} Name = "Tahoma" Size = 8.25 Charset = 0 Weight = 400 Underline = 0 'False Italic = 0 'False Strikethrough = 0 'False EndProperty ForeColor = -2147483640 Alignment = 0 UseMnemonic = -1 'True WordWrap = 0 'False End Begin VBCE.TextBox txtMsPerCh Height = 210 Left = 640 TabIndex = 33 Top = 720 Visible = 0 'False Width = 210 _cx = 379 _cy = 370 BackColor = -2147483643 BorderStyle = 0 Enabled = -1 'True BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} Name = "Tahoma" Size = 8.25 Charset = 0 Weight = 400 Underline = 0 'False Italic = 0 'False Strikethrough = 0 'False EndProperty ForeColor = -2147483640 Text = "10" Alignment = 1 HideSelection = -1 'True Locked = 0 'False MaxLength = 0 MultiLine = 0 'False PasswordChar = "" ScrollBars = 0 End Begin VBCE.TextBox txtDeviceConfiguration Height = 1695 Left = 120 TabIndex = 32 Top = 1320 Width = 3255 _cx = 5741 _cy = 2990 BackColor = -2147483643 BorderStyle = 1 Enabled = -1 'True BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} Name = "Tahoma" Size = 8.25 Charset = 0 Weight = 400 Underline = 0 'False Italic = 0 'False Strikethrough = 0 'False EndProperty ForeColor = -2147483640 Text = "Device Configuration" Alignment = 0 HideSelection = -1 'True Locked = 0 'False MaxLength = 0 MultiLine = -1 'True PasswordChar = "" ScrollBars = 2 End Begin VBCE.Label lblStatus Height = 375 Left = 0 TabIndex = 14 Top = 3120 Width = 3495 _cx = 6165 _cy = 661 AutoSize = 0 'False BackColor = -2147483643 BackStyle = 1 BorderStyle = 1 Caption = "Application Status" Enabled = -1 'True BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} Name = "Tahoma" Size = 8.25 Charset = 0 Weight = 400 Underline = 0 'False Italic = 0 'False Strikethrough = 0 'False EndProperty ForeColor = -2147483640 Alignment = 0 UseMnemonic = -1 'True WordWrap = 0 'False End Begin VBCE.CommandButton InitProgram Height = 255 Left = 120 TabIndex = 13 Top = 720 Width = 1575 _cx = 2778 _cy = 450 BackColor = 16744576 Caption = "Initialize Program" Enabled = -1 'True BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} Name = "Tahoma" Size = 8.25 Charset = 0 Weight = 400 Underline = 0 'False Italic = 0 'False Strikethrough = 0 'False EndProperty Style = 1 End Begin VBCE.CommandButton btnConfigure Default = -1 'True Height = 255 Left = 1800 TabIndex = 11 Top = 720 Visible = 0 'False Width = 1575 _cx = 2778 _cy = 450 BackColor = 12632256 Caption = "Configure DPP" Enabled = -1 'True BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} Name = "Tahoma" Size = 8.25 Charset = 0 Weight = 400 Underline = 0 'False Italic = 0 'False Strikethrough = 0 'False EndProperty Style = 1 End Begin VBCE.CommandButton btnRecallConfig Height = 255 Left = 120 TabIndex = 8 Top = 960 Visible = 0 'False Width = 1575 _cx = 2778 _cy = 450 BackColor = 12632256 Caption = "Recall Configuration" Enabled = -1 'True BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} Name = "Tahoma" Size = 8.25 Charset = 0 Weight = 400 Underline = 0 'False Italic = 0 'False Strikethrough = 0 'False EndProperty Style = 1 End Begin VBCE.CommandButton cmdShowCfg Height = 255 Left = 1800 TabIndex = 7 Top = 960 Visible = 0 'False Width = 1575 _cx = 2778 _cy = 450 BackColor = 12632256 Caption = "Show Configuration" Enabled = -1 'True BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} Name = "Tahoma" Size = 8.25 Charset = 0 Weight = 400 Underline = 0 'False Italic = 0 'False Strikethrough = 0 'False EndProperty Style = 0 End End Begin VBCE.Frame fraHiddenItems Height = 3495 Left = 3840 TabIndex = 1 Top = 3600 Width = 3495 _cx = 6174 _cy = 6174 BackColor = -2147483643 BorderStyle = 1 Caption = "Hidden Items" Enabled = -1 'True BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} Name = "Tahoma" Size = 8.25 Charset = 0 Weight = 400 Underline = 0 'False Italic = 0 'False Strikethrough = 0 'False EndProperty ForeColor = -2147483640 ClipControls = -1 'True Begin CECOMMCtl.Comm MSComm1 Left = 2520 Top = 2760 _cx = 1400 _cy = 1000 CommPort = 1 Settings = "57600,N,8,1" InputLen = 256 InputMode = 0 NullDiscard = 0 'False ParityReplace = "?" RThreshold = 256 SThreshold = 0 Handshaking = 0 DTREnable = 0 'False RTSEnable = 0 'False End Begin CEComDlgCtl.CommonDialog CommonDialog1 Left = 1320 Top = 2880 _cx = 847 _cy = 847 CancelError = 0 'False Color = 0 DefaultExt = "" DialogTitle = "" FileName = "" Filter = "" FilterIndex = 0 Flags = 0 HelpCommand = 0 HelpContext = "" HelpFile = "" InitDir = "" MaxFileSize = 256 FontBold = 0 'False FontItalic = 0 'False FontName = "" FontSize = 10 FontUnderline = 0 'False Max = 0 Min = 0 FontStrikethru = 0 'False End Begin FILECTLCtl.FileSystem FileSystem1 Left = 2160 Top = 1920 _cx = 2200 _cy = 1400 End Begin FILECTLCtl.File File1 Left = 720 Top = 2880 _cx = 1000 _cy = 1000 End Begin VBCE.Label lblFormSize Height = 255 Left = 240 TabIndex = 19 Top = 360 Width = 1935 _cx = 3413 _cy = 450 AutoSize = 0 'False BackColor = -2147483643 BackStyle = 1 BorderStyle = 0 Caption = "This form is 3600x4020" Enabled = -1 'True BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} Name = "Tahoma" Size = 8.25 Charset = 0 Weight = 400 Underline = 0 'False Italic = 0 'False Strikethrough = 0 'False EndProperty ForeColor = -2147483640 Alignment = 0 UseMnemonic = -1 'True WordWrap = 0 'False End Begin VBCE.Timer Timer1 Left = 1920 Top = 2880 _cx = 847 _cy = 847 Enabled = 0 'False Interval = 20000 End End Begin VBCE.Frame fraDataAcquisition Height = 3495 Left = 3840 TabIndex = 2 Top = 0 Width = 3495 _cx = 6174 _cy = 6174 BackColor = -2147483643 BorderStyle = 1 Caption = "Data Acquisition" Enabled = -1 'True BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} Name = "Tahoma" Size = 8.25 Charset = 0 Weight = 400 Underline = 0 'False Italic = 0 'False Strikethrough = 0 'False EndProperty ForeColor = -2147483640 ClipControls = -1 'True Begin VBCE.Frame fraPlotType Height = 495 Left = 1680 TabIndex = 9 Top = 240 Width = 1695 _cx = 2990 _cy = 873 BackColor = -2147483643 BorderStyle = 1 Caption = "Plot Type" Enabled = -1 'True BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} Name = "Tahoma" Size = 8.25 Charset = 0 Weight = 400 Underline = 0 'False Italic = 0 'False Strikethrough = 0 'False EndProperty ForeColor = -2147483640 ClipControls = -1 'True Begin VBCE.OptionButton OptPlotTypeLine Height = 195 Left = 960 TabIndex = 24 Top = 240 Width = 615 _cx = 2143 _cy = 873 BackColor = -2147483643 Caption = "Line" Enabled = -1 'True BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} Name = "Tahoma" Size = 8.25 Charset = 0 Weight = 400 Underline = 0 'False Italic = 0 'False Strikethrough = 0 'False EndProperty ForeColor = -2147483640 Alignment = 0 Value = 0 'False End Begin VBCE.OptionButton OptPlotTypeSolid Height = 195 Left = 120 TabIndex = 25 Top = 240 Width = 735 _cx = 2143 _cy = 873 BackColor = -2147483643 Caption = "Solid" Enabled = -1 'True BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} Name = "Tahoma" Size = 8.25 Charset = 0 Weight = 400 Underline = 0 'False Italic = 0 'False Strikethrough = 0 'False EndProperty ForeColor = -2147483640 Alignment = 0 Value = -1 'True End End Begin VBCE.Frame fraScale Height = 495 Left = 1680 TabIndex = 10 Top = 720 Width = 1695 _cx = 2990 _cy = 873 BackColor = -2147483643 BorderStyle = 1 Caption = "Scale" Enabled = -1 'True BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} Name = "Tahoma" Size = 8.25 Charset = 0 Weight = 400 Underline = 0 'False Italic = 0 'False Strikethrough = 0 'False EndProperty ForeColor = -2147483640 ClipControls = -1 'True Begin VBCE.OptionButton OptScaleTypeLog Height = 195 Left = 960 TabIndex = 26 Top = 240 Width = 615 _cx = 2143 _cy = 873 BackColor = -2147483643 Caption = "Log" Enabled = -1 'True BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} Name = "Tahoma" Size = 8.25 Charset = 0 Weight = 400 Underline = 0 'False Italic = 0 'False Strikethrough = 0 'False EndProperty ForeColor = -2147483640 Alignment = 0 Value = 0 'False End Begin VBCE.OptionButton OptScaleTypeLinear Height = 195 Left = 120 TabIndex = 27 Top = 240 Width = 735 _cx = 2143 _cy = 873 BackColor = -2147483643 Caption = "Linear" Enabled = -1 'True BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} Name = "Tahoma" Size = 8.25 Charset = 0 Weight = 400 Underline = 0 'False Italic = 0 'False Strikethrough = 0 'False EndProperty ForeColor = -2147483640 Alignment = 0 Value = -1 'True End End Begin PictureBoxCtl.PictureBox picMCAPlot Height = 1935 Left = 120 TabIndex = 28 Top = 1440 Width = 3255 _cx = 5741 _cy = 3413 AutoSize = 0 'False BackColor = 16777215 BorderStyle = 1 DrawMode = 15 DrawStyle = 0 DrawWidth = 1 FillColor = -2147483640 FillStyle = 0 ForeColor = -2147483640 FontBold = 0 'False FontItalic = 0 'False FontStrikethru = 0 'False FontUnderline = 0 'False FontName = "Tahoma" FontSize = 10 FontTransparent = -1 'True Object.Height = 129 Object.Width = 217 Object.Left = 8 Object.Top = 96 Picture = "" ScaleHeight = 129 ScaleWidth = 217 ScaleLeft = 0 ScaleTop = 0 ScaleMode = 3 Enabled = -1 'True End Begin VBCE.Label lblPeak Height = 210 Left = 2520 TabIndex = 54 Top = 1200 Width = 450 _cx = 794 _cy = 370 AutoSize = 0 'False BackColor = -2147483643 BackStyle = 0 BorderStyle = 0 Caption = "Chan" Enabled = -1 'True BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} Name = "Tahoma" Size = 8.25 Charset = 0 Weight = 400 Underline = 0 'False Italic = 0 'False Strikethrough = 0 'False EndProperty ForeColor = -2147483640 Alignment = 2 UseMnemonic = -1 'True WordWrap = 0 'False End Begin VBCE.Label lblPeakCnts Height = 210 Left = 1080 TabIndex = 53 Top = 1200 Width = 690 _cx = 1217 _cy = 370 AutoSize = 0 'False BackColor = -2147483643 BackStyle = 0 BorderStyle = 0 Caption = "Cnts" Enabled = -1 'True BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} Name = "Tahoma" Size = 8.25 Charset = 0 Weight = 400 Underline = 0 'False Italic = 0 'False Strikethrough = 0 'False EndProperty ForeColor = -2147483640 Alignment = 2 UseMnemonic = -1 'True WordWrap = 0 'False End Begin VBCE.Label lbllblPeak Height = 210 Left = 1800 TabIndex = 39 Top = 1200 Width = 735 _cx = 1296 _cy = 370 AutoSize = 0 'False BackColor = -2147483643 BackStyle = 0 BorderStyle = 0 Caption = "Peak Ch" Enabled = -1 'True BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} Name = "Tahoma" Size = 8.25 Charset = 0 Weight = 400 Underline = 0 'False Italic = 0 'False Strikethrough = 0 'False EndProperty ForeColor = -2147483640 Alignment = 2 UseMnemonic = -1 'True WordWrap = 0 'False End Begin VBCE.Label lbllblPeakCnts Height = 210 Left = 240 TabIndex = 38 Top = 1200 Width = 855 _cx = 1508 _cy = 370 AutoSize = 0 'False BackColor = -2147483643 BackStyle = 0 BorderStyle = 0 Caption = "Peak Cnts" Enabled = -1 'True BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} Name = "Tahoma" Size = 8.25 Charset = 0 Weight = 400 Underline = 0 'False Italic = 0 'False Strikethrough = 0 'False EndProperty ForeColor = -2147483640 Alignment = 2 UseMnemonic = -1 'True WordWrap = 0 'False End Begin VBCE.Label lblPktCnt Height = 210 Left = 240 TabIndex = 36 Top = 1000 Width = 615 _cx = 1085 _cy = 370 AutoSize = 0 'False BackColor = -2147483643 BackStyle = 0 BorderStyle = 0 Caption = "Packet" Enabled = -1 'True BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} Name = "Tahoma" Size = 8.25 Charset = 0 Weight = 400 Underline = 0 'False Italic = 0 'False Strikethrough = 0 'False EndProperty ForeColor = -2147483640 Alignment = 2 UseMnemonic = -1 'True WordWrap = 0 'False End Begin VBCE.Label lblCount Height = 210 Left = 840 TabIndex = 35 Top = 1000 Visible = 0 'False Width = 375 _cx = 661 _cy = 370 AutoSize = 0 'False BackColor = -2147483643 BackStyle = 0 BorderStyle = 0 Caption = "lblCount" Enabled = -1 'True BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} Name = "Tahoma" Size = 8.25 Charset = 0 Weight = 400 Underline = 0 'False Italic = 0 'False Strikethrough = 0 'False EndProperty ForeColor = -2147483640 Alignment = 2 UseMnemonic = -1 'True WordWrap = 0 'False End Begin VBCE.Label lblMCAPlot1 Height = 255 Left = 120 TabIndex = 31 Top = 1200 Width = 255 _cx = 450 _cy = 450 AutoSize = 0 'False BackColor = -2147483643 BackStyle = 0 BorderStyle = 0 Caption = "1" Enabled = -1 'True BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} Name = "Tahoma" Size = 8.25 Charset = 0 Weight = 400 Underline = 0 'False Italic = 0 'False Strikethrough = 0 'False EndProperty ForeColor = -2147483640 Alignment = 0 UseMnemonic = -1 'True WordWrap = 0 'False End Begin VBCE.Label lblMCAPlot2 Height = 255 Left = 2880 TabIndex = 30 Top = 1200 Width = 495 _cx = 873 _cy = 450 AutoSize = 0 'False BackColor = -2147483643 BackStyle = 0 BorderStyle = 0 Caption = "1024" Enabled = -1 'True BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} Name = "Tahoma" Size = 8.25 Charset = 0 Weight = 400 Underline = 0 'False Italic = 0 'False Strikethrough = 0 'False EndProperty ForeColor = -2147483640 Alignment = 1 UseMnemonic = -1 'True WordWrap = 0 'False End Begin VBCE.CommandButton cmdStartStopAcq Height = 255 Left = 120 TabIndex = 23 Top = 480 Width = 1335 _cx = 2355 _cy = 450 BackColor = 12632256 Caption = "Stop Acquisition" Enabled = -1 'True BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} Name = "Tahoma" Size = 8.25 Charset = 0 Weight = 400 Underline = 0 'False Italic = 0 'False Strikethrough = 0 'False EndProperty Style = 1 End Begin VBCE.Label lblSrcLine Height = 255 Left = 3120 TabIndex = 16 Top = 960 Width = 255 _cx = 450 _cy = 450 AutoSize = 0 'False BackColor = -2147483643 BackStyle = 0 BorderStyle = 0 Caption = "" Enabled = -1 'True BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} Name = "Tahoma" Size = 8.25 Charset = 0 Weight = 400 Underline = 0 'False Italic = 0 'False Strikethrough = 0 'False EndProperty ForeColor = -2147483640 Alignment = 0 UseMnemonic = -1 'True WordWrap = 0 'False End Begin VBCE.CommandButton cmdClearPlot Height = 255 Left = 120 TabIndex = 15 Top = 240 Width = 1335 _cx = 2355 _cy = 450 BackColor = 12632256 Caption = "Clear Data" Enabled = -1 'True BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} Name = "Tahoma" Size = 8.25 Charset = 0 Weight = 400 Underline = 0 'False Italic = 0 'False Strikethrough = 0 'False EndProperty Style = 0 End Begin VBCE.CommandButton btnSave Height = 255 Left = 120 TabIndex = 12 Top = 720 Width = 1335 _cx = 2355 _cy = 450 BackColor = 12632256 Caption = "Save Spectrum" Enabled = -1 'True BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} Name = "Tahoma" Size = 8.25 Charset = 0 Weight = 400 Underline = 0 'False Italic = 0 'False Strikethrough = 0 'False EndProperty Style = 0 End End Begin VBCE.Frame fraDeviceDataInfo Height = 3495 Left = 120 TabIndex = 3 Top = 3600 Width = 3495 _cx = 6174 _cy = 6174 BackColor = -2147483643 BorderStyle = 1 Caption = "Device and Data Information" Enabled = -1 'True BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} Name = "Tahoma" Size = 8.25 Charset = 0 Weight = 400 Underline = 0 'False Italic = 0 'False Strikethrough = 0 'False EndProperty ForeColor = -2147483640 ClipControls = -1 'True Begin VBCE.TextBox txtDppStatus Height = 2775 Left = 120 TabIndex = 29 Top = 600 Width = 3255 _cx = 5741 _cy = 4895 BackColor = -2147483643 BorderStyle = 1 Enabled = -1 'True BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} Name = "Tahoma" Size = 8.25 Charset = 0 Weight = 400 Underline = 0 'False Italic = 0 'False Strikethrough = 0 'False EndProperty ForeColor = -2147483640 Text = "DppStatus" Alignment = 0 HideSelection = -1 'True Locked = 0 'False MaxLength = 0 MultiLine = -1 'True PasswordChar = "" ScrollBars = 2 End Begin VBCE.CommandButton btnAutoFastThreshold Height = 255 Left = 120 TabIndex = 18 Top = 240 Width = 1695 _cx = 2990 _cy = 450 BackColor = 12632256 Caption = "Auto Fast Threshold" Enabled = -1 'True BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} Name = "Tahoma" Size = 8.25 Charset = 0 Weight = 400 Underline = 0 'False Italic = 0 'False Strikethrough = 0 'False EndProperty Style = 0 End Begin VBCE.CommandButton btnOffsetSearchLarge Height = 255 Left = 1920 TabIndex = 17 Top = 240 Width = 1455 _cx = 2566 _cy = 450 BackColor = 12632256 Caption = "Auto Input Offset" Enabled = -1 'True BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} Name = "Microsoft Sans Serif" Size = 8.25 Charset = 0 Weight = 400 Underline = 0 'False Italic = 0 'False Strikethrough = 0 'False EndProperty Style = 0 End End Begin VBCE.Frame fraPlotSpectrum Height = 3495 Left = 7440 TabIndex = 40 Top = 0 Visible = 0 'False Width = 3495 _cx = 6174 _cy = 6174 BackColor = -2147483643 BorderStyle = 1 Caption = "Spectrum File" Enabled = -1 'True BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} Name = "Tahoma" Size = 8.25 Charset = 0 Weight = 400 Underline = 0 'False Italic = 0 'False Strikethrough = 0 'False EndProperty ForeColor = -2147483640 ClipControls = -1 'True Begin VBCE.Frame Frame2 Height = 495 Left = 1680 TabIndex = 41 Top = 240 Width = 1695 _cx = 2990 _cy = 873 BackColor = -2147483643 BorderStyle = 1 Caption = "Plot Type" Enabled = -1 'True BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} Name = "Tahoma" Size = 8.25 Charset = 0 Weight = 400 Underline = 0 'False Italic = 0 'False Strikethrough = 0 'False EndProperty ForeColor = -2147483640 ClipControls = -1 'True Begin VBCE.OptionButton OptPlotTypeSolid2 Height = 195 Left = 120 TabIndex = 43 Top = 240 Width = 735 _cx = 2143 _cy = 873 BackColor = -2147483643 Caption = "Solid" Enabled = -1 'True BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} Name = "Tahoma" Size = 8.25 Charset = 0 Weight = 400 Underline = 0 'False Italic = 0 'False Strikethrough = 0 'False EndProperty ForeColor = -2147483640 Alignment = 0 Value = -1 'True End Begin VBCE.OptionButton OptPlotTypeLine2 Height = 195 Left = 960 TabIndex = 42 Top = 240 Width = 615 _cx = 2143 _cy = 873 BackColor = -2147483643 Caption = "Line" Enabled = -1 'True BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} Name = "Tahoma" Size = 8.25 Charset = 0 Weight = 400 Underline = 0 'False Italic = 0 'False Strikethrough = 0 'False EndProperty ForeColor = -2147483640 Alignment = 0 Value = 0 'False End End Begin VBCE.Frame Frame3 Height = 495 Left = 1680 TabIndex = 44 Top = 720 Width = 1695 _cx = 2990 _cy = 873 BackColor = -2147483643 BorderStyle = 1 Caption = "Scale" Enabled = -1 'True BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} Name = "Tahoma" Size = 8.25 Charset = 0 Weight = 400 Underline = 0 'False Italic = 0 'False Strikethrough = 0 'False EndProperty ForeColor = -2147483640 ClipControls = -1 'True Begin VBCE.OptionButton OptScaleTypeLinear2 Height = 195 Left = 120 TabIndex = 46 Top = 240 Width = 735 _cx = 2143 _cy = 873 BackColor = -2147483643 Caption = "Linear" Enabled = -1 'True BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} Name = "Tahoma" Size = 8.25 Charset = 0 Weight = 400 Underline = 0 'False Italic = 0 'False Strikethrough = 0 'False EndProperty ForeColor = -2147483640 Alignment = 0 Value = -1 'True End Begin VBCE.OptionButton OptScaleTypeLog2 Height = 195 Left = 960 TabIndex = 45 Top = 240 Width = 615 _cx = 2143 _cy = 873 BackColor = -2147483643 Caption = "Log" Enabled = -1 'True BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} Name = "Tahoma" Size = 8.25 Charset = 0 Weight = 400 Underline = 0 'False Italic = 0 'False Strikethrough = 0 'False EndProperty ForeColor = -2147483640 Alignment = 0 Value = 0 'False End End Begin PictureBoxCtl.PictureBox picMCAPlot2 Height = 1935 Left = 120 TabIndex = 47 Top = 1440 Width = 3255 _cx = 5741 _cy = 3413 AutoSize = 0 'False BackColor = 16777215 BorderStyle = 1 DrawMode = 15 DrawStyle = 0 DrawWidth = 1 FillColor = -2147483640 FillStyle = 0 ForeColor = -2147483640 FontBold = 0 'False FontItalic = 0 'False FontStrikethru = 0 'False FontUnderline = 0 'False FontName = "Tahoma" FontSize = 10 FontTransparent = -1 'True Object.Height = 129 Object.Width = 217 Object.Left = 8 Object.Top = 96 Picture = "" ScaleHeight = 129 ScaleWidth = 217 ScaleLeft = 0 ScaleTop = 0 ScaleMode = 3 Enabled = -1 'True End Begin VBCE.TextBox txtDppStatus2 Height = 1935 Left = 120 TabIndex = 63 Top = 1440 Visible = 0 'False Width = 3255 _cx = 5741 _cy = 3413 BackColor = -2147483643 BorderStyle = 1 Enabled = -1 'True BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} Name = "Tahoma" Size = 8.25 Charset = 0 Weight = 400 Underline = 0 'False Italic = 0 'False Strikethrough = 0 'False EndProperty ForeColor = -2147483640 Text = "DppStatus" Alignment = 0 HideSelection = -1 'True Locked = 0 'False MaxLength = 0 MultiLine = -1 'True PasswordChar = "" ScrollBars = 2 End Begin VBCE.TextBox txtDeviceConfiguration2 Height = 1935 Left = 120 TabIndex = 62 Top = 1440 Visible = 0 'False Width = 3255 _cx = 5741 _cy = 3413 BackColor = -2147483643 BorderStyle = 1 Enabled = -1 'True BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} Name = "Tahoma" Size = 8.25 Charset = 0 Weight = 400 Underline = 0 'False Italic = 0 'False Strikethrough = 0 'False EndProperty ForeColor = -2147483640 Text = "Device Configuration" Alignment = 0 HideSelection = -1 'True Locked = 0 'False MaxLength = 0 MultiLine = -1 'True PasswordChar = "" ScrollBars = 2 End Begin VBCE.CommandButton cmdPlotView Height = 255 Left = 120 TabIndex = 61 Top = 840 Width = 375 _cx = 661 _cy = 450 BackColor = 12632256 Caption = "Plot" Enabled = -1 'True BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} Name = "Tahoma" Size = 8.25 Charset = 0 Weight = 400 Underline = 0 'False Italic = 0 'False Strikethrough = 0 'False EndProperty Style = 1 End Begin VBCE.CommandButton cmdConfigView Height = 255 Left = 840 TabIndex = 60 Top = 840 Width = 375 _cx = 661 _cy = 450 BackColor = 12632256 Caption = "Cfg" Enabled = -1 'True BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} Name = "Tahoma" Size = 8.25 Charset = 0 Weight = 400 Underline = 0 'False Italic = 0 'False Strikethrough = 0 'False EndProperty Style = 1 End Begin VBCE.CommandButton cmdStatusView Height = 255 Left = 480 TabIndex = 59 Top = 840 Width = 375 _cx = 661 _cy = 450 BackColor = 12632256 Caption = "Stat" Enabled = -1 'True BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} Name = "Tahoma" Size = 8.25 Charset = 0 Weight = 400 Underline = 0 'False Italic = 0 'False Strikethrough = 0 'False EndProperty Style = 1 End Begin VBCE.Label lblPeak2 Height = 210 Left = 2520 TabIndex = 58 Top = 1200 Width = 450 _cx = 794 _cy = 370 AutoSize = 0 'False BackColor = -2147483643 BackStyle = 0 BorderStyle = 0 Caption = "Chan" Enabled = -1 'True BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} Name = "Tahoma" Size = 8.25 Charset = 0 Weight = 400 Underline = 0 'False Italic = 0 'False Strikethrough = 0 'False EndProperty ForeColor = -2147483640 Alignment = 2 UseMnemonic = -1 'True WordWrap = 0 'False End Begin VBCE.Label lblPeakCnts2 Height = 210 Left = 1080 TabIndex = 57 Top = 1200 Width = 690 _cx = 1217 _cy = 370 AutoSize = 0 'False BackColor = -2147483643 BackStyle = 0 BorderStyle = 0 Caption = "Cnts" Enabled = -1 'True BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} Name = "Tahoma" Size = 8.25 Charset = 0 Weight = 400 Underline = 0 'False Italic = 0 'False Strikethrough = 0 'False EndProperty ForeColor = -2147483640 Alignment = 2 UseMnemonic = -1 'True WordWrap = 0 'False End Begin VBCE.Label Label2 Height = 210 Left = 1800 TabIndex = 56 Top = 1200 Width = 735 _cx = 1296 _cy = 370 AutoSize = 0 'False BackColor = -2147483643 BackStyle = 0 BorderStyle = 0 Caption = "Peak Ch" Enabled = -1 'True BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} Name = "Tahoma" Size = 8.25 Charset = 0 Weight = 400 Underline = 0 'False Italic = 0 'False Strikethrough = 0 'False EndProperty ForeColor = -2147483640 Alignment = 2 UseMnemonic = -1 'True WordWrap = 0 'False End Begin VBCE.Label Label1 Height = 210 Left = 240 TabIndex = 55 Top = 1200 Width = 855 _cx = 1508 _cy = 370 AutoSize = 0 'False BackColor = -2147483643 BackStyle = 0 BorderStyle = 0 Caption = "Peak Cnts" Enabled = -1 'True BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} Name = "Tahoma" Size = 8.25 Charset = 0 Weight = 400 Underline = 0 'False Italic = 0 'False Strikethrough = 0 'False EndProperty ForeColor = -2147483640 Alignment = 2 UseMnemonic = -1 'True WordWrap = 0 'False End Begin VBCE.CommandButton cmdPlotTest Height = 255 Left = 120 TabIndex = 52 Top = 480 Width = 1335 _cx = 2355 _cy = 450 BackColor = 12632256 Caption = "Open Spectrum" Enabled = -1 'True BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} Name = "Tahoma" Size = 8.25 Charset = 0 Weight = 400 Underline = 0 'False Italic = 0 'False Strikethrough = 0 'False EndProperty Style = 0 End Begin VBCE.CommandButton cmdClearPlot2 Height = 255 Left = 120 TabIndex = 51 Top = 240 Width = 1335 _cx = 2355 _cy = 450 BackColor = 12632256 Caption = "Clear Data" Enabled = -1 'True BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} Name = "Tahoma" Size = 8.25 Charset = 0 Weight = 400 Underline = 0 'False Italic = 0 'False Strikethrough = 0 'False EndProperty Style = 0 End Begin VBCE.Label Label8 Height = 255 Left = 3120 TabIndex = 50 Top = 960 Width = 255 _cx = 450 _cy = 450 AutoSize = 0 'False BackColor = -2147483643 BackStyle = 0 BorderStyle = 0 Caption = "" Enabled = -1 'True BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} Name = "Tahoma" Size = 8.25 Charset = 0 Weight = 400 Underline = 0 'False Italic = 0 'False Strikethrough = 0 'False EndProperty ForeColor = -2147483640 Alignment = 0 UseMnemonic = -1 'True WordWrap = 0 'False End Begin VBCE.Label Label7 Height = 255 Left = 2880 TabIndex = 49 Top = 1200 Width = 495 _cx = 873 _cy = 450 AutoSize = 0 'False BackColor = -2147483643 BackStyle = 0 BorderStyle = 0 Caption = "1024" Enabled = -1 'True BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} Name = "Tahoma" Size = 8.25 Charset = 0 Weight = 400 Underline = 0 'False Italic = 0 'False Strikethrough = 0 'False EndProperty ForeColor = -2147483640 Alignment = 1 UseMnemonic = -1 'True WordWrap = 0 'False End Begin VBCE.Label Label6 Height = 255 Left = 120 TabIndex = 48 Top = 1200 Width = 255 _cx = 450 _cy = 450 AutoSize = 0 'False BackColor = -2147483643 BackStyle = 0 BorderStyle = 0 Caption = "1" Enabled = -1 'True BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} Name = "Tahoma" Size = 8.25 Charset = 0 Weight = 400 Underline = 0 'False Italic = 0 'False Strikethrough = 0 'False EndProperty ForeColor = -2147483640 Alignment = 0 UseMnemonic = -1 'True WordWrap = 0 'False End End End Attribute VB_Name = "frmPlot" Attribute VB_GlobalNameSpace = False Attribute VB_Creatable = False Attribute VB_PredeclaredId = True Attribute VB_Exposed = False Option Explicit Private Const DP4_only = False Dim MCATemp1(24576) As Byte Dim MCACount Dim MCACountMode Dim SaveFile As Boolean Dim CommError As Boolean Dim StatusReceived As Boolean Dim BootStatus As Byte Dim LiveTime As Single Dim RepFileNumber As Integer Dim BaseFilename As String Dim MiscCount As Long Dim MCACh(6) As Integer Dim Status_read As Boolean Const Diagnostic As Boolean = True Dim strInBuff() As String Dim ZoomValMax As Long Dim MCADataMax As Long Dim HaveData As Boolean Dim strVersion As String Dim strAppPath As String Dim LastFrame As Integer Dim varMCAFileData As Variant Dim HaveFilePlot As Boolean Private Sub btnAutoFastThreshold_Click() SendCmd Chr(&H77) ' auto fast threshold End Sub Private Function SetMaxZoom() ' zoom all the way out ' set for number of channels Select Case MCA Case 0 ZoomValMax = 4 Case 1 ZoomValMax = 3 Case 2 ZoomValMax = 2 Case 3 ZoomValMax = 1 Case 4 ZoomValMax = 0 Case 5 ZoomValMax = 5 End Select 'MCADataMax = (2 ^ (ZoomValMax)) - 1 MCADataMax = 0 SetCommInterval End Function Private Sub btnConfigure_Click() Dim Temp(1024) As Byte Dim config(1024) As Byte Dim Count As Long ' USB variables Dim ReturnCount As Long Dim Flags As Long Dim OK As Integer Dim varDummy As Variant Dim strSendCfg As String Dim idxXfer As Long Dim idxSCA As Long Dim idxCfg As Long Dim strConfig As String btnConfigure.Visible = False btnCountTotal.Value = True btnCountTotal_Click If Diagnostic Then lblStatus = "" End If SetMaxZoom If Port = 0 Then OK = MsgBox("Please select a Serial Port", vbOKOnly, "Oops!") Else If MSComm1.PortOpen = False Then MSComm1.CommPort = Port ' use Com1 MSComm1.Settings = "57600,N,8,1" MSComm1.InputLen = 256 MSComm1.PortOpen = True MSComm1.RThreshold = 256 ' generate OnComm when 256 bytes received End If ' already open config(1) = &HFD ' Start byte config(2) = Avg - 1 + FlatTop * 8 ' Avg & Top If (DetReset > 3) And (DetReset < 8) Then config(2) = config(2) + 128 ' QA7=1 (fast reset & auto-baseline) End If config(3) = SlowChThreshold 'Slow Threshold config(4) = FastChThreshold ' Fast threshold config(5) = OutputOffset * 2 + ((CByte(DAC_Off) And 1) Xor 1) ' Output offset and DAC enable config(6) = DAC + MCA * 4 + (MCAEnable And 32) ' DAC & MCA & Reset If (PUREnable) Then config(7) = CInt((Rise * 19 + (FlatTop + 1) * 4) / 2) ' PUR interval (19~16x1.2) Else config(7) = 0 ' set PUR=0 End If config(8) = Rise * 16 ' Time to peak Select Case DetReset Case 0, 1, 2, 3, 4, 5, 6, 7 config(8) = config(8) + (DetReset And 3) * 4 'D3-D2=lockout, D0=0->use lockout Case 8 config(8) = config(8) + 1 ' D0=1 -> no reset lockout End Select If BaselineOn Then config(8) = config(8) + 2 ' D2=1 -> Auto baseline during det. reset End If config(9) = RTDSlow ' RTD slow threshold 'config(10) = CoarseGain * 32 + (CByte(btnRTDOn.Value) And 16) + (udRTDFast.Value - 4) config(10) = (CByte(RTDOn) And 16) + (RTDFast - 4) config(11) = 128 + BLR ' D7=1 for normal operation, D6-D0=BLR settings config(12) = Gate 'GateOFF=0, GateHigh=128, GateLow=192 config(12) = config(12) + BufferSelect ' select Buffer A=0,B=16,HW=32 config(12) = config(12) + AuxOut ' 3-bit address for AUX-OUT mux If btnPX4.Value = True Then config(13) = 0 If TEC_On Then config(13) = config(13) Or 1 ' turn on TEC 'If Pwr5VA_On Then config(13) = config(13) Or 2 ' turn on 5VA XR100_On = True '!!!!!! If XR100_On Then config(13) = config(13) Or 4 ' turn on XR100 supplies If Pwr9V_On Then config(13) = config(13) Or 8 ' turn on 9V supply If Pwr8_5SEL_On Then config(13) = config(13) Or 16 ' select 8.5 or 5V supply If HV > 0 Then config(13) = config(13) Or 32 ' enable HV for HV>0 ' If LED_On Then config(13) = config(13) Or 64 ' enable LED ' If Buzzer_On Then config(13) = config(13) Or 128 ' enable buzzer config(13) = config(13) + AudibleCounter * 64 config(14) = 0 config(14) = (CoarseGain) And 3 Select Case CoarseGain Case 0, 1, 2, 3 config(10) = config(10) Or 32 ' turn on GAIN1<0> [GAIN1 on DP4] Case 4, 5, 6, 7 Case 8, 9, 10, 11 config(10) = config(10) Or 32 ' turn on GAIN1<0> [GAIN1 on DP4] config(14) = config(14) Or 4 ' turn on GAIN3-4<0> Case 12, 13, 14, 15 config(14) = config(14) Or 4 ' turn on GAIN3-4<0> Case 16, 17, 18, 19 config(14) = config(14) Or 8 ' turn on GAIN3-4<1> Case 20, 21, 22, 23 config(10) = config(10) Or 32 ' turn on GAIN1<0> [GAIN1 on DP4] config(14) = config(14) Or 12 ' turn on GAIN3-4<0> & GAIN3-4<1> Case 24, 25, 26, 27 config(14) = config(14) Or 12 ' turn on GAIN3-4<0> & GAIN3-4<1> End Select If InvertCG Then config(14) = config(14) Or 128 ' turn on INVERT config(15) = (HV \ 512) And 15 config(16) = ((HV \ 2) And 255) config(17) = (TEC \ 256) And 15 config(18) = (TEC And 255) config(19) = (InputOffset \ 256) And 15 config(20) = (InputOffset And 255) config(21) = PoleZero Else Select Case CoarseGain Case 0 config(10) = config(10) + 0 * 32 Case 1 config(10) = config(10) + 1 * 32 Case 2 config(10) = config(10) + 2 * 32 Case 3 config(10) = config(10) + 3 * 32 End Select End If config(22) = ((FineGain \ Rise) And 255) config(23) = (((FineGain \ Rise) \ 256) And 63) config(24) = 0 config(25) = 0 config(26) = 0 config(27) = 0 config(28) = -128 * CInt(AcqMode) + MCSTimebase config(28) = config(28) + 32 ' enable MCS (MCSEnable = True always) For idxSCA = 32 To 63 config(idxSCA) = 0 Next For idxCfg = 0 To 10 Temp(idxCfg) = config(idxCfg + 2) Next Temp(11) = CByte(Preset Mod 256) Temp(12) = CByte((Preset \ 256) Mod 256) Temp(13) = CByte((Preset \ 65536) Mod 256) For idxCfg = 13 To 28 Temp(idxCfg + 1) = config(idxCfg) Next Temp(30) = 0 Temp(31) = 0 For idxCfg = 32 To 63 Temp(idxCfg) = config(idxCfg) Next 'SaveBufferToFile "Config_Temp", Temp, False Timer1.Enabled = False varDummy = MSComm1.Input varDummy = MSComm1.Input varDummy = MSComm1.Input strSendCfg = "" strSendCfg = strSendCfg & Chr(&HFD) ' Start byte For idxXfer = 0 To 63 strSendCfg = strSendCfg & Chr(Temp(idxXfer)) Next idxXfer strSendCfg = strSendCfg & Chr(&HFE) ' configure byte MSComm1.Output = strSendCfg Timer1.Enabled = MCAEnable ' enable timer if MCA enabled btnConfigure.BackColor = &HC0C0C0 End If SaveFile = False btnSave.Enabled = True strConfig = ShowConfigSettingStrings() txtDeviceConfiguration = strConfig DppConfigMCA = "<>" & vbNewLine & strConfig & "<>" lblStatus = "Configuration Sent" btnConfigure.Visible = True btnSave.Visible = True btnSave.Enabled = True End Sub Private Sub btnCountDelta_Click() MCACountMode = 1 End Sub Private Sub btnCountTotal_Click() MCACountMode = 0 End Sub Private Sub btnDP4_Click() DppDevice = DPPDP4 End Sub Private Sub btnRecallConfig_Click() Dim varCfg As Variant Dim strFilename As String btnRecallConfig.Enabled = False ' CommonDialog1.FileName = strAppPath & "\DPP.cfg" ' strFilename = GetFileNameCFG(CommonDialog1, True) strFilename = OpenFileDlg("*.cfg", "*.cfg") If (Len(strFilename) > 0) Then varCfg = GetCfgFile(File1, strFilename) RecallConfig varCfg SetMaxZoom ReDim strInBuff(((2 ^ ZoomValMax) * 3 - 1)) 'temp data store for ser comm btnConfigure.Visible = True btnConfigure.BackColor = ConfigNeededColor cmdShowCfg.Visible = True btnRecallConfig.BackColor = &HC0C0C0 Else MsgBox "No file selected.", vbCritical, "Select Cfg" End If btnRecallConfig.Enabled = True End Sub Private Sub btnSave_Click() SaveFile = True btnSave.Enabled = False btnSave.Visible = False End Sub Private Sub cmdClearPlot_Click() Dim bTmrEnabled As Boolean Dim idxData As Long bTmrEnabled = Timer1.Enabled Timer1.Enabled = False SendCmd Chr(&H70) ' Clear spectrum buffer A picMCAPlot.Cls picMCAPlot.Refresh MCACount = 0 For idxData = 0 To ((2 ^ ZoomValMax) * 3 - 1) strInBuff(idxData) = "" Next Timer1.Enabled = bTmrEnabled End Sub Private Sub cmdClearPlot2_Click() picMCAPlot2.Cls picMCAPlot2.Refresh txtDppStatus2.Text = "" txtDeviceConfiguration2.Text = "" ChangePlotBtnColor 1 End Sub Private Sub cmdConfigView_Click() picMCAPlot2.Visible = False txtDppStatus2.Visible = False txtDeviceConfiguration2.Visible = True ChangePlotBtnColor 3 End Sub Private Sub ChangePlotBtnColor(iButton As Integer) cmdPlotView.BackColor = &HC0C0C0 cmdStatusView.BackColor = &HC0C0C0 cmdConfigView.BackColor = &HC0C0C0 Select Case iButton Case 1 cmdPlotView.BackColor = &H8000& Case 2 cmdStatusView.BackColor = &H8000& Case 3 cmdConfigView.BackColor = &H8000& End Select End Sub Private Sub cmdPlotTest_Click() Dim varMCAData As Variant Dim strFilename As String Dim idxMsg As Long Dim strMsg As Long Dim FileBuffer As Variant cmdPlotTest.Enabled = False ' CommonDialog1.InitDir = strAppPath & "\Spectra\*.mca" ' CommonDialog1.FileName = strAppPath & "\Spectra\*.mca" ' strFilename = GetFileNameMCA(CommonDialog1, True) strFilename = OpenFileDlg("*.mca", "*.mca") If (Len(strFilename) > 0) Then HaveFilePlot = False FileBuffer = GetMcaFile(File1, strFilename) 'read mca file data If (UBound(FileBuffer) > 10) Then varMCAData = GetSpectrumData2(FileBuffer) 'get the data varMCAFileData = GetSpectrumData2(FileBuffer) 'get the data If (IsEmpty(varMCAData)) Then Exit Sub 'if no data quit cmdPlotView_Click PlotDataTest varMCAData, picMCAPlot2 txtDppStatus2.Text = GetSpectrumStatus(FileBuffer) txtDeviceConfiguration2.Text = GetSpectrumConfig(FileBuffer) lblPeakCnts2 = CStr(PlotPeakVal) lblPeakCnts2.Refresh lblPeak2 = CStr(PlotPeakChan) lblPeak2.Refresh HaveFilePlot = True End If Else MsgBox "No file selected.", vbCritical, "Select Spectrum" End If cmdPlotTest.Enabled = True End Sub Private Sub cmdPlotView_Click() picMCAPlot2.Visible = True txtDppStatus2.Visible = False txtDeviceConfiguration2.Visible = False ChangePlotBtnColor 1 If HaveFilePlot Then PlotDataTest varMCAFileData, picMCAPlot2 End Sub Private Sub cmdStatusView_Click() picMCAPlot2.Visible = False txtDppStatus2.Visible = True txtDeviceConfiguration2.Visible = False ChangePlotBtnColor 2 End Sub Private Sub Form_OKClick() App.End End Sub Private Sub btnOffsetSearchLarge_Click() SendCmd Chr(&H76) ' Input offset large step search End Sub Private Sub cmdStartStopAcq_Click() Select Case cmdStartStopAcq.Caption Case "Stop Acquisition" Timer1.Enabled = False ' turn off timer cmdStartStopAcq.Caption = "Start Acquisition" cmdStartStopAcq.BackColor = &HFF& 'Red SendCmd Chr(&H73) ' disable MCA/MCS Case "Start Acquisition" cmdStartStopAcq.Caption = "Stop Acquisition" cmdStartStopAcq.BackColor = &HFF00& 'Green SendCmd Chr(&H72) ' enable MCA/MCS 'Timer1.Enabled = MCAEnable ' turn on timer if MCA enabled Timer1.Enabled = True End Select End Sub Private Sub btnPX4_Click() DppDevice = DPPPX4 End Sub Private Sub cmdShowCfg_Click() txtDeviceConfiguration = ShowConfigSettingStrings() End Sub Private Sub CreateMenus() Dim mnuView As MenuBarLib.MenuBarMenu Set mnuView = ceMenuBar.Controls.AddMenu("View", "mnuView") mnuView.Items.Add 1, "mnuViewDevCfg", "Device Configuration" mnuView.Items.Add 2, "mnuViewDataAcq", "Data Acquisition" mnuView.Items.Add 3, "mnuViewInfo", "DPP Status" mnuView.Items.Add 4, "mnuViewSpectrum", "Spectrum File" End Sub Private Sub ceMenuBar_MenuClick(ByVal Item As MenuBarLib.Item) Select Case Item.Key Case "mnuViewDevCfg" SelectFrame 1 Case "mnuViewDataAcq" SelectFrame 2 Case "mnuViewInfo" SelectFrame 3 Case "mnuViewSpectrum" SelectFrame 4 End Select End Sub Private Sub SelectFrame(iFrame As Integer) fraDeviceConfiguration.Visible = False fraDataAcquisition.Visible = False fraDeviceDataInfo.Visible = False If ((LastFrame = 4) And (iFrame <> LastFrame)) Then DeletePlotDC CreatePlotDC picMCAPlot End If Select Case iFrame Case 1 fraDeviceConfiguration.Visible = True LastFrame = 1 Case 2 fraDataAcquisition.Visible = True LastFrame = 2 Case 3 fraDeviceDataInfo.Visible = True LastFrame = 3 Case 4 DeletePlotDC CreatePlotDC picMCAPlot2 fraPlotSpectrum.Visible = True LastFrame = 4 End Select End Sub Private Sub InitFrames() fraDeviceConfiguration.Visible = False fraDataAcquisition.Visible = False fraDeviceDataInfo.Visible = False fraHiddenItems.Visible = False fraPlotSpectrum.Visible = False fraDeviceConfiguration.Left = 0 fraDataAcquisition.Left = 0 fraDeviceDataInfo.Left = 0 fraPlotSpectrum.Left = 0 fraDeviceConfiguration.Top = 0 fraDataAcquisition.Top = 0 fraDeviceDataInfo.Top = 0 fraPlotSpectrum.Top = 0 fraDeviceConfiguration.Visible = True End Sub Private Sub Form_Load() Timer1.Enabled = False LastFrame = 0 'MCA channel conversion values MCACh(0) = 4096 MCACh(1) = 2048 MCACh(2) = 1024 MCACh(3) = 512 MCACh(4) = 256 MCACh(5) = 8192 InitFrames CreateMenus CreatePlotDC picMCAPlot HaveFilePlot = False End Sub Private Sub Form_Unload(Cancel As Integer) Timer1.Timer = False If MSComm1.PortOpen = True Then MSComm1.PortOpen = False DeletePlotDC End Sub Private Sub SetCommInterval() Dim MsPerCh As Long MsPerCh = CLng(Val(txtMsPerCh)) If ((MsPerCh < 1) Or (MsPerCh > 20)) Then MsPerCh = 4 txtMsPerCh = 4 End If Timer1.Interval = MsPerCh * MCACh(MCA) End Sub Private Sub fraDataAcquisition_MouseDown(ByVal Button As Integer, ByVal Shift As Integer, ByVal X As Single, ByVal Y As Single) End Sub Private Sub fraPlotSpectrum_MouseDown(ByVal Button As Integer, ByVal Shift As Integer, ByVal X As Single, ByVal Y As Single) End Sub Private Sub InitProgram_Click() CommonDialog1.MaxFileSize = 512 Port = 1 Avg = 1 SetRiseAndAvg 0 FlatTop = 0 DAC = 1 ' default to shaped output DAC_Off = False MCA = 2 'btnMCA1024.Value = True ' default to 1024-channel MCA MCAEnable = True Call btnCountDelta_Click btnCountDelta.Value = True ' default to total count mode SetMaxZoom PUREnable = True DetReset = 2 ' default to reset lockout=3.28mS RTDOn = False RTDSlow = 0 RTDFast = 10 ' default RTD fast HWHM=10 BaselineOn = True strVersion = "VB v" + Right(CStr(App.Major), 1) + "." + Right(CStr(App.Minor), 2) strAppPath = App.Path BufferSelect = BufferSelectA SlowChThreshold = 4 ' default threhold=4 FastChThreshold = 100 ' default fast threshold=100 OutputOffset = 13 ' default offset=101mV Timer1.Enabled = False Timer1.Interval = 6000 SetCommInterval btnConfigure.BackColor = ConfigNeededColor If DP4_only Then btnDP4.Value = 1 DppDevice = DPPDP4 Else btnPX4.Value = 1 ' default to PX4 DppDevice = DPPPX4 End If lblTmr.Visible = True txtMsPerCh.Visible = True lblMsPerCh.Visible = True InitProgram.Visible = False InitProgram.Enabled = False btnRecallConfig.Visible = True btnRecallConfig.BackColor = ConfigNeededColor End Sub 'Public Sub SendArrayData(BinData As Variant) ' Dim idxData As Long ' For idxData = LBound(BinData) To UBound(BinData) ' Comm1.Output = Chr(BinData(idxData)) ' Next 'End Sub Private Function ReceiveArray(varInBuffer As Variant) As Variant Dim StrLen As Long Dim idxData As Long Dim MCATemp() As Byte StrLen = Len(varInBuffer) ReDim MCATemp(StrLen - 1) For idxData = 0 To StrLen - 1 MCATemp(idxData) = CByte(Asc(Mid(varInBuffer, idxData + 1, 1))) 'Call CEDoEvents Next idxData 'If (StrLen < 256) Then MsgBox "Rcv Data Error. Data len " & StrLen ReceiveArray = MCATemp lblCount.Visible = True End Function Private Sub lblFPGAVersion_Click() End Sub Private Sub lblMsPerCh_Click() End Sub Private Sub MSComm1_OnComm() Dim MCATemp As Variant Dim RequestStatusFlag As Boolean Dim X As Long Dim InBuffData As Variant Dim strDebug As String Dim BufferFull As Long Dim varDumpStr As Variant Dim strStatus As String Dim idxData As Long Dim strData As String RequestStatusFlag = False strDebug = "" On Error Resume Next Select Case MSComm1.CommEvent Case 1004 ' framing error strDebug = " framing error" lblStatus = "Framing Error!" CommError = True Case 1006 ' overrun error strDebug = " overrun error" lblStatus = "Overrun Error!" CommError = True Case 1008 ' receive buffer overflow strDebug = " receive buffer overflow" lblStatus = "Buffer overflow!" CommError = True Case 2 ' at least RThreshold characters are in the receive buffer strDebug = " receiving data start" If (MCACount <= (2 ^ ZoomValMax) * 3 - 2) Then InBuffData = MSComm1.Input strInBuff(MCACount) = InBuffData ClrCommIn strDebug = " receiving data 1" SendCmd Chr(MCADataMax * 3 + MCACount + 1) ' request data packet MCACount = MCACount + 1 ElseIf (MCACount = (2 ^ ZoomValMax) * 3 - 1) Then InBuffData = MSComm1.Input strInBuff(MCACount) = InBuffData ClrCommIn strDebug = " receiving data 2" HaveData = True If MCACountMode = 1 Then SendCmd Chr(&H64) ' request status packet with spectrum clear MCACount = &H64 Else SendCmd Chr(&H60) ' request status packet MCACount = &H60 End If ElseIf (MCACount = &H60) Or (MCACount = &HE0) Or (MCACount = &H64) Or (MCACount = &HE4) Then ' status A/B packet strStatus = MSComm1.Input ClrCommIn strDebug = " status A/B packet" StatusReceived = True strDebug = " status A/B packet 1" MCACount = 255 End If strDebug = " status A/B packet 2" If StatusReceived Then Timer1.Enabled = False StatusReceived = False ClrCommIn MCATemp = ReceiveArray(strStatus) strDebug = " Processing Status" Process_Status MCATemp If (HaveData) Then strDebug = " HaveData str->byte" For idxData = 0 To ((2 ^ ZoomValMax) * 3 - 1) strData = strInBuff(idxData) MCATemp = ReceiveArray(strData) If (UBound(MCATemp) >= 255) Then For X = 0 To 255 MCATemp1(X + idxData * 256) = CByte(MCATemp(X)) Next X Else HaveData = False End If Call CEDoEvents Next lblStatus = " passed data convert" End If If HaveData Then HaveData = False strDebug = " Processing Data" Process_Data 'MCATemp1 strDebug = " Processing Data Done" End If Timer1.Enabled = MCAEnable End If End Select If (MCACount <> 255) Then lblCount = MCACount '255 is indicator packet sequence completed lblCount.Refresh If Err.Number > 0 Then lblStatus = "OnComm Error " & vbNewLine & Err.Description & strDebug ClrCommIn On Error GoTo 0 End If End Sub Private Sub ClrCommIn() Dim varDumpStr As Variant If ((Port < 1) Or (Port > 8)) Then Exit Sub If (MSComm1.InBufferCount > 0) Then MSComm1.InputLen = 0 varDumpStr = MSComm1.Input MSComm1.InputLen = 256 End If End Sub Private Sub SendCmd(byteCmd As String) Dim varDumpStr As Variant If ((Port < 1) Or (Port > 8)) Then Exit Sub ClrCommIn MSComm1.Output = (Chr(&HFD) & byteCmd & Chr(&HFF)) Sleep 70 End Sub Private Sub Process_Status(MCATemp As Variant) Dim strStatus As String Dim strDppType As String lblStatus = "Process_Status" FastCount = CSng(MCATemp(0)) + CSng(MCATemp(1)) * 256 + CSng(MCATemp(2)) * 65536 + CSng(MCATemp(3)) * (2 ^ 24) SlowCount = CSng(MCATemp(4)) + CSng(MCATemp(5)) * 256 + CSng(MCATemp(6)) * 65536 + CSng(MCATemp(7)) * (2 ^ 24) FPGA = MCATemp(8) ' FPGA version Firmware = MCATemp(13) ' embedded code version SerialNumber = CLng(MCATemp(14)) + CLng(MCATemp(15)) * 256 + CLng(MCATemp(16)) * 65536 + CLng(MCATemp(17)) * (2 ^ 24) AccumulationTime = CSng(MCATemp(9)) * 0.001 + (CSng(MCATemp(10)) + CSng(MCATemp(11)) * 256 + CSng(MCATemp(12)) * 65536) * 0.1 ' byte 7 counts 1mS ticks, bytes 8-10 count 100mS ticks MiscCount = CSng(MCATemp(24)) + CSng(MCATemp(25)) * 256 + CSng(MCATemp(26)) * 65536 + CSng(MCATemp(27)) * 256 * 65536 BootStatus = MCATemp(23) ' boot flags Call CEDoEvents If (BootStatus And 128) = 128 Then btnPX4.Value = True strDppType = "PX4" DppDevice = DPPPX4 Else btnDP4.Value = True strDppType = "DP4" DppDevice = DPPDP4 End If strStatus = "" strStatus = strStatus & "Device Type: " & strDppType & vbNewLine strStatus = strStatus & "Serial Number: " & CStr(SerialNumber) & vbNewLine strStatus = strStatus & "Firmware: " & Right(CStr((Firmware And 240) / 16), 1) & "." & FormatNumber(Firmware And 15, 0) & vbNewLine strStatus = strStatus & "FPGA: " & Right(CStr((FPGA And 112) / 16), 1) & "." & FormatNumber(FPGA And 15, 0) & vbNewLine strStatus = strStatus & "Fast Count: " & CStr(FastCount) & vbNewLine strStatus = strStatus & "Slow Count: " & CStr(SlowCount) & vbNewLine strStatus = strStatus & "Accumulation Time:" & FormatNumber(AccumulationTime, 0) & " sec" & vbNewLine 'strStatus = strStatus & "Misc Count=" + CStr(MiscCount) & vbNewLine If (MCATemp(23) And 32) = 32 Then ' MCA enabled cmdStartStopAcq.Caption = "Stop Acquisition" cmdStartStopAcq.BackColor = &HFF00& 'Green Else cmdStartStopAcq.Caption = "Start Acquisition" cmdStartStopAcq.BackColor = &HFF& 'Red End If Call CEDoEvents If CBool(DppDevice) Then 'true if px4 strStatus = strStatus & "HV Volt: " & FormatNumber((CSng(MCATemp(18) And 15) * 256 + CSng(MCATemp(19))) / 2, 0) & "V" & vbNewLine strStatus = strStatus & "TEC Temp: " & FormatNumber((CSng(MCATemp(20) And 15) * 256 + CSng(MCATemp(21))) / 10, 0) & "K" & vbNewLine End If strStatus = strStatus & "Board Temp: " & CStr((MCATemp(22) - (MCATemp(22) And 128) * 2)) & "°C" & vbNewLine ' If Firmware >= &H42 Then ' memory test for FW 4.02 and later ' Select Case (MCATemp(28) And 3) ' Case 0, 1 ' strStatus = strStatus & "Mem Test not run" & vbNewLine ' Case 2 ' strStatus = strStatus & "Memory Test OK" & vbNewLine ' Case 3 ' strStatus = strStatus & "Mem Test error!" & vbNewLine ' End Select ' End If txtDppStatus = strStatus DppStatusMCA = "<>" & vbNewLine & strStatus & "<>" & vbNewLine lblStatus = "Process Status Done" End Sub Private Sub PlotDataTest(varMCAData As Variant, picPlot1 As PictureBoxCtl.PictureBox) Dim MCAMax As Long Dim MCAScale As Long Dim PlotXMin As Long Dim PlotXMax As Long Dim idxX As Long Dim idxY As Long Dim idxData As Long Dim MCAData(8192) As Long 'holds the live spectra data Dim ScaleVal As Integer Dim isLinear As Boolean Dim isLines As Boolean Dim PlotColor As Long Dim XScale As Double Dim YScale As Double Dim X1 As Long Dim Y1 As Long Dim X2 As Long Dim Y2 As Long Dim YZero As Long Dim NumPnts As Long Dim pntSpectra() As Long Dim strSpectra As String Dim idxPnts As Long Dim Results As Long picPlot1.Cls picPlot1.Refresh picPlot1.Refresh picPlot1.Refresh PlotColor = vbRed lblSrcLine = "1" If (LastFrame = 4) Then isLinear = OptScaleTypeLinear2.Value isLines = OptPlotTypeLine2.Value Else isLinear = OptScaleTypeLinear.Value isLines = OptPlotTypeLine.Value End If lblSrcLine = "2" For idxData = LBound(varMCAData) To UBound(varMCAData) MCAData(idxData) = varMCAData(idxData) Call CEDoEvents Next MCAMax = 0 For idxX = LBound(varMCAData) To UBound(varMCAData) If MCAData(idxX) > MCAMax Then MCAMax = MCAData(idxX) End If Call CEDoEvents Next idxX lblSrcLine = "3" PlotXMin = LBound(varMCAData) PlotXMax = UBound(varMCAData) lblSrcLine = "4" If (CDbl(PlotXMax + 1) <= 0) Then Exit Sub XScale = (CDbl(picPlot1.ScaleWidth) / CDbl(PlotXMax + 1)) 'scale the x axis ScaleVal = CInt(Fix(Log(CSng(MCAMax) + 1#) / Log(10) + 1)) If (ScaleVal < 1) Then ScaleVal = 1 MCAScale = 10 ^ ScaleVal If (CDbl(Log(MCAScale)) <= 0) Then Exit Sub YScale = (CDbl(picPlot1.ScaleHeight) / CDbl(Log(MCAScale))) '* 0.76 lblSrcLine = "5" If (MCAMax = 0) Then Exit Sub If (isLinear) Then MCAScale = MCAMax If (MCAMax > 0) Then ScaleVal = MCAMax / 10 YScale = (CDbl(picPlot1.ScaleHeight) / CDbl(MCAScale)) '* 0.76 End If lblSrcLine = "6" If isLinear Then For idxX = 1 To 9 X1 = CLng(XScale * CDbl(PlotXMin)) Y1 = CLng(YScale * CDbl(MCAScale - (MCAScale * idxX / 10))) X2 = CLng(XScale * CDbl(PlotXMax + 1)) Y2 = CLng(YScale * CDbl(MCAScale - (MCAScale * idxX / 10))) 'picPlot1.DrawLine X1, Y1, X2, Y2, vbCyan DrawLinePoly X1, Y1, X2, Y2, picPlot1 'MsgBox X1 & " : " & Y1 & " : " & X2 & " : " & Y2 Next idxX Else For idxY = 1 To ScaleVal idxX = 1 'For idxX = 1 To 9 X1 = CLng(XScale * CDbl(PlotXMin)) Y1 = CLng(YScale * CDbl(Log(MCAScale) - Log(MCAScale * idxX / (10 ^ idxY)))) X2 = CLng(XScale * CDbl(PlotXMax + 1)) Y2 = CLng(YScale * CDbl(Log(MCAScale) - Log(MCAScale * idxX / (10 ^ idxY)))) 'picPlot1.DrawLine X1, Y1, X2, Y2, vbCyan DrawLinePoly X1, Y1, X2, Y2, picPlot1 'MsgBox X1 & " : " & Y1 & " : " & X2 & " : " & Y2 'Next idxX Next idxY End If lblSrcLine = "7" NumPnts = (PlotXMax - PlotXMin) + 3 ReDim pntSpectra(1, NumPnts) NumPnts = NumPnts + 1 'number of points is ub + 1 idxPnts = -1 'indexes point array idxPnts = idxPnts + 1 pntSpectra(0, idxPnts) = 0 'the plot starts at the lower left corner pntSpectra(1, idxPnts) = picPlot1.ScaleHeight For idxX = PlotXMin To PlotXMax - 1 If isLinear Then X1 = CLng(XScale * CDbl(idxX)) Y1 = CLng(YScale * CDbl(MCAScale - MCAData(idxX))) X2 = CLng(XScale * CDbl(idxX + 1)) Y2 = CLng(YScale * CDbl(MCAScale - MCAData(idxX + 1))) 'picPlot1.DrawLine X1, Y1, X2, Y2, PlotColor YZero = CLng(YScale * CDbl(MCAScale)) Else X1 = CLng(XScale * CDbl(idxX)) Y1 = CLng(YScale * CDbl(Log(MCAScale) - Log(0.01 + MCAData(idxX)))) X2 = CLng(XScale * CDbl(idxX + 1)) Y2 = CLng(YScale * CDbl(Log(MCAScale) - Log(0.01 + MCAData(idxX + 1)))) 'picPlot1.DrawLine X1, Y1, X2, Y2, PlotColor YZero = CLng(YScale * CDbl(Log(MCAScale))) End If idxPnts = idxPnts + 1 pntSpectra(0, idxPnts) = X1 pntSpectra(1, idxPnts) = Y1 ' If isLines Then ' DrawLinePoly X1, Y1, X2, Y2, picPlot1 ' Else ' DrawFilledPoly X1, Y1, X2, Y2, YZero, picPlot1 ' End If Call CEDoEvents Next idxX idxPnts = idxPnts + 1 pntSpectra(0, idxPnts) = picPlot1.ScaleWidth 'the plot ends at the bottom of the picbox pntSpectra(1, idxPnts) = picPlot1.ScaleHeight idxPnts = idxPnts + 1 pntSpectra(0, idxPnts) = pntSpectra(0, 0) 'the last point is the plot start pntSpectra(1, idxPnts) = pntSpectra(1, 0) strSpectra = CreatePointString(pntSpectra) If isLines Then Results = PlotPolyline(strSpectra, NumPnts) Else 'close the polygon Results = PlotPolygon(strSpectra, NumPnts) End If lblSrcLine = "8" End Sub 'draws a filled polygon Private Sub DrawFilledPoly(X1 As Long, Y1 As Long, X2 As Long, Y2 As Long, YZero As Long, picPlot1 As PictureBox) Dim pntSpectra(1, 4) As Long Dim strSpectra As String Dim Results As Long pntSpectra(0, 0) = X1 pntSpectra(1, 0) = YZero pntSpectra(0, 1) = X1 pntSpectra(1, 1) = Y1 pntSpectra(0, 2) = X2 pntSpectra(1, 2) = Y2 pntSpectra(0, 3) = X2 pntSpectra(1, 3) = YZero pntSpectra(0, 4) = X1 pntSpectra(1, 4) = YZero strSpectra = CreatePointString(pntSpectra) Results = PlotPolygon(strSpectra, 5) End Sub 'draws a filled polygon Private Sub DrawLinePoly(X1 As Long, Y1 As Long, X2 As Long, Y2 As Long, picPlot1 As PictureBox) Dim pntSpectra(1, 1) As Long Dim strSpectra As String Dim Results As Long pntSpectra(0, 0) = X1 pntSpectra(1, 0) = Y1 pntSpectra(0, 1) = X2 pntSpectra(1, 1) = Y2 strSpectra = CreatePointString(pntSpectra) Results = PlotPolygon(strSpectra, 2) End Sub Private Sub Process_Data() Dim MCAMax As Long, MCAPeak As Long, TString As String, buffer(64) Dim MCAScale As Long Dim PlotXMin As Long Dim PlotXMax As Long Dim MCATemp2 As Long Dim MCAPlot() As Long Dim X, Y, T Dim idxPlot As Long Dim idxPnt As Long Dim strFileData As String Dim strFilename As String lblStatus = "Process Data" If IsEmpty(MCAData) Then lblStatus = "Process Data " & vbNewLine & "MCAData Empty" Exit Sub End If If IsEmpty(MCATemp1) Then lblStatus = "Process Data " & vbNewLine & "MCATemp1 Empty" Exit Sub End If MCAMax = 0 MCAPeak = 0 For X = 0 To (256 * (2 ^ ZoomValMax) - 1) ' serial port only sends the zoomed region MCAData(X) = CLng(MCATemp1(X * 3)) + CLng(MCATemp1(X * 3 + 1)) * 256 + CLng(MCATemp1(X * 3 + 2)) * 65536 If MCAData(X) > MCAMax Then MCAMax = MCAData(X) MCAPeak = X End If Call CEDoEvents Next X MCAPeak = MCAPeak + 1 'channels have 1 based index StatusReceived = False ReDim MCAPlot((256 * (2 ^ ZoomValMax) - 1)) idxPnt = -1 For idxPlot = 0 To (256 * (2 ^ ZoomValMax) - 1) idxPnt = idxPnt + 1 MCAPlot(idxPnt) = MCAData(idxPlot) Next If (fraDataAcquisition.Visible) Then lblPeakCnts = CStr(MCAMax) lblPeakCnts.Refresh lblPeak = CStr(MCAPeak) lblPeak.Refresh PlotDataTest MCAPlot, picMCAPlot End If If SaveFile Then If CommError = False Then strFileData = "" strFileData = strFileData & "<>" & vbNewLine strFileData = strFileData & "TAG - DPP" & vbNewLine strFileData = strFileData & "DESCRIPTION - Output from DPP test software" & vbNewLine strFileData = strFileData & "" & vbNewLine strFileData = strFileData & "" & vbNewLine strFileData = strFileData & "" & vbNewLine strFileData = strFileData & "GAIN - " & 4 - MCA & vbNewLine strFileData = strFileData & "LIVE_MODE - 0" & vbNewLine strFileData = strFileData & "PRESET_TIME - 0" & vbNewLine strFileData = strFileData & "LIVE_TIME - 0" & vbNewLine 'strFileData = strFileData & "<>" 'strFileData = strFileData & "<>" strFileData = strFileData & "REAL_TIME - " & AccumulationTime & vbNewLine strFileData = strFileData & "START_TIME - " & Date & " " & Time & vbNewLine strFileData = strFileData & "SERIAL_NUMBER - " & SerialNumber & vbNewLine strFileData = strFileData & "<>" & vbNewLine Select Case MCA Case 0, 1, 2, 3, 4 MCATemp2 = MCA + 1 Case 5 MCATemp2 = 0 End Select For idxPlot = 0 To (256 * (2 ^ ZoomValMax) - 1) strFileData = strFileData & MCAData(idxPlot) & vbNewLine Next idxPlot strFileData = strFileData & "<>" & vbNewLine strFileData = strFileData & DppConfigMCA & vbNewLine strFileData = strFileData & DppStatusMCA & vbNewLine CreateDirPath strAppPath & "\Spectra", FileSystem1 strFilename = strAppPath & "\Spectra\" & CreateDTS() & ".mca" WriteFile strFilename, strFileData, File1 SaveFile = False btnSave.Visible = True btnSave.Enabled = True End If End If lblStatus = "Process Data Done" End Sub Private Sub Option4_Click() End Sub Private Sub Timer1_Timer() Dim Temp As Variant If (MSComm1.PortOpen = False) Then Exit Sub On Error Resume Next Temp = MSComm1.Input ' flush input buffer to synchronize If (Err.Number > 0) Then lblStatus = "Timer " & Err.Description On Error GoTo 0 HaveData = False MCACount = 0 SendCmd Chr(MCADataMax * 3) ' request first packet CommError = False ' clear error flag End Sub Private Sub txtDeviceConfiguration_Change() End Sub Private Sub txtMsPerCh_Change() SetCommInterval End Sub Private Function OpenFileDlg(strFilter As String, strDefaultExt As String) As String frmOpen.Done = False frmOpen.OpenFilePath = "" frmOpen.ClearFileFilters frmOpen.SetFileFilter "*.*", "*.*" frmOpen.SetFileFilter strFilter, strDefaultExt frmOpen.Hide frmOpen.Show vbModal Do CEDoEvents Loop Until frmOpen.Done OpenFileDlg = frmOpen.OpenFilePath End Function 'Private Sub MSCommOut(strData As String) ' Dim strChar As String ' Dim idxData As Long ' ' For idxData = 1 To Len(strData) ' strChar = Mid(strData, idxData, 1) ' MSComm1.Output = strChar ' CEDoEvents ' Next 'End Sub