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

📄 form3.frm

📁 三菱PLC上位机程序详细例子
💻 FRM
字号:
VERSION 5.00
Object = "{648A5603-2C6E-101B-82B6-000000000014}#1.1#0"; "MSCOMM32.OCX"
Begin VB.Form Form3 
   ClientHeight    =   4500
   ClientLeft      =   60
   ClientTop       =   345
   ClientWidth     =   9990
   LinkTopic       =   "Form3"
   ScaleHeight     =   4500
   ScaleWidth      =   9990
   StartUpPosition =   3  '窗口缺省
   Begin VB.TextBox Text4 
      Appearance      =   0  'Flat
      Height          =   345
      Left            =   3360
      TabIndex        =   12
      Text            =   "0"
      Top             =   2430
      Width           =   1125
   End
   Begin VB.TextBox Text3 
      Appearance      =   0  'Flat
      Height          =   345
      Left            =   3360
      TabIndex        =   11
      Text            =   "0"
      Top             =   2010
      Width           =   1125
   End
   Begin VB.TextBox Text2 
      Appearance      =   0  'Flat
      Height          =   345
      Left            =   3360
      TabIndex        =   10
      Text            =   "0"
      Top             =   1590
      Width           =   1125
   End
   Begin VB.CommandButton Command4 
      Caption         =   "写D"
      Height          =   345
      Left            =   1710
      TabIndex        =   9
      Top             =   1590
      Width           =   1395
   End
   Begin VB.CommandButton Command3 
      Caption         =   "读D"
      Height          =   345
      Left            =   1740
      TabIndex        =   5
      Top             =   3030
      Width           =   1395
   End
   Begin VB.TextBox Text1 
      Height          =   315
      Left            =   3330
      TabIndex        =   4
      Text            =   "1"
      Top             =   870
      Width           =   1125
   End
   Begin VB.CommandButton Command2 
      Caption         =   "写所有的Y点"
      Height          =   375
      Left            =   4560
      TabIndex        =   3
      Top             =   840
      Width           =   1335
   End
   Begin VB.CommandButton Command1 
      Caption         =   "读所有的X点"
      Height          =   375
      Left            =   4560
      TabIndex        =   1
      Top             =   270
      Width           =   1335
   End
   Begin MSCommLib.MSComm MSComm1 
      Left            =   210
      Top             =   3540
      _ExtentX        =   1005
      _ExtentY        =   1005
      _Version        =   393216
      DTREnable       =   -1  'True
   End
   Begin VB.ComboBox Combo1 
      Height          =   300
      ItemData        =   "Form3.frx":0000
      Left            =   570
      List            =   "Form3.frx":0013
      TabIndex        =   0
      Text            =   "M"
      Top             =   1620
      Width           =   615
   End
   Begin VB.Label Label5 
      Caption         =   "请写入10进制数不胜数"
      Height          =   255
      Left            =   1440
      TabIndex        =   13
      Top             =   960
      Width           =   1935
   End
   Begin VB.Label Label4 
      Appearance      =   0  'Flat
      BackColor       =   &H80000005&
      BorderStyle     =   1  'Fixed Single
      ForeColor       =   &H80000008&
      Height          =   315
      Left            =   3300
      TabIndex        =   8
      Top             =   4050
      Width           =   1155
   End
   Begin VB.Label Label3 
      Appearance      =   0  'Flat
      BackColor       =   &H80000005&
      BorderStyle     =   1  'Fixed Single
      ForeColor       =   &H80000008&
      Height          =   315
      Left            =   3300
      TabIndex        =   7
      Top             =   3570
      Width           =   1155
   End
   Begin VB.Label Label2 
      Appearance      =   0  'Flat
      BackColor       =   &H80000005&
      BorderStyle     =   1  'Fixed Single
      ForeColor       =   &H80000008&
      Height          =   315
      Left            =   3300
      TabIndex        =   6
      Top             =   3060
      Width           =   1155
   End
   Begin VB.Label Label1 
      Appearance      =   0  'Flat
      BackColor       =   &H80000005&
      BorderStyle     =   1  'Fixed Single
      ForeColor       =   &H80000008&
      Height          =   255
      Left            =   3330
      TabIndex        =   2
      Top             =   330
      Width           =   1095
   End
End
Attribute VB_Name = "Form3"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False

Private Sub Command3_Click()
Dim j As Double
Dim A(4) As Double
Call WR(MSComm1, 0, 0, "D", 0, 3, A)
Label2.Caption = A(1)
Label3.Caption = A(2)
Label4.Caption = A(3)
End Sub

Private Sub Command4_Click()
Dim A(4) As Double
A(1) = Val(Text2.Text)
A(2) = Val(Text3.Text)
A(3) = Val(Text4.Text)
Call WW(MSComm1, 0, "D", 0, 3, A)
End Sub

Private Sub Form_Load()
Dim i As Boolean
i = OpenPort(MSComm1, 1) '初始化串口控件
End Sub
Private Sub Command1_Click()
Dim i As Boolean
Dim j As Double
j = BR(MSComm1, 0, 0, "X", 0, 8)  '读所有的X点
Label1.Caption = j
End Sub

Private Sub Command2_Click()
Call BW(MSComm1, 0, 0, "Y", 0, 8, Int(Text1.Text)) '写所有的Y点
End Sub

⌨️ 快捷键说明

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