📄 form1.frm
字号:
VERSION 5.00
Begin VB.Form Form1
Caption = "USB2SPI + MAX1202 八通道数据采集卡 采样频率 > 4Ksps (8ch同时采)"
ClientHeight = 5430
ClientLeft = 60
ClientTop = 345
ClientWidth = 8940
LinkTopic = "Form1"
ScaleHeight = 5430
ScaleWidth = 8940
StartUpPosition = 3 'Windows Default
Begin VB.TextBox Text2
Height = 375
Left = 5760
TabIndex = 17
Text = "1"
Top = 120
Width = 255
End
Begin VB.HScrollBar HScroll2
Height = 375
Left = 4320
Max = 5
Min = 1
TabIndex = 16
Top = 120
Value = 1
Width = 1455
End
Begin VB.TextBox Text1
Height = 375
Left = 3360
TabIndex = 10
Text = "1"
Top = 120
Width = 255
End
Begin VB.HScrollBar HScroll1
Height = 375
Left = 1920
Max = 5
Min = 1
TabIndex = 9
Top = 120
Value = 1
Width = 1455
End
Begin VB.Timer Timer1
Left = 8520
Top = 0
End
Begin VB.PictureBox Picture1
Height = 1052
Index = 7
Left = 4560
ScaleHeight = 1056
ScaleMode = 0 'User
ScaleWidth = 4035
TabIndex = 8
Top = 4200
Width = 4096
End
Begin VB.PictureBox Picture1
Height = 1052
Index = 6
Left = 4560
ScaleHeight = 1056
ScaleMode = 0 'User
ScaleWidth = 4035
TabIndex = 7
Top = 3000
Width = 4096
End
Begin VB.PictureBox Picture1
Height = 1052
Index = 5
Left = 4560
ScaleHeight = 1056
ScaleMode = 0 'User
ScaleWidth = 4035
TabIndex = 6
Top = 1800
Width = 4096
End
Begin VB.PictureBox Picture1
Height = 1052
Index = 4
Left = 4560
ScaleHeight = 1056
ScaleMode = 0 'User
ScaleWidth = 4035
TabIndex = 5
Top = 600
Width = 4096
End
Begin VB.PictureBox Picture1
Height = 1052
Index = 3
Left = 240
ScaleHeight = 1056
ScaleMode = 0 'User
ScaleWidth = 4035
TabIndex = 4
Top = 4200
Width = 4096
End
Begin VB.PictureBox Picture1
Height = 1052
Index = 2
Left = 240
ScaleHeight = 1056
ScaleMode = 0 'User
ScaleWidth = 4035
TabIndex = 3
Top = 3000
Width = 4096
End
Begin VB.PictureBox Picture1
Height = 1052
Index = 1
Left = 240
ScaleHeight = 1056
ScaleMode = 0 'User
ScaleWidth = 4035
TabIndex = 2
Top = 1800
Width = 4096
End
Begin VB.PictureBox Picture1
Height = 1052
Index = 0
Left = 240
ScaleHeight = 1056
ScaleMode = 0 'User
ScaleWidth = 4035
TabIndex = 1
Top = 600
Width = 4096
End
Begin VB.CommandButton Command1
Caption = "Reset"
Height = 375
Left = 240
TabIndex = 0
Top = 120
Width = 855
End
Begin VB.Label Label7
Caption = "mV/Div"
Height = 255
Left = 8040
TabIndex = 19
Top = 240
Width = 615
End
Begin VB.Label Label6
Caption = "1000"
Height = 255
Left = 7680
TabIndex = 18
Top = 240
Width = 375
End
Begin VB.Label Label5
Caption = "YScale"
Height = 255
Left = 3720
TabIndex = 15
Top = 240
Width = 615
End
Begin VB.Label Label4
Caption = "X:"
Height = 255
Left = 6240
TabIndex = 14
Top = 240
Width = 255
End
Begin VB.Label Label3
Caption = "25000"
Height = 255
Left = 6480
TabIndex = 13
Top = 240
Width = 495
End
Begin VB.Label Label2
Caption = "us/Div Y:"
Height = 255
Left = 6960
TabIndex = 12
Top = 240
Width = 735
End
Begin VB.Label Label1
Caption = "XScale"
Height = 255
Left = 1320
TabIndex = 11
Top = 240
Width = 615
End
End
Attribute VB_Name = "Form1"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Dim data(24) As Byte
Dim lim As LARGE_INTEGER
Dim ssss As LARGE_INTEGER
Dim lMSFreq As Long
Dim cachh(8, 9000)
Dim cachl(8, 9000)
Dim cacht(9000)
Dim tt(8)
Dim tt2(8)
Dim scale0
Dim scale1
Private Sub Command1_Click()
Call Form1_UnLoad
Call Form_Load
End Sub
Private Sub Form_Load()
scale0 = 1
scale1 = 1
For i = 0 To 7
Picture1(i).AutoRedraw = True
Picture1(i).BackColor = 0
For j = 12 To 1024 Step 50
Picture1(i).Line (1, j)-(4096, j), RGB(64, 64, 64)
Next j
For j = 1 To 4096 Step 50
Picture1(i).Line (j, 1)-(j, 1052), RGB(64, 64, 64)
Next j
For j = 12 To 1024 Step 250
Picture1(i).Line (1, j)-(4096, j), RGB(128, 128, 128)
Next j
For j = 1 To 4096 Step 250
Picture1(i).Line (j, 1)-(j, 1052), RGB(128, 128, 128)
Next j
Picture1(i).AutoRedraw = False
Next i
'USBIO_OpenDevice (0)
USBIO_OpenDevice (0)
'If CH341Set_D5_D0(0, &H29, &HF7) = True Then
'End If
'If CH341SetStream(0, &H82) = True Then
'End If
If USBIO_Set_D5_D0(0, &H29, &HF7) = True Then
End If
If USBIO_SetStream(0, &H82) = True Then
End If
Timer1.Interval = 1000
Timer1.Enabled = True
'QueryPerformanceFrequency lim
'lMSFreq = (lim.highpart * 2 ^ 16) \ 1000 + lim.lowpart \ 1000
'Text1.Text = (lim.highpart * 2 ^ 16) / 1000000 + lim.lowpart / 1000000
End Sub
Private Sub Form1_UnLoad()
Timer1.Enabled = False
'CH341CloseDevice (0)
USBIO_CloseDevice (0)
End Sub
Private Sub HScroll1_Change()
scale0 = HScroll1.Value
Text1.Text = scale0
Label3.Caption = Fix(25000 / scale0)
End Sub
Private Sub HScroll2_Change()
scale1 = HScroll2.Value
Text2.Text = scale1
Label6.Caption = Fix(1000 / scale1)
End Sub
Private Sub Timer1_Timer()
'If CH341SetStream(0, &H82) = True Then
'End If
If USBIO_SetStream(0, &H82) = True Then
End If
For aa = 1 To 150
data(1) = &H86
data(2) = 0
data(3) = 0
data(4) = &H96
data(5) = 0
data(6) = 0
data(7) = &HA6
data(8) = 0
data(9) = 0
data(10) = &HB6
data(11) = 0
data(12) = 0
data(13) = &HC6
data(14) = 0
data(15) = 0
data(16) = &HD6
data(17) = 0
data(18) = 0
data(19) = &HE6
data(20) = 0
data(21) = 0
data(22) = &HF6
data(23) = 0
data(24) = 0
Call QueryPerformanceCounter(ssss)
sta = USBIO_StreamSPI4(0, &H80, 24, data(1))
'sta = CH341StreamSPI4(0, &H80, 24, data(1))
'X = data(3) / 16 + data(2) * 16
cachh(1, aa) = data(3)
cachl(1, aa) = data(2)
cachh(2, aa) = data(6)
cachl(2, aa) = data(5)
cachh(3, aa) = data(9)
cachl(3, aa) = data(8)
cachh(4, aa) = data(12)
cachl(4, aa) = data(11)
cachh(5, aa) = data(15)
cachl(5, aa) = data(14)
cachh(6, aa) = data(18)
cachl(6, aa) = data(17)
cachh(7, aa) = data(21)
cachl(7, aa) = data(20)
cachh(8, aa) = data(24)
cachl(8, aa) = data(23)
cacht(aa) = ssss.lowpart
Next aa
Picture1(0).Cls
Picture1(1).Cls
Picture1(2).Cls
Picture1(3).Cls
Picture1(4).Cls
Picture1(5).Cls
Picture1(6).Cls
Picture1(7).Cls
For bb = 1 To 150
xx2 = xx
tt2(1) = tt(1)
tt2(2) = tt(2)
tt2(3) = tt(3)
tt2(4) = tt(4)
tt2(5) = tt(5)
tt2(6) = tt(6)
tt2(7) = tt(7)
tt2(8) = tt(8)
tt(1) = cachh(1, bb) / 16 + cachl(1, bb) * 16
tt(2) = cachh(2, bb) / 16 + cachl(2, bb) * 16
tt(3) = cachh(3, bb) / 16 + cachl(3, bb) * 16
tt(4) = cachh(4, bb) / 16 + cachl(4, bb) * 16
tt(5) = cachh(5, bb) / 16 + cachl(5, bb) * 16
tt(6) = cachh(6, bb) / 16 + cachl(6, bb) * 16
tt(7) = cachh(7, bb) / 16 + cachl(7, bb) * 16
tt(8) = cachh(8, bb) / 16 + cachl(8, bb) * 16
For ii = 1 To 8
If tt(ii) > 2047 Then
tt(ii) = tt(ii) - 2048
Else
tt(ii) = tt(ii) + 2048
End If
Next ii
cacht(bb) = (cacht(bb) + 2147483648#) / 357.9545
xx = cacht(bb) Mod 10000
xx1 = cacht(1) Mod 10000
xx = (xx + 10000 - xx1) Mod 10000
If bb > 1 Then
Form1.Picture1(0).Line (xx2 * scale0, tt2(1) * scale1 / 4 - 512 * (scale1 - 1))-(xx * scale0, tt(1) * scale1 / 4 - 512 * (scale1 - 1)), RGB(128, 0, 255)
Form1.Picture1(1).Line (xx2 * scale0, tt2(2) * scale1 / 4 - 512 * (scale1 - 1))-(xx * scale0, tt(2) * scale1 / 4 - 512 * (scale1 - 1)), RGB(255, 0, 0)
Form1.Picture1(2).Line (xx2 * scale0, tt2(3) * scale1 / 4 - 512 * (scale1 - 1))-(xx * scale0, tt(3) * scale1 / 4 - 512 * (scale1 - 1)), RGB(255, 128, 0)
Form1.Picture1(3).Line (xx2 * scale0, tt2(4) * scale1 / 4 - 512 * (scale1 - 1))-(xx * scale0, tt(4) * scale1 / 4 - 512 * (scale1 - 1)), RGB(255, 255, 0)
Form1.Picture1(4).Line (xx2 * scale0, tt2(5) * scale1 / 4 - 512 * (scale1 - 1))-(xx * scale0, tt(5) * scale1 / 4 - 512 * (scale1 - 1)), RGB(0, 255, 0)
Form1.Picture1(5).Line (xx2 * scale0, tt2(6) * scale1 / 4 - 512 * (scale1 - 1))-(xx * scale0, tt(6) * scale1 / 4 - 512 * (scale1 - 1)), RGB(0, 0, 255)
Form1.Picture1(6).Line (xx2 * scale0, tt2(7) * scale1 / 4 - 512 * (scale1 - 1))-(xx * scale0, tt(7) * scale1 / 4 - 512 * (scale1 - 1)), RGB(255, 0, 255)
Form1.Picture1(7).Line (xx2 * scale0, tt2(8) * scale1 / 4 - 512 * (scale1 - 1))-(xx * scale0, tt(8) * scale1 / 4 - 512 * (scale1 - 1)), RGB(255, 255, 255)
End If
xxx = xx - xx2
Next bb
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -