📄 vb9112.frm
字号:
Begin VB.Label Label2
Appearance = 0 'Flat
BackColor = &H00C0C0C0&
Caption = "15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0"
ForeColor = &H80000008&
Height = 195
Left = 240
TabIndex = 13
Top = 4080
Width = 5775
End
Begin VB.Image Image0
Appearance = 0 'Flat
Height = 300
Left = 2400
Picture = "vb9112.frx":47A2
Top = 5820
Visible = 0 'False
Width = 300
End
Begin VB.Image Image1
Appearance = 0 'Flat
Height = 300
Left = 2700
Picture = "vb9112.frx":4914
Top = 5820
Visible = 0 'False
Width = 300
End
Begin VB.Image ChDn
Appearance = 0 'Flat
Height = 210
Index = 0
Left = -180
Picture = "vb9112.frx":4A86
Top = 5760
Visible = 0 'False
Width = 270
End
Begin VB.Image ChDn
Appearance = 0 'Flat
Height = 210
Index = 1
Left = 60
Picture = "vb9112.frx":4BB0
Top = 5760
Visible = 0 'False
Width = 270
End
Begin VB.Image ChDn
Appearance = 0 'Flat
Height = 210
Index = 2
Left = 300
Picture = "vb9112.frx":4CDA
Top = 5760
Visible = 0 'False
Width = 270
End
Begin VB.Image ChDn
Appearance = 0 'Flat
Height = 210
Index = 3
Left = 540
Picture = "vb9112.frx":4E04
Top = 5760
Visible = 0 'False
Width = 270
End
Begin VB.Image ChDn
Appearance = 0 'Flat
Height = 210
Index = 4
Left = 780
Picture = "vb9112.frx":4F2E
Top = 5760
Visible = 0 'False
Width = 270
End
Begin VB.Image ChDn
Appearance = 0 'Flat
Height = 210
Index = 5
Left = 1020
Picture = "vb9112.frx":5058
Top = 5760
Visible = 0 'False
Width = 270
End
Begin VB.Image ChDn
Appearance = 0 'Flat
Height = 210
Index = 6
Left = 1260
Picture = "vb9112.frx":5182
Top = 5760
Visible = 0 'False
Width = 270
End
Begin VB.Image ChDn
Appearance = 0 'Flat
Height = 210
Index = 7
Left = 1500
Picture = "vb9112.frx":52AC
Top = 5760
Visible = 0 'False
Width = 270
End
Begin VB.Image ChUp
Appearance = 0 'Flat
Height = 210
Index = 0
Left = -180
Picture = "vb9112.frx":53D6
Top = 5940
Visible = 0 'False
Width = 270
End
Begin VB.Image ChUp
Appearance = 0 'Flat
Height = 210
Index = 1
Left = 60
Picture = "vb9112.frx":5500
Top = 5940
Visible = 0 'False
Width = 270
End
Begin VB.Image ChUp
Appearance = 0 'Flat
Height = 210
Index = 2
Left = 300
Picture = "vb9112.frx":562A
Top = 5940
Visible = 0 'False
Width = 270
End
Begin VB.Image ChUp
Appearance = 0 'Flat
Height = 210
Index = 3
Left = 540
Picture = "vb9112.frx":5754
Top = 5940
Visible = 0 'False
Width = 270
End
Begin VB.Image ChUp
Appearance = 0 'Flat
Height = 210
Index = 4
Left = 780
Picture = "vb9112.frx":587E
Top = 5940
Visible = 0 'False
Width = 270
End
Begin VB.Image ChUp
Appearance = 0 'Flat
Height = 210
Index = 5
Left = 1020
Picture = "vb9112.frx":59A8
Top = 5940
Visible = 0 'False
Width = 270
End
Begin VB.Image ChUp
Appearance = 0 'Flat
Height = 210
Index = 6
Left = 1260
Picture = "vb9112.frx":5AD2
Top = 5940
Visible = 0 'False
Width = 270
End
Begin VB.Image ChUp
Appearance = 0 'Flat
Height = 210
Index = 7
Left = 1500
Picture = "vb9112.frx":5BFC
Top = 5940
Visible = 0 'False
Width = 270
End
End
Attribute VB_Name = "util9112"
Attribute VB_Creatable = False
Attribute VB_Exposed = False
Option Explicit
Dim range_value(9) As Integer
Dim PrevP(15) As Long
Dim ChannelOn(15) As Long
Dim SignalColor(15) As Long
Dim Active As Long
Dim NewStart As Long
Dim status(15) As Long
Dim angle As Single
Dim sq As Integer
Dim gnDoValue As Long
Const SINE_WAVE = 0
Const SQUARE_WAVE = 1
'For tuner
Const Pi = 3.14159
Const MaxAngle = 4 '5Pi/4
Const MinAngle = -0.8 '-Pi/4
Dim x0 As Long, y0 As Long
Dim DragOn As Long
Dim l As Long
Dim lb As Single, ub As Single
Private Function ArcCos(p As Single) As Single
If p <= -1 Then
ArcCos = Pi
Exit Function
ElseIf p >= 1 Then
ArcCos = 0
Exit Function
End If
ArcCos = Atn(-p / Sqr(-p * p + 1)) + 1.5708
End Function
Sub Scale_Change(ByVal g As Long)
Select Case g
Case 0
Label1(2).Caption = "5.0"
Label1(3).Caption = "2.5"
Label1(4).Caption = "0.0"
Label1(5).Caption = "-2.5"
Label1(6).Caption = "-5.0"
Case 1
Label1(2).Caption = "2.50"
Label1(3).Caption = "1.25"
Label1(4).Caption = "0.00"
Label1(5).Caption = "-1.25"
Label1(6).Caption = "-2.50"
Case 2
Label1(2).Caption = "1.250"
Label1(3).Caption = "0.625"
Label1(4).Caption = "0.00"
Label1(5).Caption = "-0.625"
Label1(6).Caption = "-1.250"
Case 3
Label1(2).Caption = "0.6250"
Label1(3).Caption = "0.3125"
Label1(4).Caption = "0.0000"
Label1(5).Caption = "-0.3125"
Label1(6).Caption = "-0.6250"
Case 4
Label1(2).Caption = "10"
Label1(3).Caption = "7.5"
Label1(4).Caption = "5.0"
Label1(5).Caption = "2.5"
Label1(6).Caption = "0.0"
Case 5
Label1(2).Caption = "5.00"
Label1(3).Caption = "3.75"
Label1(4).Caption = "2.50"
Label1(5).Caption = "1.25"
Label1(6).Caption = "0.00"
Case 6
Label1(2).Caption = "2.500"
Label1(3).Caption = "1.875"
Label1(4).Caption = "1.250"
Label1(5).Caption = "0.625"
Label1(6).Caption = "0.000"
Case 7
Label1(2).Caption = "1.2500"
Label1(3).Caption = "0.9375"
Label1(4).Caption = "0.6250"
Label1(5).Caption = "0.3125"
Label1(6).Caption = "0.0000"
Case 8
Label1(2).Caption = "10"
Label1(3).Caption = "5.0"
Label1(4).Caption = "0.0"
Label1(5).Caption = "-5.0"
Label1(6).Caption = "-10"
End Select
Label1(19).Caption = Label1(2).Caption
Label1(20).Caption = Label1(3).Caption
Label1(21).Caption = Label1(4).Caption
Label1(22).Caption = Label1(5).Caption
Label1(23).Caption = Label1(6).Caption
End Sub
Private Sub Channel_Click(Index As Integer)
If ChannelOn(Index) Then
If Index < 8 Then
Channel(Index) = ChUp(Index)
Else
Channel(Index) = ChUp(Index - 8)
End If
Else
If Index < 8 Then
Channel(Index) = ChDn(Index)
Else
Channel(Index) = ChDn(Index - 8)
End If
End If
ChannelOn(Index) = Not ChannelOn(Index)
End Sub
Private Sub DOP_Click(Index As Integer)
Dim i As Integer, v As Integer, d As Long
If Active Then
If status(Index) = 1 Then
DOP(Index) = Image0
status(Index) = 0
d = 1
For i = 1 To Index
d = d * 2
Next
gnDoValue = gnDoValue - d
Else
DOP(Index) = Image1
status(Index) = 1
d = 1
For i = 1 To Index
d = d * 2
Next
gnDoValue = gnDoValue + d
End If
v = DO_WritePort(card, 0, gnDoValue)
End If
End Sub
Private Sub ExitBtn_Click()
Dim result As Integer
If card >= 0 Then
result = Release_Card(card)
End If
End
End Sub
Private Sub Form_Load()
Dim i As Long
Dim result As Integer
SettingForm.Show 1
If card < 0 Then
MsgBox "Register card failed."
End
End If
For i = 0 To 15
PrevP(i) = -1
ChannelOn(i) = False
Next
For i = 0 To 15
status(i) = 0
Next
NewStart = True
Active = False
'gnDoValue = 0
gain.AddItem "+/- 5V"
gain.AddItem "+/- 2.5V"
gain.AddItem "+/- 1.25V"
gain.AddItem "+/- 0.625V"
gain.AddItem "0V~10V"
gain.AddItem "0V~5V"
gain.AddItem "0V~2.5V"
gain.AddItem "0V~1.25V"
gain.AddItem "+/- 10V"
range_value(0) = 2
range_value(1) = 3
range_value(2) = 4
range_value(3) = 5
range_value(4) = 15
range_value(5) = 16
range_value(6) = 17
range_value(7) = 18
range_value(8) = 1
gain.ListIndex = 0
DA_Wave.AddItem "Sine Wave"
DA_Wave.AddItem "Square Wave"
SignalColor(0) = &HFFFF&
SignalColor(1) = &H8000&
SignalColo
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -