📄 frmmodslv.frm
字号:
VERSION 5.00
Object = "{633262C2-113D-11D3-82A8-0080C802724C}#4.0#0"; "ModcomSE.ocx"
Begin VB.Form ModSlvTst
Caption = "Modbus Slave App"
ClientHeight = 4800
ClientLeft = 2715
ClientTop = 1470
ClientWidth = 6585
LinkTopic = "Form1"
ScaleHeight = 4800
ScaleWidth = 6585
Begin ModBusOCXCntrlSmplEX.ModCom ModCom1
Left = 450
Top = 2040
_ExtentX = 847
_ExtentY = 873
BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851}
Name = "MS Sans Serif"
Size = 8.25
Charset = 0
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ScanWriteIOTimerInterval= 250
End
Begin VB.TextBox Text2
Height = 360
Left = 3300
TabIndex = 4
Text = "12"
Top = 2370
Width = 825
End
Begin VB.CommandButton SetModData
Caption = "Set slave data"
Height = 465
Left = 4590
TabIndex = 3
Top = 2355
Width = 915
End
Begin VB.CommandButton GetModData
Caption = "Get Slave data"
Height = 465
Left = 4590
TabIndex = 2
Top = 1815
Width = 915
End
Begin VB.TextBox Text1
Height = 375
Left = 3270
TabIndex = 1
Text = "40010"
Top = 1770
Width = 885
End
Begin VB.CommandButton OpenPort
Caption = "Open Port"
Height = 495
Left = 240
TabIndex = 0
Top = 285
Width = 1275
End
Begin VB.Label Label3
Caption = "To use: Set device address, comm baud, etc, open port. A request sent by a Modbus master will get a response from this control"
Height = 720
Left = 1440
TabIndex = 7
Top = 3120
Width = 3105
End
Begin VB.Label Label2
Alignment = 1 'Right Justify
Caption = "Data"
Height = 330
Left = 2220
TabIndex = 6
Top = 2340
Width = 840
End
Begin VB.Label Label1
Alignment = 1 'Right Justify
Caption = "Address"
Height = 315
Left = 2115
TabIndex = 5
Top = 1845
Width = 945
End
End
Attribute VB_Name = "ModSlvTst"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
'this sets/ reads data to internal mod slave table
'and is available to be read by mod master
'fill internal data table read by your process
'==============================================
Private Sub Form_Load()
'ModCom1.PortOpen = True
End Sub
Private Sub GetModData_Click()
'this reads data from internal mod slave table
Dim addr As Variant
Dim dataV As Long
addr = Text1
ModCom1.ReadModData addr, dataV
Text2 = dataV
End Sub
Private Sub OpenPort_Click()
ModCom1.PortOpen = True
End Sub
Private Sub SetModData_Click()
'this sets data to internal mod slave table
'and is available to be read by mod master
'use this to fill internal data table read by your process
Dim addr As Variant
Dim dataV As Long
addr = Text1
dataV = Text2
ModCom1.SetModData addr, dataV
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -