frmwiretest.frm
来自「电梯检测系统是对电梯性能进行检测的系统。是一个用来学习的程序。」· FRM 代码 · 共 1,274 行 · 第 1/3 页
FRM
1,274 行
VERSION 5.00
Object = "{648A5603-2C6E-101B-82B6-000000000014}#1.1#0"; "MSCOMM32.OCX"
Object = "{3B7C8863-D78F-101B-B9B5-04021C009402}#1.2#0"; "RICHTX32.OCX"
Begin VB.Form FrmWireTest
Appearance = 0 'Flat
BackColor = &H00A3766D&
Caption = "Wire Test"
ClientHeight = 8595
ClientLeft = 615
ClientTop = 270
ClientWidth = 11880
ClipControls = 0 'False
ControlBox = 0 'False
BeginProperty Font
Name = "Arial"
Size = 10.5
Charset = 0
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Icon = "FrmWireTest.frx":0000
MDIChild = -1 'True
PaletteMode = 1 'UseZOrder
ScaleHeight = 573
ScaleMode = 3 'Pixel
ScaleWidth = 792
WindowState = 2 'Maximized
Begin VB.CommandButton TestFinishCmd
Caption = "Test Finished"
BeginProperty Font
Name = "Arial"
Size = 12
Charset = 0
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 540
Left = 9480
TabIndex = 11
Top = 3360
Width = 1995
End
Begin VB.CommandButton StartCmd
Caption = "Start Test"
BeginProperty Font
Name = "Arial"
Size = 12
Charset = 0
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 540
Left = 9480
TabIndex = 10
Top = 2160
Width = 1995
End
Begin RichTextLib.RichTextBox TestResult
Height = 2640
Left = 270
TabIndex = 9
Top = 5265
Width = 8775
_ExtentX = 15478
_ExtentY = 4657
_Version = 393217
BackColor = 12632256
BorderStyle = 0
ScrollBars = 3
Appearance = 0
TextRTF = $"FrmWireTest.frx":0442
BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851}
Name = "Arial"
Size = 14.25
Charset = 0
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
End
Begin RichTextLib.RichTextBox WireInput
Height = 2385
Left = 270
TabIndex = 8
Top = 2280
Width = 8745
_ExtentX = 15425
_ExtentY = 4207
_Version = 393217
BackColor = 12632256
BorderStyle = 0
Enabled = -1 'True
ScrollBars = 3
Appearance = 0
TextRTF = $"FrmWireTest.frx":0505
BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851}
Name = "Arial"
Size = 14.25
Charset = 0
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
End
Begin MSCommLib.MSComm ReadCom
Left = 7080
Top = 1080
_ExtentX = 1005
_ExtentY = 1005
_Version = 393216
DTREnable = -1 'True
BaudRate = 19200
ParitySetting = 2
StopBits = 2
InputMode = 1
End
Begin VB.Label Label1
AutoSize = -1 'True
BackStyle = 0 'Transparent
Caption = "Smart J Wiring Testing"
BeginProperty Font
Name = "Arial"
Size = 15.75
Charset = 0
Weight = 700
Underline = 0 'False
Italic = -1 'True
Strikethrough = 0 'False
EndProperty
ForeColor = &H00FFFF80&
Height = 360
Left = 8400
TabIndex = 12
Top = 960
Width = 3480
End
Begin VB.Image Image5
Height = 1110
Left = 240
Picture = "FrmWireTest.frx":05C8
Top = 360
Width = 6750
End
Begin VB.Line Line2
BorderColor = &H80000000&
Index = 3
X1 = 797
X2 = 797
Y1 = 5
Y2 = 605
End
Begin VB.Line Line2
BorderColor = &H00E0E0E0&
BorderWidth = 3
Index = 2
X1 = 798
X2 = 798
Y1 = 2
Y2 = 602
End
Begin VB.Line Line2
BorderColor = &H00E0E0E0&
BorderWidth = 3
Index = 1
X1 = 0
X2 = 0
Y1 = -2
Y2 = 598
End
Begin VB.Line Line2
BorderColor = &H80000000&
Index = 0
X1 = 2
X2 = 2
Y1 = 2
Y2 = 602
End
Begin VB.Line Line1
BorderColor = &H00E0E0E0&
BorderWidth = 2
Index = 1
X1 = 0
X2 = 810
Y1 = 0
Y2 = 0
End
Begin VB.Line Line1
BorderColor = &H80000004&
Index = 0
X1 = 1
X2 = 811
Y1 = 1
Y2 = 1
End
Begin VB.Label TitleLabel
AutoSize = -1 'True
BackColor = &H80000007&
BackStyle = 0 'Transparent
Caption = "Wire Test Result..."
BeginProperty Font
Name = "Arial"
Size = 10.5
Charset = 0
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ForeColor = &H8000000B&
Height = 240
Index = 2
Left = 360
TabIndex = 3
Top = 4920
Width = 1905
End
Begin VB.Label TestLineNumLable
Alignment = 2 'Center
BackColor = &H00B7DAAD&
BackStyle = 0 'Transparent
Caption = "1"
BeginProperty Font
Name = "Arial"
Size = 10.5
Charset = 0
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ForeColor = &H00FFFFFF&
Height = 255
Left = 6720
TabIndex = 2
Top = 1950
Width = 525
End
Begin VB.Label TitleLabel
AutoSize = -1 'True
BackColor = &H80000007&
BackStyle = 0 'Transparent
Caption = "Current Testing Step Num:"
BeginProperty Font
Name = "Arial"
Size = 10.5
Charset = 0
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ForeColor = &H8000000B&
Height = 240
Index = 1
Left = 3840
TabIndex = 1
Top = 1950
Width = 2775
End
Begin VB.Label TitleLabel
AutoSize = -1 'True
BackColor = &H80000007&
BackStyle = 0 'Transparent
Caption = "Wire Input(Get from test file)"
BeginProperty Font
Name = "Arial"
Size = 10.5
Charset = 0
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ForeColor = &H8000000B&
Height = 240
Index = 0
Left = 360
TabIndex = 0
Top = 1950
Width = 3000
End
Begin VB.Label Label6
BackColor = &H00400000&
Height = 300
Index = 0
Left = 270
TabIndex = 6
Top = 1950
Width = 8730
End
Begin VB.Label Label5
BackColor = &H00FFFFFF&
ForeColor = &H00FFFFFF&
Height = 2775
Index = 0
Left = 240
TabIndex = 4
Top = 1920
Width = 8805
End
Begin VB.Label Label6
BackColor = &H00400000&
Height = 315
Index = 1
Left = 270
TabIndex = 7
Top = 4920
Width = 8775
End
Begin VB.Label Label5
BackColor = &H80000009&
Height = 3045
Index = 1
Left = 240
TabIndex = 5
Top = 4890
Width = 8835
End
Begin VB.Menu FuncTestFuncMenu
Caption = "FuncPop"
Visible = 0 'False
Begin VB.Menu FuncTestMenu
Caption = "Func Test(&F)"
End
Begin VB.Menu WireTestMenu
Caption = "Wire Test(&L)"
End
Begin VB.Menu mnfg4
Caption = "-"
End
Begin VB.Menu mnuTestPrj
Caption = "Test Project(&E)"
End
Begin VB.Menu mnuFg3
Caption = "-"
End
Begin VB.Menu mnuReport
Caption = "Report View(&R)"
End
Begin VB.Menu mnuFg2
Caption = "-"
End
Begin VB.Menu mnuOnlineHelp
Caption = "Online Help"
Shortcut = {F1}
End
Begin VB.Menu mnuAbout
Caption = "About Me(&A)..."
End
Begin VB.Menu mnuFg1
Caption = "-"
End
Begin VB.Menu mnuExit
Caption = "Exit System"
Shortcut = ^X
End
End
End
Attribute VB_Name = "FrmWireTest"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
Private WireNum As Integer 'count the wires number
Private WireTstPass(3) As Boolean 'whether every wire test passed
Private WireTstBegin As Boolean 'Whether wire test was done
Private WireTestOn As Boolean 'wire test is still running
Private Function bolReadPlcB_03(ByVal iDeviceID As Integer, ByVal iAddr As Integer, ByVal iLen As Integer, vRetAryB As Variant) As Boolean
'作者:Henry
'目的:
' 读取Plc中选定区段的数据
'传入:
' iFuncIndex:功能号
' iPlc:欲读取之Plc Id
' iAddr:欲读取数据的起始地址
' iLen:欲读取线圈或寄存器的个数(iLen=1代表读取2Bytes)
' vRetAryB:传回区段数据的Byte数组
'传回:
' True:成功
' False:失败
'注:读取之区段数据将存入vRetAryB中
' 已修改成以二进位方式传送
' 有应答正确性检核
Dim sTime, cTime As Single
Dim Dummy As Integer
Dim bSndAry(7) As Byte
Dim vCrc As Variant
Dim vRetStr As Variant
Dim SndStr, CrcStr As String
Dim iHByte, iLByte As Integer
Dim iLenB As Integer '以Byte为单位的取得长度
iHByte = iAddr \ 256 '取商数
iLByte = iAddr Mod 256 '取余数
'将整数变量内容置入Byte变数组中
bSndAry(0) = iDeviceID
bSndAry(1) = 3
bSndAry(2) = iHByte
bSndAry(3) = iLByte
bSndAry(4) = iLen \ 256
bSndAry(5) = iLen Mod 256
vCrc = CrcB(bSndAry(), 6)
bSndAry(6) = vCrc(0)
bSndAry(7) = vCrc(1)
If ReadCom.PortOpen = False Then
ReadCom.PortOpen = True
End If
'清除input/output buffer
ReadCom.InBufferCount = 0
ReadCom.OutBufferCount = 0
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?