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

📄 pc-plc.frm

📁 PLC应用举例
💻 FRM
字号:
VERSION 5.00
Object = "{648A5603-2C6E-101B-82B6-000000000014}#1.1#0"; "MSCOMM32.OCX"
Begin VB.Form Form1 
   Caption         =   "Form1"
   ClientHeight    =   2490
   ClientLeft      =   45
   ClientTop       =   345
   ClientWidth     =   3750
   LinkTopic       =   "Form1"
   ScaleHeight     =   8595
   ScaleWidth      =   11880
   StartUpPosition =   3  '窗口缺省
   Begin MSCommLib.MSComm MSComm1 
      Left            =   360
      Top             =   2280
      _ExtentX        =   1005
      _ExtentY        =   1005
      _Version        =   393216
   End
   Begin VB.Timer Timer1 
      Left            =   360
      Top             =   1200
   End
   Begin VB.CommandButton Command3 
      Caption         =   "退出"
      Height          =   372
      Left            =   4440
      TabIndex        =   4
      Top             =   3120
      Width           =   1332
   End
   Begin VB.CommandButton Command2 
      Caption         =   "清除文本信息"
      Height          =   372
      Left            =   2880
      TabIndex        =   3
      Top             =   3120
      Width           =   1332
   End
   Begin VB.CommandButton Command1 
      Caption         =   "向PLC发送开始"
      Height          =   372
      Left            =   1320
      TabIndex        =   2
      Top             =   3120
      Width           =   1332
   End
   Begin VB.TextBox Text1 
      Height          =   2052
      Left            =   1320
      TabIndex        =   1
      Text            =   "Text1"
      Top             =   840
      Width           =   4452
   End
   Begin VB.Label Label1 
      Caption         =   "微机向PLC发送的数据"
      Height          =   252
      Left            =   2280
      TabIndex        =   0
      Top             =   480
      Width           =   2052
   End
End
Attribute VB_Name = "Form1"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Dim a$
Private Sub Form_Load()
Form1.WindowState = 2
MSComm1.CommPort = 1
MSComm1.Settings = "9600,n,8,1"
If MSComm1.PortOpen = True Then
MSComm1.PortOpen = False
Else
End If
Timer1.Interval = 1000
Timer1.Enabled = False
Text1.Text = ""
End Sub
Private Sub Command1_Click()
Timer1.Enabled = True
End Sub
Private Sub Command2_Click()
Text1.Text = ""
End Sub
Private Sub Command3_Click()
Unload Me
End Sub
Private Sub Timer1_Timer()
MSComm1.PortOpen = True
a$ = Text1.Text + Chr$(10) + Chr$(13)
MSComm1.Output = a$
MSComm1.PortOpen = False
End Sub

⌨️ 快捷键说明

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