📄 cls9859evbd.cls
字号:
VERSION 1.0 CLASS
BEGIN
MultiUse = -1 'True
Persistable = 0 'NotPersistable
DataBindingBehavior = 0 'vbNone
DataSourceBehavior = 0 'vbNone
MTSTransactionMode = 0 'NotAnMTSObject
END
Attribute VB_Name = "cls9859EVBD"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = True
Attribute VB_PredeclaredId = False
Attribute VB_Exposed = False
Attribute VB_Description = "AD9858 Evaluation Board Class - Models the AD9858 Evaluation board."
Attribute VB_Ext_KEY = "SavedWithClassBuilder6" ,"Yes"
Attribute VB_Ext_KEY = "Top_Level" ,"Yes"
'*******************************************************
'* Enums *
'*******************************************************
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
Public Enum evb59Buffs
evb59Buff1 = 0 'U5
evb59Buff2 = 1 'U7
evb59Buff3 = 2 'U8
End Enum
Public Enum evbBits
evbBit0 = 0
evbBit1 = 1
evbBit2 = 2
evbBit3 = 3
evbBit4 = 4
evbBit5 = 5
evbBit6 = 6
evbBit7 = 7
End Enum
'Buffer to store new and current register map values
'Syntax: Buffer(Dutnum: 0 or 1, RegAddr: 0 - 12) = Value
Private sRegMapValsNew(0 To 1, 0 To 12) As String
Private sRegMapVals(0 To 1, 0 To 12) As String
'*******************************************************
'* Constants *
'*******************************************************
'Bit Number Constants for the signals on the
'parallel port's data port
'Buff1's Bit Designations
Const bnPS0_DUT1 = 0
Const bnPS1_DUT1 = 1
Const bnPS0_DUT2 = 2
Const bnPS1_DUT2 = 3
Const bnOSK_DUT1 = 4
Const bnOSK_DUT2 = 5
Const bnFUD_DUT1 = 6
Const bnFUD_DUT2 = 7
'Buff2's Bit Designations
Const bnIOSync_DUT1 = 0
Const bnIOSync_DUT2 = 1
Const bnPwrDwnCtl_DUT1 = 2
Const bnPwrDwnCtl_DUT2 = 3
Const bnClkMdSel_DUT1 = 4
Const bnClkMdSel_DUT2 = 5
Const bnReset_DUT1 = 6
Const bnReset_DUT2 = 7
'Buff3's Bit Designations
Const bnSDIO = 0
Const bnSCLK = 1
Const bnCSB_DUT1 = 2
Const bnCSB_DUT2 = 3
Const bnREF_CLK = 4
'Bit Number Constants for the signals on the
'parallel port's status port
Const bnSDO = 3
Const bnSCLK1 = 6
'Bit Number Constants for the signals on the
'parallel port's Control port
Const bnClock_D = 0
Const bnClock_A = 1
Const bnRB_Enable = 2
Const bnClock_F = 3
'Define the serial mode register names which index the
'lookup table above
Const smCFR1 = &H0
Const smCFR2 = &H1
Const smASF = &H2
Const smARR = &H3
Const smFTW0 = &H4
Const smPOW0 = &H5
Const smFTW1 = &H6
Const smRSCW0 = &H7
Const smRSCW1 = &H8
Const smRSCW2 = &H9
Const smRSCW3 = &HA
Const smRAM = &HB
Const smTR = &HC
'*******************************************************
'local variable(s) to hold property value(s) *
'*******************************************************
Private mvarPS0_DUT1 As adiBinValues 'local copy
Private mvarPS1_DUT1 As adiBinValues 'local copy
Private mvarPS0_DUT2 As adiBinValues 'local copy
Private mvarPS1_DUT2 As adiBinValues 'local copy
Private mvarOSK_DUT1 As adiBinValues 'local copy
Private mvarOSK_DUT2 As adiBinValues 'local copy
Private mvarFUD_DUT1 As adiBinValues 'local copy
Private mvarFUD_DUT2 As adiBinValues 'local copy
Private mvarIOSync_DUT1 As adiBinValues 'local copy
Private mvarIOSync_DUT2 As adiBinValues 'local copy
Private mvarPwrDwnCtl_DUT1 As adiBinValues 'local copy
Private mvarPwrDwnCtl_DUT2 As adiBinValues 'local copy
Private mvarClkMdSel_DUT1 As adiBinValues 'local copy
Private mvarClkMdSel_DUT2 As adiBinValues 'local copy
Private mvarReset_DUT1 As adiBinValues 'local copy
Private mvarReset_DUT2 As adiBinValues 'local copy
Private mvarCSB_DUT1 As adiBinValues 'local copy
Private mvarCSB_DUT2 As adiBinValues 'local copy
Private mvarFUD As adiBinValues 'local copy
Private mvarWRB_SCLK As adiBinValues 'local copy
Private mvarRDB_CSB As adiBinValues 'local copy
Private mvarREF_CLK As adiBinValues 'local copy
Private mvarClock_D As adiBinValues 'local copy
Private mvarClock_A As adiBinValues 'local copy
Private mvarRB_Enable As adiBinValues 'local copy
Private mvarClock_F As adiBinValues 'local copy
Private mvarEnabled As Boolean 'local copy
Private mvarLSBFirstDUT1 As Boolean 'local copy
Private mvarLSBFirstDUT2 As Boolean 'local copy
Private mvarSDO As adiBinValues
Private mvarSCLK1 As adiBinValues
'Delcare the LPTIO class
Public PPIO As clsLPTIO
'These variables store the values last latched into the latches
'U5,U7,U8 on the Evaluation Board
Private evbBuffers(0 To 2) As Integer
Private evbBitVals(0 To 7) As Integer
'Allocate memory for a lookup table for the serial mode
'register sizes
Private sRegSize(0 To 12) As Integer
'Private sPRegAddr(0 To 14, 0 To 3) As Integer
'local variable(s) to hold property value(s)
Private mvarSerialIOModeDUT1 As evbdSerMode 'local copy
Private mvarSerialIOModeDUT2 As evbdSerMode 'local copy
'To fire this event, use RaiseEvent with the following syntax:
'RaiseEvent ResetOccured[(arg1, arg2, ... , argn)]
Public Event ResetOccured(DUTNum As Integer, WasPwdwn As Boolean)
Public Event PoweringDown(DUTNum As Integer)
Public Event PoweringUp(DUTNum As Integer)
'RaiseEvent RegMapChanged[(DUTNum=1-2),(RegMap=0-1),(RegAddr=0-12)]
'RegMap = 0 = New Reg Map Values
'RegMap = 1 = Loaded Reg Map Values
Public Event RegMapChanged(DUTNum As Integer, RegMap As Integer, RegAddr As Integer)
'local variable(s) to hold property value(s)
Private mvarAutoFUD_DUT1 As Boolean 'local copy
Private mvarAutoFUD_DUT2 As Boolean 'local copy
Private OldResetDUT1Val As adiBinValues
Private OldResetDUT2Val As adiBinValues
'Local variable(s) to hold property values
Private mvar_DUTsDetected As Integer
'Ramsegment control word structure
Private Type RSCWInfo
BeginAddr As Integer
FinalAddr As Integer
NoDwell As Long
AddressRampRate As Long
ModeControl As Integer
End Type
Public Property Let AutoFUD_DUT1(ByVal vData As Boolean)
Attribute AutoFUD_DUT1.VB_Description = "When set to true after a load the software will automatically strobe the FUD pin on the AD9858, loading the data sent and making it active. When set to false the user must manually strobe the FUD pin, to make the data sent active."
'used when assigning a value to the property, on the left side of an assignment.
'Syntax: X.AutoFUD = 5
mvarAutoFUD_DUT1 = vData
End Property
Public Property Get AutoFUD_DUT1() As Boolean
'used when retrieving value of a property, on the right side of an assignment.
'Syntax: Debug.Print X.AutoFUD
AutoFUD_DUT1 = mvarAutoFUD_DUT1
End Property
Public Property Let AutoFUD_DUT2(ByVal vData As Boolean)
'used when assigning a value to the property, on the left side of an assignment.
'Syntax: X.AutoFUD = 5
mvarAutoFUD_DUT2 = vData
End Property
Public Property Get AutoFUD_DUT2() As Boolean
'used when retrieving value of a property, on the right side of an assignment.
'Syntax: Debug.Print X.AutoFUD
AutoFUD_DUT2 = mvarAutoFUD_DUT2
End Property
'Gets the active profile
'Returns 1 to 4
Public Function GetActiveProfile(ByVal DUTNum As Integer) As Integer
Attribute GetActiveProfile.VB_Description = "Gets the currently active profile."
Dim sProfileNum As String
'Set the profile number
Select Case DUTNum
Case 2:
sProfileNum = CStr(PS1_DUT2) & CStr(PS0_DUT2)
Case Else:
sProfileNum = CStr(PS1_DUT1) & CStr(PS0_DUT1)
End Select
GetActiveProfile = CInt(cbaseBinS2Dec(sProfileNum)) + 1
End Function
'Sets the active profile
'Inputs: Profile = A value from 1 to 4
Public Sub SetActiveProfile(ByVal DUTNum As Integer, ByVal Profile As Integer)
Attribute SetActiveProfile.VB_Description = "Sets the currently active profile."
Dim sProfileNum As String
Select Case DUTNum
Case 1:
'Use the profile selection bits to select the profile
Select Case Profile
Case 1:
PS0_DUT1 = abvLow
PS1_DUT1 = abvLow
Case 2:
PS0_DUT1 = abvHigh
PS1_DUT1 = abvLow
Case 3:
PS0_DUT1 = abvLow
PS1_DUT1 = abvHigh
Case 4:
PS0_DUT1 = abvHigh
PS1_DUT1 = abvHigh
End Select
Case 2:
'Use the profile selection bits to select the profile
Select Case Profile
Case 1:
PS0_DUT2 = abvLow
PS1_DUT2 = abvLow
Case 2:
PS0_DUT2 = abvHigh
PS1_DUT2 = abvLow
Case 3:
PS0_DUT2 = abvLow
PS1_DUT2 = abvHigh
Case 4:
PS0_DUT2 = abvHigh
PS1_DUT2 = abvHigh
End Select
Case Else:
'Use the profile selection bits to select the profile
Select Case Profile
Case 1:
PS0_DUT1 = abvLow
PS1_DUT1 = abvLow
PS0_DUT2 = abvLow
PS1_DUT2 = abvLow
Case 2:
PS0_DUT1 = abvHigh
PS1_DUT1 = abvLow
PS0_DUT2 = abvHigh
PS1_DUT2 = abvLow
Case 3:
PS0_DUT1 = abvLow
PS1_DUT1 = abvHigh
PS0_DUT2 = abvLow
PS1_DUT2 = abvHigh
Case 4:
PS0_DUT1 = abvHigh
PS1_DUT1 = abvHigh
PS0_DUT2 = abvHigh
PS1_DUT2 = abvHigh
End Select
End Select
' Strobe_Clock_D
WriteEvbBuffVal evb59Buff1
End Sub
Public Property Let SerialIOModeDUT1(ByVal vData As evbdSerMode)
'used when assigning a value to the property, on the left side of an assignment.
'Syntax: X.SerialIOMode = 5
'mvarSerialIOMode = vData
MsgBox "SerialIOMode is a read only property." & vbCrLf & "SerialIOMOde can only be set by setting Bit 1 in the Control Register.", vbCritical, "Funciton: Not Yet Supported!!"
End Property
Public Property Get SerialIOModeDUT1() As evbdSerMode
'used when retrieving value of a property, on the right side of an assignment.
'Syntax: Debug.Print X.SerialIOMode
SerialIOModeDUT1 = mvarSerialIOModeDUT1
End Property
Public Property Let SerialIOModeDUT2(ByVal vData As evbdSerMode)
'used when assigning a value to the property, on the left side of an assignment.
'Syntax: X.SerialIOMode = 5
'mvarSerialIOMode = vData
MsgBox "SerialIOMode is a read only property." & vbCrLf & "SerialIOMOde can only be set by setting Bit 1 in the Control Register.", vbCritical, "Funciton: Not Yet Supported!!"
End Property
Public Property Get SerialIOModeDUT2() As evbdSerMode
'used when retrieving value of a property, on the right side of an assignment.
'Syntax: Debug.Print X.SerialIOMode
SerialIOModeDUT2 = mvarSerialIOModeDUT2
End Property
Public Property Let LSBFirstDUT1(ByVal vData As Boolean)
'used when assigning a value to the property, on the left side of an assignment.
'Syntax: X.LSBFirst = 5
'mvarLSBFirst = vData
End Property
Public Property Get LSBFirstDUT1() As Boolean
'used when retrieving value of a property, on the right side of an assignment.
'Syntax: Debug.Print X.LSBFirst
LSBFirstDUT1 = mvarLSBFirstDUT1
End Property
Public Property Let LSBFirstDUT2(ByVal vData As Boolean)
'used when assigning a value to the property, on the left side of an assignment.
'Syntax: X.LSBFirst = 5
'mvarLSBFirst = vData
End Property
Public Property Get LSBFirstDUT2() As Boolean
'used when retrieving value of a property, on the right side of an assignment.
'Syntax: Debug.Print X.LSBFirst
LSBFirstDUT2 = mvarLSBFirstDUT2
End Property
'Loads the data speicified by data into the AD9858 at the register address
'specified by Address
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -