📄 frmtech2001.frm
字号:
BeginProperty Font
Name = "宋体"
Size = 9
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ForeColor = &H80000008&
Height = 495
Index = 82
Left = 5640
MouseIcon = "frmTech2001.frx":B858
MousePointer = 99 'Custom
TabIndex = 10
Top = 570
Width = 855
End
Begin VB.Label Label1
Appearance = 0 'Flat
BackColor = &H80000005&
BackStyle = 0 'Transparent
BeginProperty Font
Name = "宋体"
Size = 9
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ForeColor = &H80000008&
Height = 495
Index = 65
Left = 4350
MouseIcon = "frmTech2001.frx":BB62
MousePointer = 99 'Custom
TabIndex = 9
Top = 2520
Width = 855
End
Begin VB.Label Label1
Appearance = 0 'Flat
BackColor = &H80000005&
BackStyle = 0 'Transparent
BeginProperty Font
Name = "宋体"
Size = 9
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ForeColor = &H80000008&
Height = 495
Index = 64
Left = 3090
MouseIcon = "frmTech2001.frx":BE6C
MousePointer = 99 'Custom
TabIndex = 8
Top = 2490
Width = 855
End
Begin VB.Label Label1
Appearance = 0 'Flat
BackColor = &H80000005&
BackStyle = 0 'Transparent
BeginProperty Font
Name = "宋体"
Size = 9
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ForeColor = &H80000008&
Height = 495
Index = 63
Left = 1890
MouseIcon = "frmTech2001.frx":C176
MousePointer = 99 'Custom
TabIndex = 7
Top = 2520
Width = 855
End
Begin VB.Label Label4
BackColor = &H80000012&
Caption = "t"
BeginProperty Font
Name = "宋体"
Size = 21.75
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ForeColor = &H0000FF00&
Height = 375
Index = 3
Left = 14745
TabIndex = 6
Top = 2400
Width = 255
End
Begin VB.Label Label4
BackColor = &H80000012&
Caption = "t"
BeginProperty Font
Name = "宋体"
Size = 21.75
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ForeColor = &H0000FF00&
Height = 375
Index = 2
Left = 14745
TabIndex = 5
Top = 1920
Width = 255
End
Begin VB.Label Label4
BackColor = &H80000012&
Caption = "t/h"
BeginProperty Font
Name = "宋体"
Size = 21.75
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ForeColor = &H0000FF00&
Height = 375
Index = 1
Left = 14280
TabIndex = 4
Top = 1320
Width = 720
End
Begin VB.Label Label4
BackColor = &H80000012&
Caption = "t"
BeginProperty Font
Name = "宋体"
Size = 21.75
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ForeColor = &H0000FF00&
Height = 375
Index = 4
Left = 14760
TabIndex = 3
Top = 2880
Width = 255
End
Begin VB.Label Label1
Appearance = 0 'Flat
BackColor = &H80000005&
BackStyle = 0 'Transparent
DragIcon = "frmTech2001.frx":C480
BeginProperty Font
Name = "宋体"
Size = 9
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ForeColor = &H80000008&
Height = 495
Index = 80
Left = 5610
MouseIcon = "frmTech2001.frx":C78A
MousePointer = 99 'Custom
TabIndex = 2
Top = 2520
Width = 855
End
End
End
End
Attribute VB_Name = "frmTech2001"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
'面板灯状态
' 7: FREE 6: FREE 5: FREE 4: RUN 3: ZERO 2: SPAN 1: ALARM 0: READY
'缺省属性值:
Const RThreshold2000 = 93 '2000仪表
Const CommCounterSize = 20
Const m_def_DenyManipulate As Boolean = False
Const Settings_N As String = "9600,n,8,1"
Event EvCommInterupt(ByVal CommEvent As Long, ByVal Appear As Boolean) '程序通信中断
Event EvAddrInterupt(ByVal ScanAddr As Integer, ByVal Appear As Boolean) '仪表通信中断
Event EvAlarm(ByVal ScanAddr As Integer, ByVal Appear As Boolean) '仪表报警
Event EvZeroComplete(ByVal ScanAddr As Integer, ByVal OldZero As Double, ByVal NewZero As Double, ByVal ZeroError As Double)
Event EvOnComm(ByVal ScanAddr As Integer, ByVal Total As Double, ByVal Flow As Double, ByVal Speed As Double, ByVal SetValue As Double)
Private Type TKeyCode
KeyCode As Byte '面板键号
bKeyClick As Boolean '是否点击面板键指令
End Type
Private KeyValue As TKeyCode
'
Dim CommCounter() As Integer
Dim m_LogDiretory As String
Dim m_DenyManipulate As Boolean
Dim m_MTCount As Integer '= 4 '全貌中的仪表处理总数
Dim TechNo As Integer '所选择的仪表显示
Dim XRVisible As Boolean
Dim CommInterupt As Boolean '通信中断出现
Dim AlarmAppear() As Boolean '仪表报警出现
Dim AddrInteruptAppear() As Boolean '仪表通信中断出现
Dim isCalibration() As Boolean '是否校验
'零点
Private Zero_Wucha As String
Private Zero_New As String
Private Zero_Old As String
Private Zero_Save As Boolean '存储标志
Public Property Get DenyManipulate() As Boolean
DenyManipulate = m_DenyManipulate
End Property
Public Property Let DenyManipulate(ByVal New_DenyManipulate As Boolean)
m_DenyManipulate = New_DenyManipulate
End Property
Public Sub OpenCommPort(Optional ByVal Port As Integer = 0)
'打开串口通信,使用:程序开始,或重新给出新的串口
If Port = 0 Then Port = MSComm2.CommPort
Call meInitComm(MSComm2, "9600,n,8,1", Port, RThreshold2000) 'TechUSEnlish仪表
tmrCode.Enabled = True
End Sub
Private Sub meInitComm(Comm As MSComm, _
Optional sSettings As String = "9600,n,8,1", _
Optional iCommPort As Integer = 1, _
Optional iRtheshold As Integer)
'用于 Form_Load
'*************************************************************
'通信初始化
'参数:
' Comm: 通信控件
' sSettings: 通信设置
' iCommPort: 串口
' iRtheshold: 阀值
'*************************************************************
On Error GoTo err1:
If Comm.PortOpen = True Then Comm.PortOpen = False
Comm.Settings = sSettings
Comm.CommPort = iCommPort
Comm.InputLen = 0
Comm.RThreshold = iRtheshold
' Debug.Assert False
If Comm.PortOpen = False Then
Comm.PortOpen = True
If Comm.PortOpen = False Then
MsgBox "通信端口不能打开,或被占用!", vbExclamation, "通信错误"
End If
End If
Comm.InBufferCount = 0
Comm.OutBufferCount = 0
Exit Sub
err1:
MsgBox "通信端口不能打开,或被占用!" & vbCrLf & Err.Description, vbExclamation, "通信错误"
Err.Clear
Resume Next
End Sub
Private Sub cmdClose_Click()
XRVisible = False
Me.Hide
End Sub
Private Sub Form_Activate()
XRVisible = True
End Sub
Private Sub Form_Load()
'
MSComm2.CommPort = 1 '缺省串口
m_LogDiretory = App.Path
m_DenyManipulate = m_def_DenyManipulate
m_MTCount = CountTechs
Dim i As Integer
ReDim CommCounter(1 To m_MTCount) As Integer '通信计数器
ReDim AlarmAppear(1 To m_MTCount) As Boolean '仪表报警出现
ReDim AddrInteruptAppear(1 To m_MTCount) As Boolean '仪表通信中断出现
ReDim isCalibration(1 To m_MTCount) As Boolean '是否校验
'
m_MTCount = TechCount
cmbPortNo.Clear
For i = 1 To m_MTCount
cmbPortNo.AddItem NameTech(modAddr.LogicAddr(i))
Next i
cmbPortNo.ListIndex = 0
TechNo = 1
End Sub
Private Sub Form_QueryUnload(Cancel As Integer, UnloadMode As Integer)
On Error Resume Next
If UnloadMode = vbFormControlMenu Then
Cancel = 1
XRVisible = False
Me.Hide
Else
Call CloseComm
End If
End Sub
Public Sub CloseComm()
On Error Resume Next
tmrCode.Enabled = False
If MSComm2.PortOpen = True Then
MSComm2.PortOpen = Fa
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -