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

📄 modmain.bas

📁 AD9954源码
💻 BAS
📖 第 1 页 / 共 5 页
字号:
                    If UseRS0 Then
                        EvalBd.SetActiveProfile DUTNum, 1
                        'Delay

                        'Load the RAM out in the right order
                        If LSBFirstDUT1 Then
                            CntrStart = 1
                            CntrStep = 1
                            CntrStop = ((FinalAddressRS0 - StartAddressRS0) + 1)
                        Else
                            CntrStart = ((FinalAddressRS0 - StartAddressRS0) + 1)
                            CntrStop = 1
                            CntrStep = -1
                        End If
                        
                        'Setup the status bar
                        With frmRAMLoadStatus
                            frmRAMLoadStatus.lblMsg.Caption = "Writing File To RAM: RS0"
                            If CntrStart < CntrStop Then
                                .pbrProgress.Min = CntrStart
                                .pbrProgress.Max = CntrStop
                                UpdatePrgBar = True
                            Else
                                If CntrStart > CntrStop Then
                                    .pbrProgress.Min = CntrStop
                                    .pbrProgress.Max = CntrStart
                                    UpdatePrgBar = True
                                Else
                                    'Setup the progress bar with known values
                                    .pbrProgress.Min = 0
                                    .pbrProgress.Max = 1
                                    UpdatePrgBar = False
                                End If
                            End If
                            PrgCntr = 1
                            .pbrProgress.value = .pbrProgress.Min
                            .Refresh
                        End With
    
                        'Initiate a Upload
                        EvalBd.RAMInitUpload DUTNum
                        'Upload 32 bits at a time
                        For cntr = CntrStart To CntrStop Step CntrStep
                            EvalBd.RAMWritePacket DUTNum, RamSegment0Data(cntr - 1)
                            If UpdatePrgBar = True Then
                                'Update the status window
                                frmRAMLoadStatus.pbrProgress.value = PrgCntr
                                PrgCntr = PrgCntr + 1
                                frmRAMLoadStatus.pbrProgress.Refresh
                            Else
                                'Show that were finished
                                frmRAMLoadStatus.pbrProgress.value = frmRAMLoadStatus.pbrProgress.Max
                                frmRAMLoadStatus.pbrProgress.Refresh
                            End If
                        Next cntr
                        'Terminate the upload
                        EvalBd.RAMTerminateUpload DUTNum
                    End If
                    
                    'Write to the RSCW1 Register
                    EvalBd.SerialLoad DUTNum, &H8, RSCW1Str
                    '*** Now Load the RAM Data into the RAM for RSCW1 ***
                    'Set the profile to write to the correct RAM Segment
                    If UseRS1 Then
                        EvalBd.SetActiveProfile DUTNum, 2
                        'Delay

                        'Load the RAM out in the right order
                        If LSBFirstDUT1 Then
                            CntrStart = 1
                            CntrStop = ((FinalAddressRS1 - StartAddressRS1) + 1)
                            CntrStep = 1
                        Else
                            CntrStart = ((FinalAddressRS1 - StartAddressRS1) + 1)
                            CntrStop = 1
                            CntrStep = -1
                        End If

                        'Setup the status bar
                        With frmRAMLoadStatus
                            frmRAMLoadStatus.lblMsg.Caption = "Writing File To RAM: RS1"
                            If CntrStart < CntrStop Then
                                .pbrProgress.Min = CntrStart
                                .pbrProgress.Max = CntrStop
                                UpdatePrgBar = True
                            Else
                                If CntrStart > CntrStop Then
                                    .pbrProgress.Min = CntrStop
                                    .pbrProgress.Max = CntrStart
                                    UpdatePrgBar = True
                                Else
                                    'Setup the progress bar with known values
                                    .pbrProgress.Min = 0
                                    .pbrProgress.Max = 1
                                    UpdatePrgBar = False
                                End If
                            End If
                            PrgCntr = 1
                            .pbrProgress.value = .pbrProgress.Min
                            .Refresh
                        End With

                        'Initiate a Upload
                        EvalBd.RAMInitUpload DUTNum
                        'Upload 32 bits at a time
                        For cntr = CntrStart To CntrStop Step CntrStep
                            EvalBd.RAMWritePacket DUTNum, RamSegment1Data(cntr - 1)
                            'Update the status window
                            If UpdatePrgBar = True Then
                                'Update the status window
                                frmRAMLoadStatus.pbrProgress.value = PrgCntr
                                PrgCntr = PrgCntr + 1
                                frmRAMLoadStatus.pbrProgress.Refresh
                            Else
                                'Show that were finished
                                frmRAMLoadStatus.pbrProgress.value = frmRAMLoadStatus.pbrProgress.Max
                                frmRAMLoadStatus.pbrProgress.Refresh
                            End If
                        Next cntr

                        'Terminate the upload
                        EvalBd.RAMTerminateUpload DUTNum
                    End If

                    'Write to the RSCW2 Register
                    EvalBd.SerialLoad DUTNum, &H9, RSCW2Str
                    '*** Now Load the RAM Data into the RAM for RSCW2 ***
                    'Set the profile to write to the correct RAM Segment
                    If UseRS2 Then
                        EvalBd.SetActiveProfile DUTNum, 3
                        'Delay
                        'Load the RAM out in the right order
                        If LSBFirstDUT1 Then
                            CntrStart = 1
                            CntrStop = ((FinalAddressRS2 - StartAddressRS2) + 1)
                            CntrStep = 1
                        Else
                            CntrStart = ((FinalAddressRS2 - StartAddressRS2) + 1)
                            CntrStop = 1
                            CntrStep = -1
                        End If

                        'Setup the status bar
                        With frmRAMLoadStatus
                            frmRAMLoadStatus.lblMsg.Caption = "Writing File To RAM: RS2"
                            If CntrStart < CntrStop Then
                                .pbrProgress.Min = CntrStart
                                .pbrProgress.Max = CntrStop
                                UpdatePrgBar = True
                            Else
                                If CntrStart > CntrStop Then
                                    .pbrProgress.Min = CntrStop
                                    .pbrProgress.Max = CntrStart
                                    UpdatePrgBar = True
                                Else
                                    'Setup the progress bar with known values
                                    .pbrProgress.Min = 0
                                    .pbrProgress.Max = 1
                                    UpdatePrgBar = False
                                End If
                            End If
                            PrgCntr = 1
                            .pbrProgress.value = .pbrProgress.Min
                            .Refresh
                        End With

                        'Initiate a Upload
                        EvalBd.RAMInitUpload DUTNum
                        'Upload 32 bits at a time
                        For cntr = CntrStart To CntrStop Step CntrStep
                            EvalBd.RAMWritePacket DUTNum, RamSegment2Data(cntr - 1)
                            'Update the status window
                            If UpdatePrgBar = True Then
                                'Update the status window
                                frmRAMLoadStatus.pbrProgress.value = PrgCntr
                                PrgCntr = PrgCntr + 1
                                frmRAMLoadStatus.pbrProgress.Refresh
                            Else
                                'Show that were finished
                                frmRAMLoadStatus.pbrProgress.value = frmRAMLoadStatus.pbrProgress.Max
                                frmRAMLoadStatus.pbrProgress.Refresh
                            End If
                        Next cntr

                        'Terminate the upload
                        EvalBd.RAMTerminateUpload DUTNum
                    End If

                    'Write to the RSCW3 Register
                    EvalBd.SerialLoad DUTNum, &HA, RSCW3Str
                    '*** Now Load the RAM Data into the RAM for RSCW3 ***
                    'Set the profile to write to the correct RAM Segment
                    If UseRS3 Then
                        'Set the proper profile
                        EvalBd.SetActiveProfile DUTNum, 4
                        'Delay
                        'Load the RAM out in the right order
                        If LSBFirstDUT1 Then
                            CntrStart = 1
                            CntrStop = ((FinalAddressRS3 - StartAddressRS3) + 1)
                            CntrStep = 1
                        Else
                            CntrStart = ((FinalAddressRS3 - StartAddressRS3) + 1)
                            CntrStop = 1
                            CntrStep = -1
                        End If
                        'Setup the status bar
                        With frmRAMLoadStatus
                            frmRAMLoadStatus.lblMsg.Caption = "Writing File To RAM: RS3"
                            If CntrStart < CntrStop Then
                                .pbrProgress.Min = CntrStart
                                .pbrProgress.Max = CntrStop
                                UpdatePrgBar = True
                            Else
                                If CntrStart > CntrStop Then
                                    .pbrProgress.Min = CntrStop
                                    .pbrProgress.Max = CntrStart
                                    UpdatePrgBar = True
                                Else
                                    'Setup the progress bar with known values
                                    .pbrProgress.Min = 0
                                    .pbrProgress.Max = 1
                                    UpdatePrgBar = False
                                End If
                            End If
                            PrgCntr = 1
                            .pbrProgress.value = .pbrProgress.Min
                            .Refresh
                        End With

                        'Initiate a Upload
                        EvalBd.RAMInitUpload DUTNum

                        'Upload 32 bits at a time
                        For cntr = CntrStart To CntrStop Step CntrStep
                            EvalBd.RAMWritePacket DUTNum, RamSegment3Data(cntr - 1)
                            'Update the status window
                            If UpdatePrgBar = True Then
                                'Update the status window
                                frmRAMLoadStatus.pbrProgress.value = PrgCntr
                                PrgCntr = PrgCntr + 1
                                frmRAMLoadStatus.pbrProgress.Refresh
                            Else
                                'Show that were finished
                                frmRAMLoadStatus.pbrProgress.value = frmRAMLoadStatus.pbrProgress.Max
                                frmRAMLoadStatus.pbrProgress.Refresh
                            End If
                        Next cntr

                        'Terminate the upload
                        EvalBd.RAMTerminateUpload DUTNum
                    End If

                    '*****  This is a required to make the loaded profiles work *****
                    'We need to send at least 1 sclk to make the loaded profiles work
                    Select Case DUTNum
                        Case 1
                            dummystr = EvalBd.SerialRead(1, &H2)
                        Case 2
                            dummystr = EvalBd.SerialRead(2, &H2)
                        Case Else
                            dummystr = EvalBd.SerialRead(1, &H2)
                            dummystr = EvalBd.SerialRead(2, &H2)
                    End Select

                    'Load the data into the global RAMDataArrays
                    If UseRS0 Then
                        cntr1 = 0
                         For cntr = StartAddressRS0 To FinalAddressRS0
                             Select Case DUTNum
                                 Case 1:
                                     DUT1_RAM(cntr) = RamSegment0Data(cntr1)
                                 Case 2:
                                     DUT2_RAM(cntr) = RamSegment0Data(cntr1)
                                 Case Else:
                                     DUT1_RAM(cntr) = RamSegment0Data(cntr1)
                                     DUT2_RAM(cntr) = RamSegment0Data(cntr1)
                             End Select
                             'Incriment the array indexer
                             cntr1 = cntr1 + 1
                         Next cntr
                    End If

                    'Load the data into the global RAMDataArrays
                    If UseRS1 Then
                        cntr1 = 0
                         For cntr = StartAddressRS1 To FinalAddressRS1
                             Select Case DUTNum
                                 Case 1:
                                     DUT1_RAM(cntr) = RamSegment1Data(cntr1)
                                 Case 2:
                                     DUT2_RAM(cntr) = RamSegment1Data(cntr1)
                                 Case Else:
                                     DUT1_RAM(cntr) = RamSegment1Data(cntr1)

⌨️ 快捷键说明

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