📄 clsevalboard.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 = "cls9850EVBD"
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"
'***********************************************************************
'* Updated on 05_01_2001 *
'* Made sure that the AD9851 went into sleep mode with the PLL bit set *
'* to a 0, otherwize the AD9851 wouldn't come out of sleepmode. *
'***********************************************************************
Public Enum adiBinValues
abvLow = 0
abvHigh = 1
End Enum
Public Enum evbdComMode
Parallel = 0
Serial = 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
'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 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
'AD9850 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 serial interface
Public Sub SerialLoad(ByVal Data As String)
Dim cntr As Integer
Dim DataLen As Integer
'Send a Frequency update to reset the interal word
'counter to a know state before sending the data
'to the part, but only in when the user wants Auto Frequency Update
If mvarAutoFQUD Then
'Do a frequency update to load the data
FQUD = abvHigh
FQUD = abvLow
End If
'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 = abvHigh
WCLK = abvLow
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 = abvHigh
FQUD = abvLow
End If
End Sub
'AD9850 Register Word Definitions
' Word 0 Word 1 Word 2 Word 3 Word 4
'MSB 00000000 00000000 00000000 00000000 00000000 LSB
'Sends only the control word
Public Sub SerialLoadShort(ByVal Data As String)
Dim cntr As Integer
Dim DataLen As Integer
' Dim SleepWord As String
' SleepWord = "0000010000000000000000000000000000000000"
'Send just the 8 bits for sleep mode
For cntr = 8 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 = abvHigh
WCLK = abvLow
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 = abvHigh
FQUD = abvLow
End If
End Sub
'AD9850 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)
'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 = abvHigh
WCLK = abvLow
'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 = abvHigh
FQUD = abvLow
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
'Resetting the dut is the only way to return to parallel mode
ResetDUT
ElseIf vData = Serial And mvarComMode = Parallel Then
'Build a new output data string to set Serial Mode Enable bits
OutData = Left(sOutputBuffer, 6) & "11"
'Set to serial mode
ParallelLoad OutData
'Build a output data string to reset the SerialMode Enable bits
OutData = Left(sOutputBuffer, 6) & "0" & Right(sOutputBuffer, 33)
SerialLoad OutData
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
PPIO.SetBitVal ppDataRegister, ppBit6, mvarD6
'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 D6() As adiBinValues
'used when retrieving value of a property, on the right side of an assignment.
'Syntax: Debug.Print X.D6
D6 = mvarD6
End Property
Public Property Let D5(ByVal vData As adiBinValues)
'used when assigning a value to the property, on the left side of an assignment.
'Syntax: X.D5 = 5
'Do the io opperation if enabled
If mvarEnabled = True Then
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -