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

📄 clsevalboard.cls

📁 AD9954源码
💻 CLS
📖 第 1 页 / 共 2 页
字号:
VERSION 1.0 CLASS
BEGIN
  MultiUse = -1  'True
  Persistable = 0  'NotPersistable
  DataBindingBehavior = 0  'vbNone
  DataSourceBehavior  = 0  'vbNone
  MTSTransactionMode  = 0  'NotAnMTSObject
END
Attribute VB_Name = "cls9858EVBD"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = True
Attribute VB_PredeclaredId = False
Attribute VB_Exposed = False
Attribute VB_Ext_KEY = "SavedWithClassBuilder6" ,"Yes"
Attribute VB_Ext_KEY = "Top_Level" ,"Yes"
Public Enum adiBinValues
    abvLow = 0
    abvHigh = 1
End Enum
 
Public Enum evbdComMode
    Parallel = 0
    Serial = 1
End Enum

Public Enum evbdSerMode
    TwoWire = 0
    ThreeWire = 1
End Enum

'local variable(s) to hold property value(s)
Private mvarReset As adiBinValues 'local copy
Private mvarFQUD As adiBinValues 'local copy
Private mvarCheck As adiBinValues 'local copy
Private mvarWCLK As adiBinValues 'local copy
Private mvarStrobe As adiBinValues 'local copy
Private mvarCLKValue As Double 'local copy
Private mvarPowerDownDUT As Boolean 'local copy
Private mvarEnabled As Boolean 'local copy
Private mvarD0 As adiBinValues 'local copy
Private mvarD1 As adiBinValues 'local copy
Private mvarD2 As adiBinValues 'local copy
Private mvarD3 As adiBinValues 'local copy
Private mvarD4 As adiBinValues 'local copy
Private mvarD5 As adiBinValues 'local copy
Private mvarD6 As adiBinValues 'local copy
Private mvarD7_SDAT As adiBinValues 'local copy
Private mvarComMode As evbdComMode 'local copy
Private mvarSerailMode As Boolean 'local copy
Private mvarWRB_SCLK As adiBinValues 'local copy
Private mvarPS0 As adiBinValues 'local copy
Private mvarPS1 As adiBinValues 'local copy
Private mvarRDB As adiBinValues 'local copy

'To fire this event, use RaiseEvent with the following syntax:
'RaiseEvent ResetOccured[(arg1, arg2, ... , argn)]
Public Event ResetOccured()

'Delcare the LPTIO class
Private PPIO As clsLPTIO
Private sOutputBuffer As String
'local variable(s) to hold property value(s)
Private mvarAutoFQUD As Boolean 'local copy
'To fire this event, use RaiseEvent with the following syntax:
'RaiseEvent OutputBufferChanged[(arg1, arg2, ... , argn)]
Public Event OutputBufferChanged(ByVal Data As String)


Public Property Let RDB(ByVal vData As adiBinValues)
'used when assigning an Object to the property, on the left side of a Set statement.
'Syntax: Set x.RDB = Form1
    If mvarEnabled Then
        mvarRDB = vData
    End If
End Property


Public Property Get RDB() As adiBinValues
'used when retrieving value of a property, on the right side of an assignment.
'Syntax: Debug.Print X.RDB
    RDB = mvarRDB
End Property
'Sets the profile
Public Sub SetProfile(ByVal Profile As Integer)
    If mvarEnabled Then
        mvarRDB = vData
    End If
End Sub

Public Property Let PS1(ByVal vData As adiBinValues)
'used when assigning an Object to the property, on the left side of a Set statement.
'Syntax: Set x.PS1 = Form1
    If mvarEnabled Then
        mvarPS1 = vData
    End If
End Property


Public Property Get PS1() As adiBinValues
'used when retrieving value of a property, on the right side of an assignment.
'Syntax: Debug.Print X.PS1
    PS1 = mvarPS1
End Property

Public Property Let PS0(ByVal vData As adiBinValues)
'used when assigning an Object to the property, on the left side of a Set statement.
'Syntax: Set x.PS0 = Form1
    If mvarEnabled Then
        mvarPS0 = vData
    End If
End Property


Public Property Get PS0() As adiBinValues
'used when retrieving value of a property, on the right side of an assignment.
'Syntax: Debug.Print X.PS0
    PS0 = mvarPS0
End Property


Public Property Let WRB_SCLK(ByVal vData As adiBinValues)
Attribute WRB_SCLK.VB_Description = "Write Bar and SCLK signal lines on the Eval Board."
'used when assigning an Object to the property, on the left side of a Set statement.
'Syntax: Set x.WRB_SCLK = Form1
    If mvarEnabled Then
        mvarWRB_SCLK = vData
    End If
End Property


Public Property Get WRB_SCLK() As adiBinValues
'used when retrieving value of a property, on the right side of an assignment.
'Syntax: Debug.Print X.WRB_SCLK
    WRB_SCLK = mvarWRB_SCLK
End Property

Public Property Let AutoFQUD(ByVal vData As Boolean)
'used when assigning a value to the property, on the left side of an assignment.
'Syntax: X.AutoFQUD = 5
    If mvarEnabled Then
        mvarAutoFQUD = vData
    End If
End Property

Public Property Get AutoFQUD() As Boolean
'used when retrieving value of a property, on the right side of an assignment.
'Syntax: Debug.Print X.AutoFQUD
    AutoFQUD = mvarAutoFQUD
End Property

'Sends data to the AD9858 through its serial interface
Public Sub SerialLoad(ByVal Data As String)
    Dim cntr As Integer
    Dim DataLen As Integer
    
    'Send 40 bits
    For cntr = 40 To 1 Step -1
        'Set the data on the serial data pin
        D7_SDAT = CLng(Mid(Data, cntr, 1))
        
        'Clock the bit into the AD9850
        WCLK = abvLow
        WCLK = abvHigh
    Next cntr
    
    'Record the new buffer value
    sOutputBuffer = Data
    'Fire the OutputBufferChanged Event
    RaiseEvent OutputBufferChanged(sOutputBuffer)
    
    'If auto frequency update is enabled then go ahead and do it.
    If mvarAutoFQUD Then
        'Do a frequency update to load the data
        FQUD = abvLow
        FQUD = abvHigh
    End If

End Sub
'AD9858 Register Word Definitions
'     Word 0     Word 1     Word 2     Word 3     Word 4
'MSB 00000000   00000000   00000000   00000000   00000000 LSB
'Sends data to the AD9850 through its parallel interface
Private Sub ParallelLoad(ByVal Data As String)
    Dim sW(0 To 4) As String
    Dim bitcnt As Integer
    Dim wcnt As Integer
    Dim BitVal As Integer
    Dim NumOfWords As Integer
    Dim BitCnt2 As Integer
    
    'Get the length of the data to be sent
    NumOfWords = Len(Data)
    NumOfWords = NumOfWords / 8
    
    'Properly build the output buffer
    Select Case NumOfWords
        Case 1:
            sOutputBuffer = Data & Right(sOutputBuffer, 32)
        Case 2:
            sOutputBuffer = Data & Right(sOutputBuffer, 24)
        Case 3:
            sOutputBuffer = Data & Right(sOutputBuffer, 16)
        Case 4:
            sOutputBuffer = Data & Right(sOutputBuffer, 8)
        Case 5:
            sOutputBuffer = Data
    End Select
    
    'Fire the OutputBufferChanged Event
    RaiseEvent OutputBufferChanged(sOutputBuffer)
    
    'Make sure that the address counter is reset
    FQUD = abvLow
    FQUD = abvHigh
    
    'Parallel load all bytes in the order of W0, W1, W2, W3, W4
    For wcnt = NumOfWords To 1 Step -1
        'Get 8 bits to send
        sW(wcnt - 1) = Left(Data, 8)
        'Trim off the bits that are about to be sent
        Data = Right(Data, Len(Data) - 8)
        
        'Convert the binary string to a integer value
        For bitcnt = 1 To 8
            'Get the bit value for the current bit
            BitVal = CInt(Mid(sW(wcnt - 1), 8 - (bitcnt - 1), 1))
            'Set up the word to be sent
            PPIO.SetBitVal ppDataRegister, bitcnt - 1, BitVal
            'Set the properties value so that it will be correct
            Select Case bitcnt - 1
                Case 0:
                    mvarD0 = BitVal
                Case 1:
                    mvarD1 = BitVal
                Case 2:
                    mvarD2 = BitVal
                Case 3:
                    mvarD3 = BitVal
                Case 4:
                    mvarD4 = BitVal
                Case 5:
                    mvarD5 = BitVal
                Case 6:
                    mvarD6 = BitVal
                Case 7:
                    mvarD7 = BitVal
            End Select
        Next bitcnt
        
        'Send the word
        PPIO.WritePort ppDataRegister
        
        'Latch the data through the buffer
        LatchData
        
        'Write the data to the AD9850
        WCLK = abvLow
        WCLK = abvHigh
        
        'Record the new buffer value
'        sOutputBuffer = Data
    Next wcnt
    
    'If auto frequency update is enabled then go ahead and do it.
    If mvarAutoFQUD Then
        'Do a frequency update to load the data
        FQUD = abvLow
        FQUD = abvHigh
    End If
End Sub

Public Property Let ComMode(ByVal vData As evbdComMode)
'used when assigning a value to the property, on the left side of an assignment.
'Syntax: X.ComMode = 5
    Dim OutData As String
    If mvarEnabled = True Then
        'If the user is changing the mode, set the appropriate mode
        If vData = Parallel And mvarComMode = Serial Then
            'Put the part into parallel mode
            'Toggle the S/P to a 1
        ElseIf vData = Serial And mvarComMode = Parallel Then
            'Set the spmode pin
        End If
        mvarComMode = vData
    End If
End Property


Public Property Get ComMode() As evbdComMode
'used when retrieving value of a property, on the right side of an assignment.
'Syntax: Debug.Print X.ComMode
    ComMode = mvarComMode
End Property

'Latch the data
Public Sub LatchData()
    'Strobe the Strobe Line
    Strobe = abvLow
    Strobe = abvHigh
End Sub

Public Property Let Enabled(ByVal vData As Boolean)
Attribute Enabled.VB_Description = "Enables or disables the class from performing I/O."
'used when assigning a value to the property, on the left side of an assignment.
'Syntax: X.Enabled = 5
    mvarEnabled = vData
End Property

Public Property Get Enabled() As Boolean
'used when retrieving value of a property, on the right side of an assignment.
'Syntax: Debug.Print X.Enabled
    Enabled = mvarEnabled
End Property

Public Property Let PowerDownDUT(ByVal vData As Boolean)
'used when assigning a value to the property, on the left side of an assignment.
'Syntax: X.PowerDownDUT = 5
    
    'Do the io opperation if enabled
    If mvarEnabled = True Then
        mvarPowerDownDUT = vData
    End If
End Property

Public Property Get PowerDownDUT() As Boolean
'used when retrieving value of a property, on the right side of an assignment.
'Syntax: Debug.Print X.PowerDownDUT
    PowerDownDUT = mvarPowerDownDUT
End Property

Public Sub SetPhaseDelay(ByVal PhaseDly As Double)
    'Do the io opperation if enabled
    If mvarEnabled = True Then
    
    End If
End Sub

Public Property Let CLKValue(ByVal vData As Double)
'used when assigning a value to the property, on the left side of an assignment.
'Syntax: X.CLKValue = 5
    
    mvarCLKValue = vData
    
End Property

Public Property Get CLKValue() As Double
'used when retrieving value of a property, on the right side of an assignment.
'Syntax: Debug.Print X.CLKValue
    CLKValue = mvarCLKValue
End Property

Public Sub SetDUTOutputFreq(ByVal OutputFreq As Double)
    'Do the io opperation if enabled
    If mvarEnabled = True Then
    
    End If
End Sub

Public Sub ResetDUT()
    Dim Start As Single
    
    'Do the io opperation if enabled
    If mvarEnabled = True Then
        'Reset the DUT
        Reset = abvHigh
                
        'Do a short delay until the
        Start = Timer()
        
        'Show the Hourglass mouse pointer
        Screen.MousePointer = 11
        Do While Timer < Start + 0.05
        Loop
        
        'Show the Defualt mouse pointer
        Screen.MousePointer = 0
        
        Reset = abvLow
    End If
End Sub

Public Property Let D7_SDAT(ByVal vData As adiBinValues)
'used when assigning a value to the property, on the left side of an assignment.
'Syntax: X.D7_SDAT = 5
    'Do the io opperation if enabled
    If mvarEnabled = True Then
    
        mvarD7_SDAT = vData
        
        'Set the appropriate bit in the Parallel Port Driver
        PPIO.SetBitVal ppDataRegister, ppBit7, mvarD7_SDAT
        
        'Write the new value to the parallel port
        PPIO.WritePort ppDataRegister
    
        'Latch the data through the buffer
        LatchData
    End If
End Property

Public Property Get D7_SDAT() As adiBinValues
'used when retrieving value of a property, on the right side of an assignment.
'Syntax: Debug.Print X.D7_SDAT
    D7_SDAT = mvarD7_SDAT
End Property

Public Property Let D6(ByVal vData As adiBinValues)
'used when assigning a value to the property, on the left side of an assignment.
'Syntax: X.D6 = 5
    'Do the io opperation if enabled
    If mvarEnabled = True Then
    
        mvarD6 = vData
        
        'Set the appropriate bit in the Parallel Port Driver

⌨️ 快捷键说明

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