📄 clsevalboard.cls
字号:
mvarD5 = vData
'Set the appropriate bit in the Parallel Port Driver
PPIO.SetBitVal ppDataRegister, ppBit5, mvarD5
'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 D5() As adiBinValues
'used when retrieving value of a property, on the right side of an assignment.
'Syntax: Debug.Print X.D5
D5 = mvarD5
End Property
Public Property Let D4(ByVal vData As adiBinValues)
'used when assigning a value to the property, on the left side of an assignment.
'Syntax: X.D4 = 5
'Do the io opperation if enabled
If mvarEnabled = True Then
mvarD4 = vData
'Set the appropriate bit in the Parallel Port Driver
PPIO.SetBitVal ppDataRegister, ppBit4, mvarD4
'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 D4() As adiBinValues
'used when retrieving value of a property, on the right side of an assignment.
'Syntax: Debug.Print X.D4
D4 = mvarD4
End Property
Public Property Let D3(ByVal vData As adiBinValues)
'used when assigning a value to the property, on the left side of an assignment.
'Syntax: X.D3 = 5
'Do the io opperation if enabled
If mvarEnabled = True Then
mvarD3 = vData
'Set the appropriate bit in the Parallel Port Driver
PPIO.SetBitVal ppDataRegister, ppBit3, mvarD3
'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 D3() As adiBinValues
'used when retrieving value of a property, on the right side of an assignment.
'Syntax: Debug.Print X.D3
D3 = mvarD3
End Property
Public Property Let D2(ByVal vData As adiBinValues)
'used when assigning a value to the property, on the left side of an assignment.
'Syntax: X.D2 = 5
'Do the io opperation if enabled
If mvarEnabled = True Then
mvarD2 = vData
'Set the appropriate bit in the Parallel Port Driver
PPIO.SetBitVal ppDataRegister, ppBit2, mvarD2
'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 D2() As adiBinValues
'used when retrieving value of a property, on the right side of an assignment.
'Syntax: Debug.Print X.D2
D2 = mvarD2
End Property
Public Property Let D1(ByVal vData As adiBinValues)
'used when assigning a value to the property, on the left side of an assignment.
'Syntax: X.D1 = 5
'Do the io opperation if enabled
If mvarEnabled = True Then
mvarD1 = vData
'Set the appropriate bit in the Parallel Port Driver
PPIO.SetBitVal ppDataRegister, ppBit1, mvarD1
'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 D1() As adiBinValues
'used when retrieving value of a property, on the right side of an assignment.
'Syntax: Debug.Print X.D1
D1 = mvarD1
End Property
Public Property Let D0(ByVal vData As adiBinValues)
'used when assigning a value to the property, on the left side of an assignment.
'Syntax: X.D0 = 5
'Do the io opperation if enabled
If mvarEnabled = True Then
mvarD0 = vData
'Set the appropriate bit in the Parallel Port Driver
PPIO.SetBitVal ppDataRegister, ppbit0, mvarD0
'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 D0() As adiBinValues
'used when retrieving value of a property, on the right side of an assignment.
'Syntax: Debug.Print X.D0
D0 = mvarD0
End Property
Public Property Let Strobe(ByVal vData As adiBinValues)
'used when assigning a value to the property, on the left side of an assignment.
'Syntax: X.Strobe = 5
Dim InvertedData As Long
'Do the io opperation if enabled
If mvarEnabled = True Then
mvarStrobe = vData
'Invert the data before sending it to the LPT Port because this bit is
'inverted at the parallel port output
If mvarStrobe = abvHigh Then
InvertedData = abvLow
Else
InvertedData = abvHigh
End If
'Set the appropriate bit in the Parallel Port Driver
PPIO.SetBitVal ppControlRegister, ppBit3, InvertedData
'Write the new value to the parallel port
PPIO.WritePort ppControlRegister
' 'Latch the data through the buffer
' LatchData
End If
End Property
Public Property Get Strobe() As adiBinValues
'used when retrieving value of a property, on the right side of an assignment.
'Syntax: Debug.Print X.Strobe
Strobe = mvarStrobe
End Property
Public Property Let WCLK(ByVal vData As adiBinValues)
'used when assigning a value to the property, on the left side of an assignment.
'Syntax: X.WCLK = 5
Dim InvertedData As Long
'Do the io opperation if enabled
If mvarEnabled = True Then
mvarWCLK = vData
'Set the appropriate bit in the Parallel Port Driver
PPIO.SetBitVal ppControlRegister, ppBit2, mvarWCLK
'Write the new value to the parallel port
PPIO.WritePort ppControlRegister
'Latch the data through the buffer
LatchData
End If
End Property
Public Property Get WCLK() As adiBinValues
'used when retrieving value of a property, on the right side of an assignment.
'Syntax: Debug.Print X.WCLK
WCLK = mvarWCLK
End Property
'Do not allow the Check signal to be set it is Read Only
Public Property Let Check(ByVal vData As adiBinValues)
'used when assigning a value to the property, on the left side of an assignment.
'Syntax: X.Check = 5
' mvarCheck = vData
End Property
Public Property Get Check() As adiBinValues
'used when retrieving value of a property, on the right side of an assignment.
'Syntax: Debug.Print X.Check
'Do the io opperation if enabled
If Enabled = True Then
'Latch the data through
LatchData
'Read the appropriate bit
PPIO.ReadPort ppStatusRegister
Check = PPIO.GetBitVal(ppaStatusRegister, ppBit3)
End If
End Property
Public Property Let FQUD(ByVal vData As adiBinValues)
'used when assigning a value to the property, on the left side of an assignment.
'Syntax: X.FQUD = 5
Dim Inverted As adiBinValues
'Do the io opperation if enabled
If mvarEnabled = True Then
mvarFQUD = vData
'Invert the data before outputing it to the lpt port
If mvarFQUD = abvHigh Then
Inverted = abvLow
Else
Inverted = abvHigh
End If
'Set the appropriate bit in the Parallel Port Driver
PPIO.SetBitVal ppControlRegister, ppBit1, Inverted
'Write the new value to the parallel port
PPIO.WritePort ppControlRegister
'Latch the data through the buffer
LatchData
End If
End Property
Public Property Get FQUD() As adiBinValues
'used when retrieving value of a property, on the right side of an assignment.
'Syntax: Debug.Print X.FQUD
FQUD = mvarFQUD
End Property
Public Property Let Reset(ByVal vData As adiBinValues)
'used when assigning a value to the property, on the left side of an assignment.
'Syntax: X.Reset = 5
Dim Inverted As adiBinValues
Dim RSetOccrd As Boolean
'Do the io opperation if enabled
If mvarEnabled = True Then
'Detect a true reset
If mvarReset = abvHigh And vData = abvLow Then
RSetOccrd = True
End If
'Store the new value for future reference
mvarReset = vData
'Invert the data before outputing it to the lpt port
If mvarReset = abvHigh Then
Inverted = abvLow
Else
Inverted = abvHigh
End If
'Set the appropriate bit in the Parallel Port Driver
PPIO.SetBitVal ppControlRegister, ppbit0, Inverted
'Write the new value to the parallel port
PPIO.WritePort ppControlRegister
'Latch the data through the buffer
LatchData
'If the line is being set to a high then reset the Class also
If vData = abvHigh Then
mvarComMode = Parallel
mvarFQUD = abvLow
mvarStrobe = abvLow
mvarWCLK = abvLow
sOutputBuffer = "0000000000000000000000000000000000000000"
RaiseEvent OutputBufferChanged("0000000000000000000000000000000000000000")
End If
'Trigger the ResetOccured event it one occured
If RSetOccrd Then
RaiseEvent ResetOccured
End If
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 = mvarReset
End Property
Public Sub WriteData2Dut(ByVal Data As Variant)
'Do the io opperation if enabled
If mvarEnabled = True Then
'Check to see if the powerdown bit is set
If Mid(Data, 6, 1) Then
'If so Mask the PLL bit or the part will not come
'out of PowerDown until the PLL bit is cleared
Data = Left(Data, 7) & "0" & Right(Data, 32)
End If
'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 the properly using the proper mode
If ComMode = Parallel Then
'Check to see if the powerdown bit is set
' If Mid(Data, 6, 1) Then
' 'If so just send the powerdown bit and no pll
' Data = "00000100"
' 'If so just send the control word
' 'Data = Left(Data, 8)
' End If
ParallelLoad Data
Else
'Check to see if the powerdown bit is set
' If Mid(Data, 6, 1) Then
' 'Just send 8 bits
' SerialLoadShort Data
' End If 'Else
SerialLoad Data
'End If
End If
End If
End Sub
Private Sub Class_Initialize()
'Setup the lptio class
Set PPIO = New clsLPTIO
'Initialize the output buffer
sOutputBuffer = "0000000000000000000000000000000000000000"
'Initialize all properties
mvarEnabled = True
mvarComMode = Parallel
FQUD = abvLow
WCLK = abvLow
Strobe = abvLow
mvarAutoFQUD = True
End Sub
Private Sub Class_Terminate()
'Setup the lptio class
Set PPIO = Nothing
End Sub
'AD9850 Register Word Definitions
' Word 0 Word 1 Word 2 Word 3 Word 4
'MSB 00000000 00000000 00000000 00000000 00000000 LSB
Private Sub GetWordValues(W() As Integer, Optional ByVal sBinData)
Dim cntr As Integer
Dim BitCntr As Integer
Dim sBinWord As Integer
ReDim W(0 To 4)
If IsMissing(sBinData) Then
'If sBinData variable is missing then use the OutputBuffer
sBinData = sOutputBuffer
End If
For cntr = 4 To 0 Step -1
'Get a word from the data
sBinWord = Right(sBinData, 8)
'Trim off the word from the origional data
sBinData = Left(sBinData, Len(sBinData) - 8)
For BitCntr = 0 To 7
If Right(sBinWord, 1) = "1" Then
'Add on the bit value to the word value
W(cntr) = W(cntr) + 2 ^ BitCntr
End If
'Trim off the bit
sBinWord = Left(sBinWord, Len(sBinWord) - 1)
Next BitCntr
Next cntr
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -