📄 cls9858evbd1.cls
字号:
'Now return the CSB line high
RDB_CSB = abvHigh
'Always return SCLK to a High when done just incase the user
'switches to Parallel Mode
WRB_SCLK = abvHigh
'Check to see if the AD9858 is in LSB First mode
If LSBFirst = True Then
'Rearrange the data read back into MSB First format
sRetStr = FlipString(sRetStr)
End If
'Return the data string received
SerialRead = sRetStr
Else
'The data isn't valid or the address isn't valid
If Address < 0 Or Address > &HD Then
MsgBox "Error: Invalid address = " & Address & ".", vbApplicationModal, "Error: Sub SerialLoad"
End If
If NumBytes = (Len(Data) / 8) Then
MsgBox "Error: Invalid data = " & Data & ".", vbApplicationModal, "Error: Sub SerialLoad"
End If
End If
End If
End Function
Public Sub ParallelLoadByte(ByVal addr As Integer, ByVal Data As Integer)
Dim InstructByte As Integer
Dim sData As String
'Only work if the object is enabled
If mvarEnabled = True Then
'Make sure that RBE is set low
RB_Enable = abvLow
'Setup the instruction byte
InstructByte = addr 'And 63 - Don't need this unless in serial mode
'Put the data in the register and send it to the parallel port
WriteEvbBuffVal evbAddressBuffer, InstructByte
'Send the data to the eval board
WriteEvbBuffVal evbDataBuffer, Data
'Latch the data into the AD9858
WRB_SCLK = abvLow
WRB_SCLK = abvHigh
'Convert the data to a binary string
sData = cbaseDec2Bin(Data, 8)
'Now Check to see if they put the part into LSB First or 2 or 3 Wire Mode
If addr = 0 Then
If Right(sData, 1) = "1" Then
'They sent the LSBFirst Bit
mvarLSBFirst = True
Else
'They Sent MSB First Mode
mvarLSBFirst = False
End If
If Left(Right(sData, 2), 1) = "1" Then
'They sent the SDIO Input Only Bit so they want 3 Wire Mode
mvarSerialIOMode = ThreeWire
'Make sure RB_Enable is a low
RB_Enable = abvLow
Else
'They want 2 wire mode
mvarSerialIOMode = TwoWire
End If
End If
End If
End Sub
Public Sub ResetDUT()
'Strobe the reset line
Reset = abvHigh
Reset = abvLow
End Sub
Public Property Let Enabled(ByVal vData As Boolean)
'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 Clock_F(ByVal vData As adiBinValues)
'used when assigning an Object to the property, on the left side of a Set statement.
'Syntax: Set x.Clock_F = Form1
If mvarEnabled Then
'Store the value latched into the Data buffer
If mvarClock_F = abvLow And vData = abvLow Then
'Just store the value that is currently on the
'data port because that is what will be latched in
CtrlBuff = PPIO.GetRegVal(ppaDataRegister)
End If
mvarClock_F = vData
'Set the bit value for the Clock_A bit
PPIO.SetBitVal ppControlRegister, bnClockF, mvarClock_F
'Write the new data to the Parallel port
PPIO.WritePort ppControlRegister
End If
End Property
Public Property Get Clock_F() As adiBinValues
'used when retrieving value of a property, on the right side of an assignment.
'Syntax: Debug.Print X.Clock_F
Clock_F = mvarClock_F
End Property
Public Property Let RB_Enable(ByVal vData As adiBinValues)
'used when assigning an Object to the property, on the left side of a Set statement.
'Syntax: Set x.RB_Enable = Form1
If mvarEnabled Then
mvarRB_Enable = vData
'Set the bit value for the Clock_A bit
PPIO.SetBitVal ppControlRegister, bnRB_Enable, mvarRB_Enable
'Write the new data to the Parallel port
PPIO.WritePort ppControlRegister
End If
End Property
Public Property Get RB_Enable() As adiBinValues
'used when retrieving value of a property, on the right side of an assignment.
'Syntax: Debug.Print X.RB_Enable
RB_Enable = mvarRB_Enable
End Property
Public Property Let Clock_A(ByVal vData As adiBinValues)
'used when assigning an Object to the property, on the left side of a Set statement.
'Syntax: Set x.Clock_A = Form1
If mvarEnabled Then
'Store the value latched into the Data buffer
If mvarClock_A = abvLow And vData = abvLow Then
'Just store the value that is currently on the
'data port because that is what will be latched in
AddrBuff = PPIO.GetRegVal(ppaDataRegister)
End If
mvarClock_A = vData
'Set the bit value for the Clock_A bit
PPIO.SetBitVal ppControlRegister, bnClockA, mvarClock_A
'Write the new data to the Parallel port
PPIO.WritePort ppControlRegister
End If
End Property
Public Property Get Clock_A() As adiBinValues
'used when retrieving value of a property, on the right side of an assignment.
'Syntax: Debug.Print X.Clock_A
Clock_A = mvarClock_A
End Property
Public Property Let Clock_D(ByVal vData As adiBinValues)
'used when assigning an Object to the property, on the left side of a Set statement.
'Syntax: Set x.Clock_D = Form1
If mvarEnabled Then
'Store the value latched into the Data buffer
If mvarClock_D = abvLow And vData = abvLow Then
'Just store the value that is currently on the
'data port because that is what will be latched in
DataBuff = PPIO.GetRegVal(ppaDataRegister)
End If
mvarClock_D = vData
'Set the bit value for the Clock_D bit
PPIO.SetBitVal ppControlRegister, bnClockD, mvarClock_D
'Write the new data to the Parallel port
PPIO.WritePort ppControlRegister
End If
End Property
Public Property Get Clock_D() As adiBinValues
'used when retrieving value of a property, on the right side of an assignment.
'Syntax: Debug.Print X.Clock_D
Clock_D = mvarClock_D
End Property
Public Property Let SDO(ByVal vData As adiBinValues)
'used when assigning an Object to the property, on the left side of a Set statement.
'Syntax: Set x.SDO = Form1
'mvarSDO = vData
MsgBox "SDO is a readonly property.", vbCritical, "Critical Error!"
End Property
Public Property Get SDO() As adiBinValues
'used when retrieving value of a property, on the right side of an assignment.
'Syntax: Debug.Print X.SDO
'Read the register value
Call PPIO.ReadPort(ppStatusRegister)
mvarSDO = PPIO.GetBitVal(ppaStatusRegister, bnSDO)
'Return the current value
SDO = mvarSDO
End Property
Public Property Let RDB_CSB(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_CSB = vData
'Set the bit value
SetBitVal evbControlBuffer, bnRDB_CSB, vData
'Write the value to the buffer
WriteEvbBuffVal evbControlBuffer
'Latch the data through the buffer
' Clock_F = abvHigh
' Clock_F = abvLow
End If
End Property
Public Property Get RDB_CSB() As adiBinValues
'used when retrieving value of a property, on the right side of an assignment.
'Syntax: Debug.Print X.RDB
RDB_CSB = GetBitVal(evbControlBuffer, bnRDB_CSB)
End Property
Public Property Let WRB_SCLK(ByVal vData As adiBinValues)
'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
'Set the bit value
SetBitVal evbControlBuffer, bnWRB_SCLK, vData
'Write the value to the buffer
WriteEvbBuffVal evbControlBuffer
'Latch the data through the buffer
' Clock_F = abvHigh
' Clock_F = abvLow
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 = GetBitVal(evbControlBuffer, bnWRB_SCLK)
End Property
Public Property Let FUD(ByVal vData As adiBinValues)
'used when assigning an Object to the property, on the left side of a Set statement.
'Syntax: Set x.FUD = Form1
If mvarEnabled Then
'mvarFUD = vData
'Set the bit value
SetBitVal evbControlBuffer, bnFUD, vData
'Write the value to the buffer
WriteEvbBuffVal evbControlBuffer
'Latch the data through the buffer
' Clock_F = abvHigh
' Clock_F = abvLow
End If
End Property
Public Property Get FUD() As adiBinValues
'used when retrieving value of a property, on the right side of an assignment.
'Syntax: Debug.Print X.FUD
FUD = GetBitVal(evbControlBuffer, bnFUD)
End Property
Public Property Let Reset(ByVal vData As adiBinValues)
'used when assigning an Object to the property, on the left side of a Set statement.
'Syntax: Set x.Reset = Form1
If mvarEnabled Then
'Set the bit value
SetBitVal evbControlBuffer, bnReset, vData
'Write the value to the buffer
WriteEvbBuffVal evbControlBuffer
'If the reset line is going from 0 to a 1
If mvarReset = abvHigh And vData = abvLow Then
RaiseEvent ResetOccured
End If
mvarReset = vData
'Latch the data through the buffer
' Clock_F = abvHigh
' Clock_F = abvLow
End If
End Property
Public Property Get Reset() As adiBinValues
'used when retrieving value of a property, on the right side of an assignment.
'Syntax: Debug.Print X.Reset
Reset = GetBitVal(evbControlBuffer, bnReset)
End Property
Public Property Let SPMode(ByVal vData As adiBinValues)
'used when assigning an Object to the property, on the left side of a Set statement.
'Syntax: Set x.SPMode = Form1
If mvarEnabled Then
mvarSPMode = vData
'Set the bit value
SetBitVal evbControlBuffer, bnSPMode, vData
'Write the value to the buffer
WriteEvbBuffVal evbControlBuffer
'Latch the data through the buffer
' Clock_F = abvHigh
' Clock_F = abvLow
End If
End Property
Public Property Get SPMode() As adiBinValues
'used when retrieving value of a property, on the right side of an assignment.
'Syntax: Debug.Print X.SPMode
SPMode = GetBitVal(evbControlBuffer, bnSPMode)
End Property
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
'Set the bit value
SetBitVal evbControlBuffer, bnPS1, vData
'Write the value to the buffer
WriteEvbBuffVal evbControlBuffer
'Latch the data through the buffer
' Clock_F = abvHigh
' Clock_F = abvLow
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 = GetBitVal(evbControlBuffer, bnPS1)
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
'Set the bit value
SetBitVal evbControlBuffer, bnPS0, vData
'Write the value to the buffer
WriteEvbBuffVal evbControlBuffer
'Latch the data through the buffer
' Clock_F = abvHigh
' Clock_F = abvLow
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 = GetBitVal(evbControlBuffer, bnPS0)
End Property
Public Property Let A5(ByVal vData As adiBinValues)
'used when assigning an Object to the property, on the left side of a Set statement.
'Syntax: Set x.A5 = Form1
If mvarEnabled Then
'mvarA5 = vData
'Set the bit value
SetBitVal evbAddressBuffer, bnA5, 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 A5() As adiBinValues
'used when retrieving value of a property, on the right side of an assignment.
'Syntax: Debug.Print X.A5
A5 = GetBitVal(evbAddressBuffer, bnA5)
End Property
Public Property Let A4(ByVal vData As adiBinValues)
'used when assigning an Object to the property, on the left side of a Set statement.
'Syntax: Set x.A4 = Form1
If mvarEnabled Then
'mvarA4 = vData
'Set the bit value
SetBitVal evbAddressBuffer, bnA4, 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 A4() As adiBinValues
'used when retrieving value of a property, on the right side of an assignment.
'Syntax: Debug.Print X.A4
A4 = GetBitVal(evbAddressBuffer, bnA4)
End Property
Public Property Let A3(ByVal vData As adiBinValues)
'used when assigning an Object to the property, on the left side of a Set statement.
'Syntax: Set x.A3 = Form1
If mvarEnabled Then
'mvarA3 = vData
'Set the bit value
SetBitVal evbAddressBuffer, bnA3, vData
'Write the value to the buffer
WriteEvbBuffVal evbAddressBuffer
'Latch the data through the buffer
' Clock_A = abvHigh
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -