📄 _dll_test_vb.frm
字号:
VERSION 5.00
Begin VB.Form Form1
Caption = "Form1"
ClientHeight = 6315
ClientLeft = 60
ClientTop = 450
ClientWidth = 11580
LinkTopic = "Form1"
ScaleHeight = 6315
ScaleWidth = 11580
StartUpPosition = 3 'Windows Default
Begin VB.CommandButton Command1
Caption = "STRAT"
Height = 375
Left = 9000
TabIndex = 0
Top = 5760
Width = 1815
End
End
Attribute VB_Name = "Form1"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Base 0
Private Declare Sub Sleep Lib "kernel32" (ByVal dwMilliseconds As Long)
Private Declare Sub OpenCom Lib "ACHILLES.DLL" (ByVal ComNo As Integer)
Private Declare Function ReadDev Lib "ACHILLES.DLL" (ByVal DevAddr As Integer, ByRef RecBuf As Long) As Boolean
Private Declare Sub CloseCom Lib "ACHILLES.DLL" (ByVal ComNo As Integer)
Dim switch As Boolean
Dim K_VolVal() As Variant
Private Function GetTemper_K(ByVal code As Integer) As Double
Dim i As Integer
Dim mv As Double
Dim Temper As Double
mv = code / 4095# * 50#
For i = 0 To 25
If K_VolVal(i) >= mv Then
GoTo 1
End If
Next
1:
Temper = (i - 1) * 50# + (mv - K_VolVal(i - 1)) / (K_VolVal(i) - K_VolVal(i - 1)) * 50#
GetTemper_K = Temper
End Function
Private Sub Command1_Click()
Dim i, j As Integer
Dim n As Boolean
Dim Buf_A(8) As Long
Dim Buf_B(8) As Long
Dim Buf_C(8) As Long
Dim Buf_D(8) As Long
Dim A(8) As Double
Dim B(8) As Double
Dim C(8) As Double
Dim D(8) As Double
If (switch = True) Then
switch = False
Else
switch = True
End If
For i = 0 To 7
Buf_A(i) = 10
Buf_B(i) = 10
Buf_C(i) = 10
Buf_D(i) = 10
Next
Do While (switch)
n = ReadDev(1, Buf_A(0))
n = ReadDev(2, Buf_B(0))
n = ReadDev(3, Buf_C(0))
n = ReadDev(4, Buf_D(0))
For i = 0 To 7
A(i) = GetTemper_K(Buf_A(i))
B(i) = GetTemper_K(Buf_B(i))
C(i) = GetTemper_K(Buf_C(i))
D(i) = GetTemper_K(Buf_D(i))
Next
D(7) = Buf_D(7) / 4095# * 500# - 273#
Form1.Cls
For i = 0 To 7
Form1.CurrentX = 0
Form1.CurrentY = 0 + i * 200
Print (A(i))
Form1.CurrentX = 3000
Form1.CurrentY = 0 + i * 200
Print (B(i))
Form1.CurrentX = 6000
Form1.CurrentY = 0 + i * 200
Print (C(i))
Form1.CurrentX = 9000
Form1.CurrentY = 0 + i * 200
Print (D(i))
Form1.CurrentX = 12000
Form1.CurrentY = 0 + i * 200
Print " "
Next
Sleep (100)
DoEvents
Loop
End Sub
Private Sub Form_Load()
K_VolVal = Array(0.000001, 2.02, 4.1, 6.14, 8.14, 10.15, 12.21, 14.29, 16.4, 18.51, 20.64, 22.77, 24.9, 27.02, 29.13, 31.21, 33.28, 35.31, 37.33, 39.31, 41.27, 43.2, 45.11, 46.99, 48.83, 50.63)
CloseCom (1)
OpenCom (1)
End Sub
Private Sub Form_Unload(Cancel As Integer)
CloseCom (1)
switch = False
Unload Me
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -