📄 cls9859evbd.cls
字号:
If SerialIOModeDUT1 = TwoWire Then
'Set read back enable high
RB_Enable = abvHigh
Else
'Make sure its low or
RB_Enable = abvLow
End If
Case 2
If SerialIOModeDUT2 = TwoWire Then
'Set read back enable high
RB_Enable = abvHigh
Else
'Make sure its low or
RB_Enable = abvLow
End If
End Select
'Clock_F
'Loop through, reading the data back
For cntr = 0 To ((NumBytes * 8) - 1)
'Latch the data into the AD995X
SCLK = abvLow
WriteEvbBuffVal evb59Buff3
'Get a bit from the eval board
sRetStr = sRetStr & CStr(SDO)
'Set sclk high
SCLK = abvHigh
WriteEvbBuffVal evb59Buff3
Next cntr
'Now return the CSB line high
Select Case DUTNum
Case 1
CSB_DUT1 = abvHigh
'If in 2 Wire mode set RB_Enable Low again
If SerialIOModeDUT1 = TwoWire Then
'Set read back enable low
RB_Enable = abvLow
WriteEvbBuffVal evb59Buff3
End If
Case 2
CSB_DUT2 = abvHigh
'If in 2 Wire mode set RB_Enable Low again
If SerialIOModeDUT1 = TwoWire Then
'Set read back enable low
RB_Enable = abvLow
WriteEvbBuffVal evb59Buff3
End If
End Select
WriteEvbBuffVal evb59Buff3
'Take the sclk line low again
SCLK = abvLow
WriteEvbBuffVal evb59Buff3
If DUTNum = 2 Then
'Check to see if the part is currently in LSB First Mode
If LSBFirstDUT2 Then
'Rearrange the instruction byte into LSB First format
sRetStr = FlipString(sRetStr)
End If
Else
'Check to see if the part is currently in LSB First Mode
If LSBFirstDUT1 Then
'Rearrange the instruction byte into LSB First format
sRetStr = FlipString(sRetStr)
End If
End If
If Address >= &H7 And Address <= &HA Then
'Restore the current profile setting
SetActiveProfile DUTNum, OldProfile
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
Else
MsgBox "You can only read from one dut at a time.", vbApplicationModal & vbCritical, "SerialRead()"
End If
End If
End Function
'Resets Dut1, Dut2 or Both
'Input: DutNum - DUT to Reset 1,2 or Any Other Value - To reset both
Public Sub ResetDUT(ByVal DUTNum As Integer)
Select Case DUTNum
Case 1:
'Strobe the reset line
Reset_DUT1 = abvHigh
EvalBd.WriteEvbBuffVal evb59Buff2
Reset_DUT1 = abLow
EvalBd.WriteEvbBuffVal evb59Buff2
Case 2:
'Strobe the reset line
Reset_DUT2 = abvHigh
EvalBd.WriteEvbBuffVal evb59Buff2
Reset_DUT2 = abLow
EvalBd.WriteEvbBuffVal evb59Buff2
Case Else:
'Reset both duts
Reset_DUT1 = abvHigh
Reset_DUT2 = abvHigh
EvalBd.WriteEvbBuffVal evb59Buff2
Reset_DUT1 = abLow
Reset_DUT2 = abLow
EvalBd.WriteEvbBuffVal evb59Buff2
End Select
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, bnClock_F, 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, bnClock_A, mvarClock_A
'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_A
'Invert the data because this is a inverted control line
If mvarClock_D = abvLow Then
Clock_D = abvHigh
Else
Clock_D = abvLow
End If
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
'Invert the data because this is a inverted control line
If vData = abvLow Then
vData = abvHigh
Else
vData = abvLow
End If
'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, bnClock_D, mvarClock_D
'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_D
Clock_A = mvarClock_A
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 SCLK1(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 "SCLK1 is a readonly property.", vbCritical, "Critical Error!"
End Property
Public Property Get SCLK1() 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)
mvarSCLK1 = PPIO.GetBitVal(ppaStatusRegister, bnSCLK1)
'Return the current value
SCLK1 = mvarSCLK1
End Property
Public Property Let CSB_DUT1(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
mvarCSB_DUT1 = vData
'Set the bit value
SetBitVal evb59Buff3, bnCSB_DUT1, vData
' 'Write the value to the buffer
' WriteEvbBuffVal evb59Buff3
'Latch the data through the buffer
' Clock_F = abvHigh
' Clock_F = abvLow
End If
End Property
Public Property Get CSB_DUT1() As adiBinValues
'used when retrieving value of a property, on the right side of an assignment.
'Syntax: Debug.Print X.RDB
CSB_DUT1 = GetBitVal(evb59Buff3, bnCSB_DUT1)
End Property
Public Property Let 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 evb59Buff3, bnSCLK, vData
' 'Write the value to the buffer
' WriteEvbBuffVal evb59Buff3
'Latch the data through the buffer
' Clock_F = abvHigh
' Clock_F = abvLow
End If
End Property
Public Property Get SCLK() As adiBinValues
'used when retrieving value of a property, on the right side of an assignment.
'Syntax: Debug.Print X.WRB_SCLK
SCLK = GetBitVal(evb59Buff3, bnSCLK)
End Property
Public Property Let FUD_DUT1(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 evb59Buff1, bnFUD_DUT1, vData
' 'Write the value to the buffer
' WriteEvbBuffVal evb59Buff1
'Latch the data through the buffer
' Clock_F = abvHigh
' Clock_F = abvLow
End If
End Property
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -