📄 form1.frm
字号:
VERSION 5.00
Object = "{648A5603-2C6E-101B-82B6-000000000014}#1.1#0"; "MSCOMM32.OCX"
Begin VB.Form Form1
Caption = "Form1"
ClientHeight = 5655
ClientLeft = 60
ClientTop = 345
ClientWidth = 7455
LinkTopic = "Form1"
ScaleHeight = 5655
ScaleWidth = 7455
StartUpPosition = 3 '窗口缺省
Begin VB.TextBox Text19
Height = 375
Left = 3120
TabIndex = 18
Text = "Text19"
Top = 5040
Width = 1455
End
Begin VB.TextBox Text18
Height = 375
Left = 240
TabIndex = 17
Text = "Text18"
Top = 5040
Width = 1575
End
Begin VB.TextBox Text17
Height = 375
Left = 3480
TabIndex = 16
Text = "Text17"
Top = 4440
Width = 615
End
Begin VB.TextBox Text16
Height = 315
Left = 2640
TabIndex = 15
Text = "Text16"
Top = 4440
Width = 615
End
Begin VB.TextBox Text15
Height = 375
Left = 1800
TabIndex = 14
Text = "Text15"
Top = 4440
Width = 615
End
Begin VB.TextBox Text14
Height = 375
Left = 960
TabIndex = 13
Text = "Text14"
Top = 4440
Width = 615
End
Begin VB.TextBox Text13
Height = 375
Left = 240
TabIndex = 12
Text = "Text13"
Top = 4440
Width = 615
End
Begin VB.TextBox Text12
Height = 375
Left = 3120
TabIndex = 11
Text = "Text12"
Top = 3720
Width = 1815
End
Begin VB.TextBox Text11
Height = 375
Left = 3120
TabIndex = 10
Text = "Text11"
Top = 3120
Width = 1575
End
Begin VB.TextBox Text10
Height = 375
Left = 3120
TabIndex = 9
Text = "Text10"
Top = 2520
Width = 1575
End
Begin VB.TextBox Text9
Height = 375
Left = 3120
TabIndex = 8
Text = "Text9"
Top = 1800
Width = 1455
End
Begin VB.TextBox Text8
Height = 375
Left = 3120
TabIndex = 7
Text = "Text8"
Top = 1200
Width = 1575
End
Begin VB.TextBox Text7
Height = 375
Left = 3120
TabIndex = 6
Text = "Text7"
Top = 600
Width = 1695
End
Begin VB.TextBox Text6
Height = 375
Left = 240
TabIndex = 5
Text = "Text6"
Top = 3720
Width = 1695
End
Begin VB.TextBox Text5
Height = 375
Left = 240
TabIndex = 4
Text = "Text5"
Top = 3120
Width = 1575
End
Begin VB.TextBox Text4
Height = 375
Left = 240
TabIndex = 3
Text = "Text4"
Top = 2520
Width = 1575
End
Begin VB.TextBox Text3
Height = 375
Left = 240
TabIndex = 2
Text = "Text3"
Top = 1800
Width = 1455
End
Begin VB.TextBox Text2
Height = 375
Left = 240
TabIndex = 1
Text = "Text2"
Top = 1200
Width = 1575
End
Begin VB.TextBox Text1
Height = 375
Left = 240
TabIndex = 0
Text = "Text1"
Top = 600
Width = 1575
End
Begin VB.Timer Timer1
Interval = 1000
Left = 6840
Top = 1440
End
Begin MSCommLib.MSComm MSComm1
Left = 6600
Top = 120
_ExtentX = 1005
_ExtentY = 1005
_Version = 393216
DTREnable = -1 'True
Handshaking = 2
RTSEnable = -1 'True
End
End
Attribute VB_Name = "Form1"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Dim a(50) As Byte
Private Sub Form_Load()
MSComm1.CommPort = 1
MSComm1.Settings = "4800,E,8,1"
MSComm1.InputLen = 0
MSComm1.PortOpen = True
'供水温度
Text1.LinkTopic = "RSLINX|test"
Text1.LinkItem = "I:7.0,L1,C1"
Text1.LinkMode = 1
'供水压力
Text2.LinkTopic = "RSLINX|test"
Text2.LinkItem = "I:3.2,L1,C1"
Text2.LinkMode = 1
'供水流量
Text3.LinkTopic = "RSLINX|test"
Text3.LinkItem = "F27:45,L1,C1"
Text3.LinkMode = 1
'补水温度
Text4.LinkTopic = "RSLINX|test"
Text4.LinkItem = "I:7.3,L1,C1"
Text4.LinkMode = 1
'补水压力
Text5.LinkTopic = "RSLINX|test"
Text5.LinkItem = "I:4.2,L1,C1"
Text5.LinkMode = 1
'补水流量
Text6.LinkTopic = "RSLINX|test"
Text6.LinkItem = "f8:17,L1,C1"
Text6.LinkMode = 1
'回水温度
Text7.LinkTopic = "RSLINX|test"
Text7.LinkItem = "I:7.1,L1,C1"
Text7.LinkMode = 1
'回水压力
Text8.LinkTopic = "RSLINX|test"
Text8.LinkItem = "I:3.3,L1,C1"
Text8.LinkMode = 1
'回水流量
Text9.LinkTopic = "RSLINX|test"
Text9.LinkItem = "F8:99,L1,C1"
Text9.LinkMode = 1
'供水累计流量
Text10.LinkTopic = "RSLINX|test"
Text10.LinkItem = "F8:0,L1,C1"
Text10.LinkMode = 1
'回水累计流量
Text11.LinkTopic = "RSLINX|test"
Text11.LinkItem = "F8:2,L1,C1"
Text11.LinkMode = 1
'补水累计流量
Text12.LinkTopic = "RSLINX|test"
Text12.LinkItem = "F8:6,L1,C1"
Text12.LinkMode = 1
Text13.LinkTopic = "RSLINX|test"
Text13.LinkItem = "I:1.0/0,L1,C1"
Text13.LinkMode = 1
Text14.LinkTopic = "RSLINX|test"
Text14.LinkItem = "I:1.0/1,L1,C1"
Text14.LinkMode = 1
Text15.LinkTopic = "RSLINX|test"
Text15.LinkItem = "I:1.0/2,L1,C1"
Text15.LinkMode = 1
Text16.LinkTopic = "RSLINX|test"
Text16.LinkItem = "I:1.0/3,L1,C1"
Text16.LinkMode = 1
Text17.LinkTopic = "RSLINX|test"
Text17.LinkItem = "I:1.0/4,L1,C1"
Text17.LinkMode = 1
'供水热量
Text18.LinkTopic = "RSLINX|test"
Text18.LinkItem = "F8:76,L1,C1"
Text18.LinkMode = 1
'供热量
Text19.LinkTopic = "RSLINX|test"
Text19.LinkItem = "F8:74,L1,C1"
Text19.LinkMode = 1
End Sub
Private Sub Form_Unload(Cancel As Integer)
MSComm1.PortOpen = False
End Sub
Private Sub MSComm1_OnComm()
Select Case MSComm1.CommEvent
Case comEvSend
Case comEvCTS
Case comEvDSR
Case comEvCD
Case comEvRing
Case comEvEOF
Case comBreak
'通讯中断,从新打开COM口
MSComm1.PortOpen = False
MSComm1.CommPort = 1
MSComm1.Settings = "4800,E,8,1"
MSComm1.InputLen = 0
MSComm1.PortOpen = True
Case comCDTO
Case comCTSTO
Case comDCB
Case comDSRTO
Case comFrame
Case comOverrun
Case comRxOver
Case comRxParity
Case comTxFull
Case Else
End Select
End Sub
Private Sub Timer1_Timer()
'起始位
a(0) = 12345 / 256
a(1) = 12345 Mod 256
'供水温度
i1 = Val(Text1.Text)
a(2) = Int(((i1 * 0.064091 - 200) * 100) / 256)
a(3) = Int(((i1 * 0.064091 - 200) * 100) Mod 256)
'供水压力
i2 = Val(Text2.Text)
a(4) = Int((i2 * 0.000122 * 100) / 256)
a(5) = Int((i2 * 0.000122 * 100) Mod 256)
'供水流量
i3 = Val(Text3.Text)
a(6) = Int((i3) / 256)
a(7) = Int((i3) Mod 256)
'补水温度
i4 = Val(Text4.Text)
a(8) = Int(((i4 * 0.064091 - 200) * 100) / 256)
a(9) = Int(((i4 * 0.064091 - 200) * 100) Mod 256)
'补水压力
i5 = Val(Text5.Text)
a(10) = Int((i5 * 0.000122 * 100) / 256)
a(11) = Int((i5 * 0.000122 * 100) Mod 256)
'补水流量
i6 = Val(Text6.Text)
a(12) = Int((i6) / 256)
a(13) = Int((i6) Mod 256)
'回水温度
i7 = Val(Text7.Text)
a(14) = Int(((i7 * 0.064091 - 200) * 100) / 256)
a(15) = Int(((i7 * 0.064091 - 200) * 100) Mod 256)
'回水压力
i8 = Val(Text8.Text)
a(16) = Int((i8 * 0.000122 * 100) / 256)
a(17) = Int((i8 * 0.000122 * 100) Mod 256)
'回水流量
i9 = Val(Text9.Text)
a(18) = Int((i9) / 256)
a(19) = Int((i9) Mod 256)
'供水累计流量
i10 = Val(Text10.Text)
a(20) = Int((Int(i10 / (10000))) / 256)
a(21) = Int((Int(i10 / (10000))) Mod 256)
a(22) = Int((Int(i10 Mod (10000))) / 256)
a(23) = Int((Int(i10 Mod (10000))) Mod 256)
'回水累计流量
i11 = Val(Text11.Text)
a(24) = Int((Int(i11 / (10000))) / 256)
a(25) = Int((Int(i11 / (10000))) Mod 256)
a(26) = Int((Int(i11 Mod (10000))) / 256)
a(27) = Int((Int(i11 Mod (10000))) Mod 256)
'补水累计流量
i12 = Val(Text12.Text)
a(28) = Int((Int(i12 / (10000))) / 256)
a(29) = Int((Int(i12 / (10000))) Mod 256)
a(30) = Int((Int(i12 Mod (10000))) / 256)
a(31) = Int((Int(i12 Mod (10000))) Mod 256)
i13 = Val(Text13.Text)
i14 = Val(Text14.Text)
i15 = Val(Text15.Text)
i16 = Val(Text16.Text)
i17 = Val(Text17.Text)
a(32) = (i17 + 2 * i16 + 4 * i15 + 8 * i14 + 16 * i13)
'供水热量(GJ)
i18 = Val(Text18.Text)
a(33) = Int((Int(i18 / (10000))) / 256)
a(34) = Int((Int(i18 / (10000))) Mod 256)
a(35) = Int((Int(i18 Mod (10000))) / 256)
a(36) = Int((Int(i18 Mod (10000))) Mod 256)
'回水流量
i19 = Val(Text19.Text)
a(37) = Int((i19) / 256)
a(38) = Int((i19) Mod 256)
If (MSComm1.PortOpen = True) Then
MSComm1.Output = a
MSComm1.InBufferCount = 0
End If
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -