⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 nodes.frm

📁 RS485服务器程序,实现设置Nodes,检测Nodes以及传输数据
💻 FRM
字号:
VERSION 5.00
Begin VB.Form frmNodes 
   Caption         =   "Serial Port Complete"
   ClientHeight    =   3144
   ClientLeft      =   48
   ClientTop       =   336
   ClientWidth     =   5448
   LinkTopic       =   "Form1"
   ScaleHeight     =   3144
   ScaleWidth      =   5448
   StartUpPosition =   3  'Windows Default
   Begin VB.Frame fraNodes 
      Height          =   2892
      Left            =   120
      TabIndex        =   0
      Top             =   120
      Width           =   5172
      Begin VB.CommandButton cmdOK 
         Caption         =   "OK"
         Height          =   492
         Left            =   4080
         TabIndex        =   12
         Top             =   2160
         Width           =   972
      End
      Begin VB.Frame fraNodeActive 
         Caption         =   "Active"
         Height          =   2292
         Left            =   3240
         TabIndex        =   4
         Top             =   360
         Width           =   732
         Begin VB.CheckBox chkNodeActive 
            Height          =   252
            Index           =   7
            Left            =   120
            TabIndex        =   11
            Top             =   1920
            Width           =   252
         End
         Begin VB.CheckBox chkNodeActive 
            Height          =   252
            Index           =   6
            Left            =   120
            TabIndex        =   10
            Top             =   1680
            Width           =   252
         End
         Begin VB.CheckBox chkNodeActive 
            Height          =   252
            Index           =   5
            Left            =   120
            TabIndex        =   9
            Top             =   1440
            Width           =   252
         End
         Begin VB.CheckBox chkNodeActive 
            Height          =   252
            Index           =   4
            Left            =   120
            TabIndex        =   8
            Top             =   1200
            Width           =   252
         End
         Begin VB.CheckBox chkNodeActive 
            Height          =   252
            Index           =   3
            Left            =   120
            TabIndex        =   7
            Top             =   960
            Width           =   252
         End
         Begin VB.CheckBox chkNodeActive 
            Height          =   252
            Index           =   2
            Left            =   120
            TabIndex        =   6
            Top             =   720
            Width           =   252
         End
         Begin VB.CheckBox chkNodeActive 
            Height          =   252
            Index           =   1
            Left            =   120
            TabIndex        =   5
            Top             =   480
            Width           =   252
         End
         Begin VB.Label lblMaster 
            Caption         =   "Master"
            Height          =   252
            Left            =   120
            TabIndex        =   37
            Top             =   240
            Width           =   732
         End
      End
      Begin VB.Frame fraNodeAddress 
         Caption         =   "Address"
         Height          =   2292
         Left            =   2160
         TabIndex        =   3
         Top             =   360
         Width           =   1092
         Begin VB.ComboBox cboAddress 
            Height          =   288
            Index           =   7
            Left            =   120
            Style           =   2  'Dropdown List
            TabIndex        =   27
            Top             =   1920
            Width           =   852
         End
         Begin VB.ComboBox cboAddress 
            Height          =   288
            Index           =   6
            Left            =   120
            Style           =   2  'Dropdown List
            TabIndex        =   26
            Top             =   1680
            Width           =   852
         End
         Begin VB.ComboBox cboAddress 
            Height          =   288
            Index           =   5
            Left            =   120
            Style           =   2  'Dropdown List
            TabIndex        =   25
            Top             =   1440
            Width           =   852
         End
         Begin VB.ComboBox cboAddress 
            Height          =   288
            Index           =   4
            Left            =   120
            Style           =   2  'Dropdown List
            TabIndex        =   24
            Top             =   1200
            Width           =   852
         End
         Begin VB.ComboBox cboAddress 
            Height          =   288
            Index           =   3
            Left            =   120
            Style           =   2  'Dropdown List
            TabIndex        =   23
            Top             =   960
            Width           =   852
         End
         Begin VB.ComboBox cboAddress 
            Height          =   288
            Index           =   2
            Left            =   120
            Style           =   2  'Dropdown List
            TabIndex        =   22
            Top             =   720
            Width           =   852
         End
         Begin VB.ComboBox cboAddress 
            Height          =   288
            Index           =   1
            Left            =   120
            Style           =   2  'Dropdown List
            TabIndex        =   21
            Top             =   480
            Width           =   852
         End
         Begin VB.ComboBox cboAddress 
            Height          =   288
            Index           =   0
            Left            =   120
            Style           =   2  'Dropdown List
            TabIndex        =   20
            Top             =   240
            Width           =   852
         End
      End
      Begin VB.Frame fraNodeCPU 
         Caption         =   "CPU"
         Height          =   2292
         Left            =   720
         TabIndex        =   2
         Top             =   360
         Width           =   1452
         Begin VB.ComboBox cboCPU 
            Height          =   288
            Index           =   7
            Left            =   120
            Style           =   2  'Dropdown List
            TabIndex        =   19
            Top             =   1920
            Width           =   1212
         End
         Begin VB.ComboBox cboCPU 
            Height          =   288
            Index           =   6
            Left            =   120
            Style           =   2  'Dropdown List
            TabIndex        =   18
            Top             =   1680
            Width           =   1212
         End
         Begin VB.ComboBox cboCPU 
            Height          =   288
            Index           =   5
            Left            =   120
            Style           =   2  'Dropdown List
            TabIndex        =   17
            Top             =   1440
            Width           =   1212
         End
         Begin VB.ComboBox cboCPU 
            Height          =   288
            Index           =   4
            Left            =   120
            Style           =   2  'Dropdown List
            TabIndex        =   16
            Top             =   1200
            Width           =   1212
         End
         Begin VB.ComboBox cboCPU 
            Height          =   288
            Index           =   3
            Left            =   120
            Style           =   2  'Dropdown List
            TabIndex        =   15
            Top             =   960
            Width           =   1212
         End
         Begin VB.ComboBox cboCPU 
            Height          =   288
            Index           =   2
            Left            =   120
            Style           =   2  'Dropdown List
            TabIndex        =   14
            Top             =   720
            Width           =   1212
         End
         Begin VB.ComboBox cboCPU 
            Height          =   288
            Index           =   1
            Left            =   120
            Style           =   2  'Dropdown List
            TabIndex        =   13
            Top             =   480
            Width           =   1212
         End
         Begin VB.Label lblCPU0 
            Caption         =   "PC"
            Height          =   252
            Left            =   120
            TabIndex        =   36
            Top             =   240
            Width           =   1212
         End
      End
      Begin VB.Frame fraNodeNumbers 
         Caption         =   "Node"
         Height          =   2292
         Left            =   120
         TabIndex        =   1
         Top             =   360
         Width           =   612
         Begin VB.Label lblNodeNumber 
            BackColor       =   &H80000005&
            BorderStyle     =   1  'Fixed Single
            Caption         =   "7"
            Height          =   252
            Index           =   7
            Left            =   120
            TabIndex        =   35
            Top             =   1920
            Width           =   372
         End
         Begin VB.Label lblNodeNumber 
            BackColor       =   &H80000005&
            BorderStyle     =   1  'Fixed Single
            Caption         =   "6"
            Height          =   252
            Index           =   6
            Left            =   120
            TabIndex        =   34
            Top             =   1680
            Width           =   372
         End
         Begin VB.Label lblNodeNumber 
            BackColor       =   &H80000005&
            BorderStyle     =   1  'Fixed Single
            Caption         =   "5"
            Height          =   252
            Index           =   5
            Left            =   120
            TabIndex        =   33
            Top             =   1440
            Width           =   372
         End
         Begin VB.Label lblNodeNumber 
            BackColor       =   &H80000005&
            BorderStyle     =   1  'Fixed Single
            Caption         =   "4"
            Height          =   252
            Index           =   4
            Left            =   120
            TabIndex        =   32
            Top             =   1200
            Width           =   372
         End
         Begin VB.Label lblNodeNumber 
            BackColor       =   &H80000005&
            BorderStyle     =   1  'Fixed Single
            Caption         =   "3"
            Height          =   252
            Index           =   3
            Left            =   120
            TabIndex        =   31
            Top             =   960
            Width           =   372
         End
         Begin VB.Label lblNodeNumber 
            BackColor       =   &H80000005&
            BorderStyle     =   1  'Fixed Single
            Caption         =   "2"
            Height          =   252
            Index           =   2
            Left            =   120
            TabIndex        =   30
            Top             =   720
            Width           =   372
         End
         Begin VB.Label lblNodeNumber 
            BackColor       =   &H80000005&
            BorderStyle     =   1  'Fixed Single
            Caption         =   "1"
            Height          =   252
            Index           =   1
            Left            =   120
            TabIndex        =   29
            Top             =   480
            Width           =   372
         End
         Begin VB.Label lblNodeNumber 
            BackColor       =   &H80000005&
            BorderStyle     =   1  'Fixed Single
            Caption         =   "0"
            Height          =   252
            Index           =   0
            Left            =   120
            TabIndex        =   28
            Top             =   240
            Width           =   372
         End
      End
   End
End
Attribute VB_Name = "frmNodes"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
'Enables the user to specify the type & address of remote nodes.

Private Sub cmdOK_Click()
Call frmMain.GetNewNodeSettings
Hide
End Sub

Private Sub Form_Load()
Call InitializeNodeCpuComboBoxes
Call InitializeNodeAddressComboBoxes
Call InitializeNodeActiveCheckBoxes
Call GetSettings
Call frmMain.GetNewNodeSettings
End Sub

Private Sub Form_Unload(Cancel As Integer)
Call SaveSettings
End Sub

Private Sub GetSettings()
Dim Count As Integer
    cboAddress(Count).ListIndex = _
        GetSetting(ProjectName, "Startup", "NodeAddress" & CStr(0), 0)
For Count = 1 To 7
    cboCPU(Count).ListIndex = _
        GetSetting(ProjectName, "Startup", "NodeCPU" & CStr(Count), 0)
    cboAddress(Count).ListIndex = _
        GetSetting(ProjectName, "Startup", "NodeAddress" & CStr(Count), 0)
    chkNodeActive(Count).Value = _
        GetSetting(ProjectName, "Startup", "NodeActive" & CStr(Count), 1)
Next Count
End Sub

Private Sub InitializeNodeActiveCheckBoxes()
Dim Count As Integer
For Count = 1 To 7
    chkNodeActive(Count).Value = 1
Next Count

End Sub

Private Sub InitializeNodeAddressComboBoxes()
Dim Count As Integer
Dim Address As Integer
'Address range is 67h to 6Eh
For Count = 0 To 7
    For Address = &H67 To &H6E
        cboAddress(Count).AddItem Hex$(Address)
    Next Address
Next Count
For Count = 0 To 7
    cboAddress(Count).ListIndex = Count
Next Count
End Sub

Private Sub InitializeNodeCpuComboBoxes()
Dim Count As Integer
For Count = 1 To 7
    cboCPU(Count).AddItem "PC"
    cboCPU(Count).AddItem "Stamp"
Next Count
End Sub

Private Sub SaveSettings()
Dim Count As Integer
SaveSetting ProjectName, "Startup", _
    "NodeAddress" & CStr(0), cboAddress(0).ListIndex
For Count = 1 To 7
    SaveSetting ProjectName, "Startup", _
        "NodeCPU" & CStr(Count), cboCPU(Count).ListIndex
    SaveSetting ProjectName, "Startup", _
        "NodeAddress" & CStr(Count), cboAddress(Count).ListIndex
    SaveSetting ProjectName, "Startup", _
        "NodeActive" & CStr(Count), chkNodeActive(Count).Value
Next Count
End Sub


⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -