⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 mdimain.frm

📁 AD9954源码
💻 FRM
📖 第 1 页 / 共 4 页
字号:
         Caption         =   "Debug"
      End
      Begin VB.Menu mnuWindowTestReg 
         Caption         =   "Test Regster Window"
      End
      Begin VB.Menu mnuWindowRegMap 
         Caption         =   "Register Map"
      End
      Begin VB.Menu mnuSpace 
         Caption         =   "-"
      End
      Begin VB.Menu mnuWindowSVGARes 
         Caption         =   "800x600"
      End
   End
   Begin VB.Menu mnuHelp 
      Caption         =   "Help"
      Begin VB.Menu mnuHelpContents 
         Caption         =   "Contents"
         Enabled         =   0   'False
      End
      Begin VB.Menu mnuHelpAbout 
         Caption         =   "About"
      End
   End
   Begin VB.Menu mnuToolBarPopup 
      Caption         =   "ToolBarPopup"
      Visible         =   0   'False
      Begin VB.Menu mnuToolBarPopupButtonsOnly 
         Caption         =   "Button Text Off"
      End
   End
End
Attribute VB_Name = "mdiMain"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private ToolBarMenuText As Collection
Public WithEvents EvBd As cls9859EVBD
Attribute EvBd.VB_VarHelpID = -1
Private FlashCntr As Integer

Private Sub MDIForm_Activate()
    'Don't enable the load button timer
    mdiMain.tmrLoadAnim.Enabled = True
End Sub

Private Sub MDIForm_Load()
    Dim cntr As Integer
                
    'Set the caption for the main form
    Me.Caption = MainWindowTitle
                
    'Initialize the evalboard driver
    Set EvBd = New cls9859EVBD
    
    Set ToolBarMenuText = New Collection
        
    For cntr = 1 To tlbMainToolBar.Buttons.Count
        'Add the text to the collection
        ToolBarMenuText.Add tlbMainToolBar.Buttons(cntr).Caption, tlbMainToolBar.Buttons(cntr).Key
    Next cntr
    
    'Used for internal use only
    #If AdiMode Then
        mnuWindowRegMap.Visible = True
        mnuSpace.Visible = True
        mnuWindowSVGARes.Visible = True
    #Else
        mnuWindowRegMap.Visible = False
        mnuSpace.Visible = False
        mnuWindowSVGARes.Visible = False
    #End If
    
End Sub

Private Sub MDIForm_QueryUnload(Cancel As Integer, UnloadMode As Integer)
    ExitGracefully
End Sub

Private Sub MDIForm_Resize()
    'Re enable the logo center timer
    frmMdiBack.tmrCenterForm.Enabled = True
    
    Select Case mdiMain.WindowState
         Case vbNormal:
         Case vbMinimized:
         Case vbMaximized:
    End Select
End Sub

Private Sub mnuFileExit_Click()
    Dim Cancel As Integer
    'Exit the program
    MDIForm_QueryUnload Cancel, vbFormControlMenu
End Sub

Private Sub mnuFileLoadSettings_Click()
    'Setup an error handler
    On Error GoTo ErrorHandler
    
    'Setup the common dialog for opening files
    cdgFileOpenSave.flags = cdlOFNFileMustExist + cdlOFNHideReadOnly + cdlOFNLongNames + cdlOFNNoChangeDir
    cdgFileOpenSave.DialogTitle = "Load Setup File"
    cdgFileOpenSave.CancelError = True
    cdgFileOpenSave.filter = "Setup Files (*.stp)|*.stp|Text (*.txt)|*.txt"
    cdgFileOpenSave.FilterIndex = 0
    cdgFileOpenSave.InitDir = App.path

    'Show the open dialog
    cdgFileOpenSave.ShowOpen
    
    'Load the current setup file in to the program and DUT
    LoadSetup cdgFileOpenSave.filename
    
    'Exit the subroutine before the errorhandler
    Exit Sub

'Define an error handler
ErrorHandler:
    'Check for the cancel button hit error
    If Err.Number = cdlCancel Then
        'Exit the subroutine if the cancel button was hit
        Exit Sub
    End If
End Sub

Private Sub mnuFileOpenRAMFile_Click()
    If frmRAMEditor.Visible Then
        frmRAMEditor.WindowState = vbNormal
        frmRAMEditor.ZOrder 0
    Else
        frmRAMEditor.ShowRAMFileEditor
    End If
End Sub

Private Sub mnuHelpAbout_Click()
    frmAbout.Show
End Sub

Private Sub mnuPCIO_FindEvalBd_Click()
    Dim EvalBdDetected As Integer
    Dim NumOfDUTsDetected As Integer
'    Load frmSplash
'    frmSplash.Show
    
    'Try and detect a DUT on each LPT port connected to the
'    For cntr = 0 To frmLPTSelect.LPTGetPortCount() - 1
'        'Select the LPT port to test
'        frmLPTSelect.LPTSelectPort cntr
'        'Sync up the PC and Eval Board
'        EvalBd.InitEvalBoard
'        'Try to Detect the DUTs
'        EvBdDetected = EvalBd.DetectEvalBoard
'        NumOfDUTsDetected = EvalBd.DetectDUTs
'        If NumOfDUTsDetected Or EvBdDetected Then
'            EvalBdDetected = True
'            Exit For
'        End If
'    Next cntr
    FindEvBoard NumOfDUTsDetected, EvalBdDetected, True
    'Display a status line of what was found
'    If EvalBdDetected Then
'        frmSplash.AddStatLine "    Evaluation Board found at LPT" & cntr + 1 & "."
'    Else
'        frmSplash.txtStatus.ForeColor = RGB(255, 0, 0)
'        frmSplash.AddStatLine "Error:  Evaluation Board Not Found!!!"
'        frmLPTSelect.LPTSelectPort 0 'Reselect LPT1
'    End If
    
    Select Case NumOfDUTsDetected
        Case 0:
            'Display an error message
            mdiMain.stbStatusBar.Panels(2).Text = "DUT1: Not Inst."
            mdiMain.stbStatusBar.Panels(3).Text = "DUT2: Not Inst."
            
        Case 1:
            'Read the CFR2 register to detect the DUT
            DUT1_CFR2 = EvalBd.SerialRead(1, &H1)
            'Trimm off everything except the bond option bits
            DUT1_CFR2 = Left(DUT1_CFR2, 8)
        
            'Decode the bits for DUT1
            Select Case DUT1_CFR2
                Case "00011010": 'Evaluation Product
                    mdiMain.stbStatusBar.Panels(2).Text = "DUT1: AD9954E"
                Case "00000101": 'AD9859 - No Options,10 bit DAC
                    mdiMain.stbStatusBar.Panels(2).Text = "DUT1: AD9859"
                Case "00000100": 'AD9951 - No Options,14 bit DAC
                    mdiMain.stbStatusBar.Panels(2).Text = "DUT1: AD9951"
                Case "00000000": 'AD9952 - Comparator Active, 14 bit DAC
                    mdiMain.stbStatusBar.Panels(2).Text = "DUT1: AD9952"
                Case "00010100": 'AD9953 - RAM Active, 14 bit DAC
                    mdiMain.stbStatusBar.Panels(2).Text = "DUT1: AD9953"
                Case "00011000": 'AD9954 - All Options, 14 bit DAC
                    mdiMain.stbStatusBar.Panels(2).Text = "DUT1: AD9954"
                Case "00001100": 'AD80XXX - Linear Sweep, 14 Bit DAC
                    mdiMain.stbStatusBar.Panels(2).Text = "DUT1: AD80XXX"
                Case Else:
                    mdiMain.stbStatusBar.Panels(2).Text = "DUT1: Not Inst."
            End Select

        Case 2:
            'Read the CFR2 register to detect the DUT
            DUT2_CFR2 = EvalBd.SerialRead(2, &H1)
            'Trimm off everything except the bond option bits
            DUT2_CFR2 = Left(DUT2_CFR2, 8)
            'Decode the bits for DUT2
            Select Case DUT2_CFR2
                Case "00011010": 'Evaluation Product
                    frmSplash.AddStatLine "    DUT2: AD9954E." 'Evaluation Product"
                    mdiMain.stbStatusBar.Panels(3).Text = "DUT2: AD9954E"
                Case "00000101": 'AD9859 - No Options,10 bit DAC
                    frmSplash.AddStatLine "    DUT2: AD9859."
                    mdiMain.stbStatusBar.Panels(3).Text = "DUT2: AD9859"
                Case "00000100": 'AD9951 - No Options,14 bit DAC
                    frmSplash.AddStatLine "    DUT2: AD9951."
                    mdiMain.stbStatusBar.Panels(3).Text = "DUT2: AD9951"
                Case "00000000": 'AD9952 - Comparator Active, 14 bit DAC
                    frmSplash.AddStatLine "    DUT2: AD9952."
                    mdiMain.stbStatusBar.Panels(3).Text = "DUT2: AD9952"
                Case "00010100": 'AD9953 - RAM Active, 14 bit DAC
                    frmSplash.AddStatLine "    DUT2: AD9953."
                    mdiMain.stbStatusBar.Panels(3).Text = "DUT2: AD9953"
                Case "00011000": 'AD9954 - All Options, 14 bit DAC
                    frmSplash.AddStatLine "    DUT2: AD9954."
                    mdiMain.stbStatusBar.Panels(3).Text = "DUT2: AD9954"
                Case "00001100": 'AD80XXX - Linear Sweep, 14 Bit DAC
                    frmSplash.AddStatLine "    DUT2: AD80XXX."
                    mdiMain.stbStatusBar.Panels(3).Text = "DUT2: AD80XXX"
                Case Else:
                    frmSplash.AddStatLine "    DUT2: Not Installed!!!"
                    mdiMain.stbStatusBar.Panels(3).Text = "DUT2: Not Inst."
            End Select
            frmSplash.AddStatLine "    DUT1: Not Installed."
        Case 3:
            'Read the CFR2 register to detect the DUT
            DUT1_CFR2 = EvalBd.SerialRead(1, &H1)
            DUT2_CFR2 = EvalBd.SerialRead(2, &H1)
            
            'Trimm off everything except the bond option bits
            DUT1_CFR2 = Left(DUT1_CFR2, 8)
            DUT2_CFR2 = Left(DUT2_CFR2, 8)
            
            Select Case DUT1_CFR2
                Case "00011010": 'Evaluation Product
                    mdiMain.stbStatusBar.Panels(2).Text = "DUT1: AD9954E"
                Case "00000101": 'AD9859 - No Options,10 bit DAC
                    mdiMain.stbStatusBar.Panels(2).Text = "DUT1: AD9859"
                Case "00000100": 'AD9951 - No Options,14 bit DAC
                    mdiMain.stbStatusBar.Panels(2).Text = "DUT1: AD9951"
                Case "00000000": 'AD9952 - Comparator Active, 14 bit DAC
                    mdiMain.stbStatusBar.Panels(2).Text = "DUT1: AD9952"
                Case "00010100": 'AD9953 - RAM Active, 14 bit DAC
                    mdiMain.stbStatusBar.Panels(2).Text = "DUT1: AD9953"
                Case "00011000": 'AD9954 - All Options, 14 bit DAC
                    mdiMain.stbStatusBar.Panels(2).Text = "DUT1: AD9954"
                Case "00001100": 'AD80XXX - Linear Sweep, 14 Bit DAC
                    mdiMain.stbStatusBar.Panels(2).Text = "DUT1: AD80XXX"
                Case Else:
                    mdiMain.stbStatusBar.Panels(2).Text = "DUT1: Not Inst."
            End Select
            
            'Decode the bits for DUT2
            Select Case DUT2_CFR2
                Case "00011010": 'Evaluation Product
                    mdiMain.stbStatusBar.Panels(3).Text = "DUT2: AD9954E"
                Case "00000101": 'AD9859 - No Options,10 bit DAC
                    mdiMain.stbStatusBar.Panels(3).Text = "DUT2: AD9859"
                Case "00000100": 'AD9951 - No Options,14 bit DAC
                    mdiMain.stbStatusBar.Panels(3).Text = "DUT2: AD9951"
                Case "00000000": 'AD9952 - Comparator Active, 14 bit DAC
                    mdiMain.stbStatusBar.Panels(3).Text = "DUT2: AD9952"
                Case "00010100": 'AD9953 - RAM Active, 14 bit DAC
                    mdiMain.stbStatusBar.Panels(3).Text = "DUT2: AD9953"
                Case "00011000": 'AD9954 - All Options, 14 bit DAC
                    mdiMain.stbStatusBar.Panels(3).Text = "DUT2: AD9954"
                Case "00001100": 'AD80XXX - Linear Sweep, 14 Bit DAC
                    mdiMain.stbStatusBar.Panels(3).Text = "DUT2: AD80XXX"
                Case Else:
                    mdiMain.stbStatusBar.Panels(3).Text = "DUT2: Not Inst."
            End Select
    End Select

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -