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

📄 cls9858evbd1.cls

📁 AD9954源码
💻 CLS
📖 第 1 页 / 共 3 页
字号:
'        Clock_A = abvLow
    End If
End Property


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



Public Property Let A2_IOReset(ByVal vData As adiBinValues)
'used when assigning an Object to the property, on the left side of a Set statement.
'Syntax: Set x.A2_IOReset = Form1
    If mvarEnabled Then
        'mvarA2_IOReset = vData
        
        'Set the bit value
        SetBitVal evbAddressBuffer, bnA2_IOReset, vData
        'Write the value to the buffer
        WriteEvbBuffVal evbAddressBuffer
        
        'Latch the data through the buffer
'        Clock_A = abvHigh
'        Clock_A = abvLow
    End If
End Property


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



Public Property Let A1(ByVal vData As adiBinValues)
'used when assigning an Object to the property, on the left side of a Set statement.
'Syntax: Set x.A1 = Form1
    If mvarEnabled Then
        'mvarA1 = vData
        
        'Set the bit value
        SetBitVal evbAddressBuffer, bnA1, vData
        'Write the value to the buffer
        WriteEvbBuffVal evbAddressBuffer
        
        'Latch the data through the buffer
'        Clock_A = abvHigh
'        Clock_A = abvLow
    End If
End Property


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



Public Property Let A0_SDIO(ByVal vData As adiBinValues)
'used when assigning an Object to the property, on the left side of a Set statement.
'Syntax: Set x.A0_SDIO = Form1
    If mvarEnabled Then
        'mvarA0_SDIO = vData
        
        'Set the bit value
        SetBitVal evbAddressBuffer, bnA0_SDIO, vData
        'Write the value to the buffer
        WriteEvbBuffVal evbAddressBuffer
        
        'Latch the data through the buffer
'        Clock_A = abvHigh
'        Clock_A = abvLow
    End If
End Property


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



Public Property Let D7(ByVal vData As adiBinValues)
'used when assigning an Object to the property, on the left side of a Set statement.
'Syntax: Set x.D7 = Form1
    If mvarEnabled Then
        'mvarD7 = vData
        
        'Set the bit value
        SetBitVal evbDataBuffer, bnD7, vData
        'Write the value to the buffer
        WriteEvbBuffVal evbDataBuffer
        
        'Latch the data through the buffer
'        Clock_D = abvHigh
'        Clock_D = abvLow
    End If
End Property


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



Public Property Let D6(ByVal vData As adiBinValues)
'used when assigning an Object to the property, on the left side of a Set statement.
'Syntax: Set x.D6 = Form1
    If mvarEnabled Then
        'mvarD6 = vData
        
        'Set the bit value
        SetBitVal evbDataBuffer, bnD6, vData
        'Write the value to the buffer
        WriteEvbBuffVal evbDataBuffer
        
        'Latch the data through the buffer
'        Clock_D = abvHigh
'        Clock_D = abvLow
    End If
End Property


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



Public Property Let D5(ByVal vData As adiBinValues)
'used when assigning an Object to the property, on the left side of a Set statement.
'Syntax: Set x.D5 = Form1
    If mvarEnabled Then
        'mvarD5 = vData
        
        'Set the bit value
        SetBitVal evbDataBuffer, bnD5, vData
        'Write the value to the buffer
        WriteEvbBuffVal evbDataBuffer
        
        'Latch the data through the buffer
'        Clock_D = abvHigh
'        Clock_D = abvLow
    End If
End Property


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



Public Property Let D4(ByVal vData As adiBinValues)
'used when assigning an Object to the property, on the left side of a Set statement.
'Syntax: Set x.D4 = Form1
    If mvarEnabled Then
        'mvarD4 = vData
        
        'Set the bit value
        SetBitVal evbDataBuffer, bnD4, vData
        'Write the value to the buffer
        WriteEvbBuffVal evbDataBuffer
        
        'Latch the data through the buffer
'        Clock_D = abvHigh
'        Clock_D = abvLow
    End If
End Property


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



Public Property Let D3(ByVal vData As adiBinValues)
'used when assigning an Object to the property, on the left side of a Set statement.
'Syntax: Set x.D3 = Form1
    If mvarEnabled Then
        'mvarD3 = vData
        
        'Set the bit value
        SetBitVal evbDataBuffer, bnD3, vData
        'Write the value to the buffer
        WriteEvbBuffVal evbDataBuffer
        
        'Latch the data through the buffer
'        Clock_D = abvHigh
'        Clock_D = abvLow
    End If
End Property


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



Public Property Let D2(ByVal vData As adiBinValues)
'used when assigning an Object to the property, on the left side of a Set statement.
'Syntax: Set x.D2 = Form1
    If mvarEnabled Then
        'mvarD2 = vData
        
        'Set the bit value
        SetBitVal evbDataBuffer, bnD2, vData
        'Write the value to the buffer
        WriteEvbBuffVal evbDataBuffer
        
        'Latch the data through the buffer
'        Clock_D = abvHigh
'        Clock_D = abvLow
    End If
End Property


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



Public Property Let D1(ByVal vData As adiBinValues)
'used when assigning an Object to the property, on the left side of a Set statement.
'Syntax: Set x.D1 = Form1
    If mvarEnabled Then
        'mvarD1 = vData
        
        'Set the bit value
        SetBitVal evbDataBuffer, bnD1, vData
        'Write the value to the buffer
        WriteEvbBuffVal evbDataBuffer
        
        'Latch the data through the buffer
'        Clock_D = abvHigh
'        Clock_D = abvLow
    End If
End Property


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

Public Property Let D0(ByVal vData As adiBinValues)
'used when assigning an Object to the property, on the left side of a Set statement.
'Syntax: Set x.D0 = Form1
    If mvarEnabled Then
        'mvarD0 = vData
        
        'Set the bit value
        SetBitVal evbDataBuffer, bnD0, vData
        'Write the value to the buffer
        WriteEvbBuffVal evbDataBuffer
        
        'Latch the data through the buffer
'        Clock_D = abvHigh
'        Clock_D = abvLow
    End If
End Property


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

Private Sub Class_Initialize()
    Dim cntr As Integer
        
    'Setup the lptio class
    Set PPIO = New clsLPTIO
    
    mvarEnabled = True
    mvarLSBFirst = False
    'Default value for AutoFUD mode is on.
    mvarAutoFUD = True
    
    'Initialize the bitvals array
    For cntr = 0 To 7
        evbBitVals(cntr) = 2 ^ cntr
    Next cntr
    
    'Initialize the serial mode register size lookup table,
    'sizes are in number of bytes
    sRegSize(smCFR) = 4
    sRegSize(smDFTW) = 4
    sRegSize(smDFRRW) = 2
    sRegSize(smFTW0) = 4
    sRegSize(smPOW0) = 2
    sRegSize(smFTW1) = 4
    sRegSize(smPOW1) = 2
    sRegSize(smFTW2) = 4
    sRegSize(smPOW2) = 2
    sRegSize(smFTW3) = 4
    sRegSize(smPOW3) = 2
    sRegSize(smDAC_CTRL) = 2
    sRegSize(smTR0) = 2
    sRegSize(smTR1) = 3
    sRegSize(smTR2) = 3
    
    'Setup the serial to parallel port register
    'address lookup table for the
    sPRegAddr(smCFR, 0) = &H0
    sPRegAddr(smCFR, 1) = &H1
    sPRegAddr(smCFR, 2) = &H2
    sPRegAddr(smCFR, 3) = &H3
    
    sPRegAddr(smDFTW, 0) = &H4
    sPRegAddr(smDFTW, 1) = &H5
    sPRegAddr(smDFTW, 2) = &H6
    sPRegAddr(smDFTW, 3) = &H7

    sPRegAddr(smDFRRW, 0) = &H8
    sPRegAddr(smDFRRW, 1) = &H9

    sPRegAddr(smFTW0, 0) = &HA
    sPRegAddr(smFTW0, 1) = &HB
    sPRegAddr(smFTW0, 2) = &HC
    sPRegAddr(smFTW0, 3) = &HD
    
    sPRegAddr(smPOW0, 0) = &HE
    sPRegAddr(smPOW0, 1) = &HF

    sPRegAddr(smFTW1, 0) = &H10
    sPRegAddr(smFTW1, 1) = &H11
    sPRegAddr(smFTW1, 2) = &H12
    sPRegAddr(smFTW1, 3) = &H13
    
    sPRegAddr(smPOW1, 0) = &H14
    sPRegAddr(smPOW1, 1) = &H15

    sPRegAddr(smFTW2, 0) = &H16
    sPRegAddr(smFTW2, 1) = &H17
    sPRegAddr(smFTW2, 2) = &H18
    sPRegAddr(smFTW2, 3) = &H19
    
    sPRegAddr(smPOW2, 0) = &H1A
    sPRegAddr(smPOW2, 1) = &H1B

    sPRegAddr(smFTW3, 0) = &H1C
    sPRegAddr(smFTW3, 1) = &H1D
    sPRegAddr(smFTW3, 2) = &H1E
    sPRegAddr(smFTW3, 3) = &H1F
    
    sPRegAddr(smPOW3, 0) = &H20
    sPRegAddr(smPOW3, 1) = &H21
    
    sPRegAddr(smDAC_CTRL, 0) = &H22
    sPRegAddr(smDAC_CTRL, 1) = &H23
    
    sPRegAddr(smTR0, 0) = &H24
    sPRegAddr(smTR0, 1) = &H25
    
    sPRegAddr(smTR1, 0) = &H26
    sPRegAddr(smTR1, 1) = &H27
    sPRegAddr(smTR1, 2) = &H28

    sPRegAddr(smTR2, 0) = &H29
    sPRegAddr(smTR2, 1) = &H2A
    sPRegAddr(smTR2, 2) = &H2B

End Sub

Private Sub Class_Terminate()
    'Release the lptio class
    Set PPIO = Nothing
End Sub
'Flips a string - used to flip the data in lsb mode
Public Function FlipString(ByVal MyStr As String) As String
    Dim cntr As Integer
    For cntr = Len(MyStr) To 1 Step -1
        FlipString = FlipString & Mid(MyStr, cntr, 1)
    Next cntr
End Function
'Sets the specified bit value to the specified buffer
Public Sub SetBitVal(ByVal Buff As evbBuffs, ByVal Bit As evbBits, ByVal value As adiBinValues)
    If value <> 0 Then
        'Set the bit
        evbBuffers(Buff) = evbBuffers(Buff) Or evbBitVals(Bit)
    Else
        'Clear the bit
        evbBuffers(Buff) = evbBuffers(Buff) And Not evbBitVals(Bit)
    End If
End Sub
'Returns the current bit value from the specified buffer
Public Function GetBitVal(ByVal Buff As evbBuffs, ByVal Bit As evbBits) As Integer
    'Test the bit
    If evbBuffers(Buff) And evbBitVals(Bit) Then
        'If a one the return 1
        GetBitVal = 1
    Else
        'If a zero then return 0
        GetBitVal = 0
    End If
End Function
'Returns the current value of the specified software buffer which should be the
'current hardware buffer value if SetBitVal,SetEvbBuffVal,and WriteEvbBuffVal
'are used exclusively
Public Function GetEvbBuffVal(ByVal Buff As evbBuffs) As Integer
    'Return the requested information
    GetEvbBuffVal = evbBuffers(Buff)
End Function

'Sets the software buffer value specifed by RegVal
'To write the value from the software buffer to the hardware buffer call
'WriteEvbBuffVal()
Public Sub SetEvbBuffVal(ByVal Buff As evbBuffs, ByVal BuffVal As Integer)
    
    'Set the register value
    evbBuffers(Buff) = BuffVal
    
End Sub

'Writes the value specified by buff to the software buffer and the hardware buffer
'specifed by evbBuffs.  If BuffVal is not passed then it writes the value currently
'in the software buffer.
'The write sequence is as follows
'1. Write the value to the dataport of the parallel port
'2. Latch the data into the proper hardware buffer on the eval board.
Public Sub WriteEvbBuffVal(ByVal Buff As evbBuffs, Optional BuffVal As Variant)
    
    If IsMissing(BuffVal) Then
        'Write it to the parallel port
        PPIO.WritePort ppDataRegister, evbBuffers(Buff)
    Else
        'Set the register value
        evbBuffers(Buff) = BuffVal
        
        'Write it to the parallel port
        PPIO.WritePort ppDataRegister, BuffVal
    End If
    
    Select Case Buff
        Case evbDataBuffer:
            Clock_D = abvHigh
            Clock_D = abvLow
        Case evbAddressBuffer:
            Clock_A = abvHigh
            Clock_A = abvLow
        Case evbControlBuffer:
            Clock_F = abvHigh
            Clock_F = abvLow
    End Select
End Sub

⌨️ 快捷键说明

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