Form1.frm
资源名称:VBPLCSC09.rar [点击查看]
上传用户:guilu56566
上传日期:2021-04-07
资源大小:1585k
文件大小:33k
源码类别:
家庭/个人应用
开发平台:
Visual Basic
- VERSION 5.00
- Object = "{648A5603-2C6E-101B-82B6-000000000014}#1.1#0"; "MSCOMM32.OCX"
- Begin VB.Form zngk
- Caption = "智能工控——董跃鹏"
- ClientHeight = 8940
- ClientLeft = 60
- ClientTop = 420
- ClientWidth = 11955
- LinkTopic = "Form1"
- MaxButton = 0 'False
- Picture = "Form1.frx":0000
- ScaleHeight = 447
- ScaleMode = 2 'Point
- ScaleWidth = 597.75
- Begin VB.CommandButton Command1
- Caption = "系统说明"
- Height = 495
- Left = 5400
- TabIndex = 53
- Top = 4560
- Width = 1095
- End
- Begin VB.TextBox Text1
- BackColor = &H00FFFFFF&
- ForeColor = &H00000000&
- Height = 375
- Left = 5880
- TabIndex = 51
- Top = 3480
- Width = 615
- End
- Begin VB.CommandButton Command2
- Caption = "建立通信"
- Height = 495
- Left = 5400
- TabIndex = 50
- Top = 3960
- Width = 1095
- End
- Begin VB.CommandButton m11
- Caption = "开"
- Height = 375
- Index = 6
- Left = 8520
- TabIndex = 49
- Top = 6960
- Width = 735
- End
- Begin VB.CommandButton m11
- Caption = "开"
- Height = 375
- Index = 5
- Left = 8520
- TabIndex = 48
- Top = 6360
- Width = 735
- End
- Begin VB.CommandButton m11
- Caption = "开"
- Height = 375
- Index = 4
- Left = 8520
- TabIndex = 47
- Top = 5760
- Width = 735
- End
- Begin VB.CommandButton m11
- Caption = "开"
- Height = 375
- Index = 3
- Left = 8520
- TabIndex = 46
- Top = 5160
- Width = 735
- End
- Begin VB.CommandButton m11
- Caption = "开"
- Height = 375
- Index = 2
- Left = 8520
- TabIndex = 45
- Top = 4560
- Width = 735
- End
- Begin VB.CommandButton m11
- Caption = "开"
- Height = 375
- Index = 1
- Left = 8520
- TabIndex = 44
- Top = 3960
- Width = 735
- End
- Begin VB.CommandButton d10
- Caption = "开"
- Height = 375
- Index = 6
- Left = 2640
- TabIndex = 43
- Top = 6840
- Width = 735
- End
- Begin VB.CommandButton d10
- Caption = "开"
- Height = 375
- Index = 5
- Left = 2640
- TabIndex = 42
- Top = 6240
- Width = 735
- End
- Begin VB.CommandButton d10
- Caption = "开"
- Height = 375
- Index = 4
- Left = 2640
- TabIndex = 41
- Top = 5640
- Width = 735
- End
- Begin VB.CommandButton d10
- Caption = "开"
- Height = 375
- Index = 3
- Left = 2640
- TabIndex = 40
- Top = 5040
- Width = 735
- End
- Begin VB.CommandButton d10
- Caption = "开"
- Height = 375
- Index = 2
- Left = 2640
- TabIndex = 39
- Top = 4440
- Width = 735
- End
- Begin VB.CommandButton d10
- Caption = "开"
- Height = 375
- Index = 1
- Left = 2640
- TabIndex = 38
- Top = 3840
- Width = 735
- End
- Begin VB.CommandButton m11
- Caption = "开"
- Height = 375
- Index = 0
- Left = 8520
- TabIndex = 25
- Top = 3360
- Width = 735
- End
- Begin VB.CommandButton sz2
- Caption = "设置"
- Height = 375
- Left = 6840
- TabIndex = 22
- Top = 7560
- Width = 4095
- End
- Begin VB.CommandButton d10
- Caption = "开"
- Height = 375
- Index = 0
- Left = 2640
- TabIndex = 6
- Top = 3240
- Width = 735
- End
- Begin VB.CommandButton sz1
- Caption = "设置"
- Height = 375
- Left = 960
- TabIndex = 1
- Top = 7560
- Width = 4095
- End
- Begin MSCommLib.MSComm MSComm1
- Left = 5640
- Top = 2760
- _ExtentX = 1005
- _ExtentY = 1005
- _Version = 393216
- DTREnable = -1 'True
- End
- Begin VB.Label Label7
- Alignment = 2 'Center
- BackStyle = 0 'Transparent
- BorderStyle = 1 'Fixed Single
- Caption = "端口"
- Height = 375
- Left = 5400
- TabIndex = 52
- Top = 3480
- Width = 495
- End
- Begin VB.Label m7
- AutoSize = -1 'True
- BackStyle = 0 'Transparent
- Caption = "门7"
- BeginProperty Font
- Name = "宋体"
- Size = 15
- Charset = 134
- Weight = 400
- Underline = -1 'True
- Italic = 0 'False
- Strikethrough = 0 'False
- EndProperty
- ForeColor = &H00FFFFFF&
- Height = 300
- Left = 6960
- TabIndex = 37
- Top = 6960
- Width = 450
- End
- Begin VB.Label m72
- AutoSize = -1 'True
- BackColor = &H000000FF&
- Caption = "关"
- BeginProperty Font
- Name = "宋体"
- Size = 15
- Charset = 134
- Weight = 400
- Underline = -1 'True
- Italic = 0 'False
- Strikethrough = 0 'False
- EndProperty
- ForeColor = &H00FFFFFF&
- Height = 300
- Left = 10080
- TabIndex = 36
- Top = 6960
- Width = 300
- End
- Begin VB.Label m6
- AutoSize = -1 'True
- BackStyle = 0 'Transparent
- Caption = "门6"
- BeginProperty Font
- Name = "宋体"
- Size = 15
- Charset = 134
- Weight = 400
- Underline = -1 'True
- Italic = 0 'False
- Strikethrough = 0 'False
- EndProperty
- ForeColor = &H00FFFFFF&
- Height = 300
- Left = 6960
- TabIndex = 35
- Top = 6360
- Width = 450
- End
- Begin VB.Label m62
- AutoSize = -1 'True
- BackColor = &H000000FF&
- Caption = "关"
- BeginProperty Font
- Name = "宋体"
- Size = 15
- Charset = 134
- Weight = 400
- Underline = -1 'True
- Italic = 0 'False
- Strikethrough = 0 'False
- EndProperty
- ForeColor = &H00FFFFFF&
- Height = 300
- Left = 10080
- TabIndex = 34
- Top = 6360
- Width = 300
- End
- Begin VB.Label m5
- AutoSize = -1 'True
- BackStyle = 0 'Transparent
- Caption = "门5"
- BeginProperty Font
- Name = "宋体"
- Size = 15
- Charset = 134
- Weight = 400
- Underline = -1 'True
- Italic = 0 'False
- Strikethrough = 0 'False
- EndProperty
- ForeColor = &H00FFFFFF&
- Height = 300
- Left = 6960
- TabIndex = 33
- Top = 5760
- Width = 450
- End
- Begin VB.Label m52
- AutoSize = -1 'True
- BackColor = &H000000FF&
- Caption = "关"
- BeginProperty Font
- Name = "宋体"
- Size = 15
- Charset = 134
- Weight = 400
- Underline = -1 'True
- Italic = 0 'False
- Strikethrough = 0 'False
- EndProperty
- ForeColor = &H00FFFFFF&
- Height = 300
- Left = 10080
- TabIndex = 32
- Top = 5760
- Width = 300
- End
- Begin VB.Label m4
- AutoSize = -1 'True
- BackStyle = 0 'Transparent
- Caption = "门4"
- BeginProperty Font
- Name = "宋体"
- Size = 15
- Charset = 134
- Weight = 400
- Underline = -1 'True
- Italic = 0 'False
- Strikethrough = 0 'False
- EndProperty
- ForeColor = &H00FFFFFF&
- Height = 300
- Left = 6960
- TabIndex = 31
- Top = 5160
- Width = 450
- End
- Begin VB.Label m42
- AutoSize = -1 'True
- BackColor = &H000000FF&
- Caption = "关"
- BeginProperty Font
- Name = "宋体"
- Size = 15
- Charset = 134
- Weight = 400
- Underline = -1 'True
- Italic = 0 'False
- Strikethrough = 0 'False
- EndProperty
- ForeColor = &H00FFFFFF&
- Height = 300
- Left = 10080
- TabIndex = 30
- Top = 5160
- Width = 300
- End
- Begin VB.Label m3
- AutoSize = -1 'True
- BackStyle = 0 'Transparent
- Caption = "门3"
- BeginProperty Font
- Name = "宋体"
- Size = 15
- Charset = 134
- Weight = 400
- Underline = -1 'True
- Italic = 0 'False
- Strikethrough = 0 'False
- EndProperty
- ForeColor = &H00FFFFFF&
- Height = 300
- Left = 6960
- TabIndex = 29
- Top = 4560
- Width = 450
- End
- Begin VB.Label m32
- AutoSize = -1 'True
- BackColor = &H000000FF&
- Caption = "关"
- BeginProperty Font
- Name = "宋体"
- Size = 15
- Charset = 134
- Weight = 400
- Underline = -1 'True
- Italic = 0 'False
- Strikethrough = 0 'False
- EndProperty
- ForeColor = &H00FFFFFF&
- Height = 300
- Left = 10080
- TabIndex = 28
- Top = 4560
- Width = 300
- End
- Begin VB.Label m2
- AutoSize = -1 'True
- BackStyle = 0 'Transparent
- Caption = "门2"
- BeginProperty Font
- Name = "宋体"
- Size = 15
- Charset = 134
- Weight = 400
- Underline = -1 'True
- Italic = 0 'False
- Strikethrough = 0 'False
- EndProperty
- ForeColor = &H00FFFFFF&
- Height = 300
- Left = 6960
- TabIndex = 27
- Top = 3960
- Width = 450
- End
- Begin VB.Label m22
- AutoSize = -1 'True
- BackColor = &H000000FF&
- Caption = "关"
- BeginProperty Font
- Name = "宋体"
- Size = 15
- Charset = 134
- Weight = 400
- Underline = -1 'True
- Italic = 0 'False
- Strikethrough = 0 'False
- EndProperty
- ForeColor = &H00FFFFFF&
- Height = 300
- Left = 10080
- TabIndex = 26
- Top = 3960
- Width = 300
- End
- Begin VB.Label m1
- AutoSize = -1 'True
- BackStyle = 0 'Transparent
- Caption = "门1"
- BeginProperty Font
- Name = "宋体"
- Size = 15
- Charset = 134
- Weight = 400
- Underline = -1 'True
- Italic = 0 'False
- Strikethrough = 0 'False
- EndProperty
- ForeColor = &H00FFFFFF&
- Height = 300
- Left = 6960
- TabIndex = 24
- Top = 3360
- Width = 450
- End
- Begin VB.Label m12
- AutoSize = -1 'True
- BackColor = &H000000FF&
- Caption = "关"
- BeginProperty Font
- Name = "宋体"
- Size = 15
- Charset = 134
- Weight = 400
- Underline = -1 'True
- Italic = 0 'False
- Strikethrough = 0 'False
- EndProperty
- ForeColor = &H00FFFFFF&
- Height = 300
- Left = 10080
- TabIndex = 23
- Top = 3360
- Width = 300
- End
- Begin VB.Label Label6
- AutoSize = -1 'True
- BackStyle = 0 'Transparent
- Caption = "控 制"
- BeginProperty Font
- Name = "宋体"
- Size = 15
- Charset = 134
- Weight = 700
- Underline = -1 'True
- Italic = 0 'False
- Strikethrough = 0 'False
- EndProperty
- ForeColor = &H00000000&
- Height = 300
- Left = 8520
- TabIndex = 21
- Top = 2760
- Width = 795
- End
- Begin VB.Label Label5
- AutoSize = -1 'True
- BackStyle = 0 'Transparent
- Caption = "名 称"
- BeginProperty Font
- Name = "宋体"
- Size = 15
- Charset = 134
- Weight = 700
- Underline = -1 'True
- Italic = 0 'False
- Strikethrough = 0 'False
- EndProperty
- ForeColor = &H00000000&
- Height = 300
- Left = 7080
- TabIndex = 20
- Top = 2760
- Width = 795
- End
- Begin VB.Label Label3
- AutoSize = -1 'True
- BackStyle = 0 'Transparent
- Caption = "状 态"
- BeginProperty Font
- Name = "宋体"
- Size = 15
- Charset = 134
- Weight = 700
- Underline = -1 'True
- Italic = 0 'False
- Strikethrough = 0 'False
- EndProperty
- ForeColor = &H00000000&
- Height = 300
- Left = 9840
- TabIndex = 19
- Top = 2760
- Width = 795
- End
- Begin VB.Label d7
- AutoSize = -1 'True
- BackStyle = 0 'Transparent
- Caption = "七号灯"
- BeginProperty Font
- Name = "宋体"
- Size = 15
- Charset = 134
- Weight = 400
- Underline = -1 'True
- Italic = 0 'False
- Strikethrough = 0 'False
- EndProperty
- ForeColor = &H00FFFFFF&
- Height = 300
- Left = 1080
- TabIndex = 18
- Top = 6840
- Width = 900
- End
- Begin VB.Label d71
- AutoSize = -1 'True
- BackColor = &H000000FF&
- Caption = "关"
- BeginProperty Font
- Name = "宋体"
- Size = 15
- Charset = 134
- Weight = 400
- Underline = -1 'True
- Italic = 0 'False
- Strikethrough = 0 'False
- EndProperty
- ForeColor = &H00FFFFFF&
- Height = 300
- Left = 4200
- TabIndex = 17
- Top = 6840
- Width = 300
- End
- Begin VB.Label d6
- AutoSize = -1 'True
- BackStyle = 0 'Transparent
- Caption = "六号灯"
- BeginProperty Font
- Name = "宋体"
- Size = 15
- Charset = 134
- Weight = 400
- Underline = -1 'True
- Italic = 0 'False
- Strikethrough = 0 'False
- EndProperty
- ForeColor = &H00FFFFFF&
- Height = 300
- Left = 1080
- TabIndex = 16
- Top = 6240
- Width = 900
- End
- Begin VB.Label d61
- AutoSize = -1 'True
- BackColor = &H000000FF&
- Caption = "关"
- BeginProperty Font
- Name = "宋体"
- Size = 15
- Charset = 134
- Weight = 400
- Underline = -1 'True
- Italic = 0 'False
- Strikethrough = 0 'False
- EndProperty
- ForeColor = &H00FFFFFF&
- Height = 300
- Left = 4200
- TabIndex = 15
- Top = 6240
- Width = 300
- End
- Begin VB.Label d5
- AutoSize = -1 'True
- BackStyle = 0 'Transparent
- Caption = "五号灯"
- BeginProperty Font
- Name = "宋体"
- Size = 15
- Charset = 134
- Weight = 400
- Underline = -1 'True
- Italic = 0 'False
- Strikethrough = 0 'False
- EndProperty
- ForeColor = &H00FFFFFF&
- Height = 300
- Left = 1080
- TabIndex = 14
- Top = 5640
- Width = 900
- End
- Begin VB.Label d51
- AutoSize = -1 'True
- BackColor = &H000000FF&
- Caption = "关"
- BeginProperty Font
- Name = "宋体"
- Size = 15
- Charset = 134
- Weight = 400
- Underline = -1 'True
- Italic = 0 'False
- Strikethrough = 0 'False
- EndProperty
- ForeColor = &H00FFFFFF&
- Height = 300
- Left = 4200
- TabIndex = 13
- Top = 5640
- Width = 300
- End
- Begin VB.Label d4
- AutoSize = -1 'True
- BackStyle = 0 'Transparent
- Caption = "四号灯"
- BeginProperty Font
- Name = "宋体"
- Size = 15
- Charset = 134
- Weight = 400
- Underline = -1 'True
- Italic = 0 'False
- Strikethrough = 0 'False
- EndProperty
- ForeColor = &H00FFFFFF&
- Height = 300
- Left = 1080
- TabIndex = 12
- Top = 5040
- Width = 900
- End
- Begin VB.Label d41
- AutoSize = -1 'True
- BackColor = &H000000FF&
- Caption = "关"
- BeginProperty Font
- Name = "宋体"
- Size = 15
- Charset = 134
- Weight = 400
- Underline = -1 'True
- Italic = 0 'False
- Strikethrough = 0 'False
- EndProperty
- ForeColor = &H00FFFFFF&
- Height = 300
- Left = 4200
- TabIndex = 11
- Top = 5040
- Width = 300
- End
- Begin VB.Label d3
- AutoSize = -1 'True
- BackStyle = 0 'Transparent
- Caption = "三号灯"
- BeginProperty Font
- Name = "宋体"
- Size = 15
- Charset = 134
- Weight = 400
- Underline = -1 'True
- Italic = 0 'False
- Strikethrough = 0 'False
- EndProperty
- ForeColor = &H00FFFFFF&
- Height = 300
- Left = 1080
- TabIndex = 10
- Top = 4440
- Width = 900
- End
- Begin VB.Label d31
- AutoSize = -1 'True
- BackColor = &H000000FF&
- Caption = "关"
- BeginProperty Font
- Name = "宋体"
- Size = 15
- Charset = 134
- Weight = 400
- Underline = -1 'True
- Italic = 0 'False
- Strikethrough = 0 'False
- EndProperty
- ForeColor = &H00FFFFFF&
- Height = 300
- Left = 4200
- TabIndex = 9
- Top = 4440
- Width = 300
- End
- Begin VB.Label d2
- AutoSize = -1 'True
- BackStyle = 0 'Transparent
- Caption = "二号灯"
- BeginProperty Font
- Name = "宋体"
- Size = 15
- Charset = 134
- Weight = 400
- Underline = -1 'True
- Italic = 0 'False
- Strikethrough = 0 'False
- EndProperty
- ForeColor = &H00FFFFFF&
- Height = 300
- Left = 1080
- TabIndex = 8
- Top = 3840
- Width = 900
- End
- Begin VB.Label d21
- AutoSize = -1 'True
- BackColor = &H000000FF&
- Caption = "关"
- BeginProperty Font
- Name = "宋体"
- Size = 15
- Charset = 134
- Weight = 400
- Underline = -1 'True
- Italic = 0 'False
- Strikethrough = 0 'False
- EndProperty
- ForeColor = &H00FFFFFF&
- Height = 300
- Left = 4200
- TabIndex = 7
- Top = 3840
- Width = 300
- End
- Begin VB.Label Label4
- AutoSize = -1 'True
- BackStyle = 0 'Transparent
- Caption = "控 制"
- BeginProperty Font
- Name = "宋体"
- Size = 15
- Charset = 134
- Weight = 700
- Underline = -1 'True
- Italic = 0 'False
- Strikethrough = 0 'False
- EndProperty
- ForeColor = &H00000000&
- Height = 300
- Left = 2640
- TabIndex = 5
- Top = 2640
- Width = 795
- End
- Begin VB.Label d11
- AutoSize = -1 'True
- BackColor = &H000000FF&
- Caption = "关"
- BeginProperty Font
- Name = "宋体"
- Size = 15
- Charset = 134
- Weight = 400
- Underline = -1 'True
- Italic = 0 'False
- Strikethrough = 0 'False
- EndProperty
- ForeColor = &H00FFFFFF&
- Height = 300
- Left = 4200
- TabIndex = 4
- Top = 3240
- Width = 300
- End
- Begin VB.Label Label2
- AutoSize = -1 'True
- BackStyle = 0 'Transparent
- Caption = "状 态"
- BeginProperty Font
- Name = "宋体"
- Size = 15
- Charset = 134
- Weight = 700
- Underline = -1 'True
- Italic = 0 'False
- Strikethrough = 0 'False
- EndProperty
- ForeColor = &H00000000&
- Height = 300
- Left = 3960
- TabIndex = 3
- Top = 2640
- Width = 795
- End
- Begin VB.Label Label1
- AutoSize = -1 'True
- BackStyle = 0 'Transparent
- Caption = "名 称"
- BeginProperty Font
- Name = "宋体"
- Size = 15
- Charset = 134
- Weight = 700
- Underline = -1 'True
- Italic = 0 'False
- Strikethrough = 0 'False
- EndProperty
- ForeColor = &H00000000&
- Height = 300
- Left = 1200
- TabIndex = 2
- Top = 2640
- Width = 795
- End
- Begin VB.Label d1
- AutoSize = -1 'True
- BackStyle = 0 'Transparent
- Caption = "一号灯"
- BeginProperty Font
- Name = "宋体"
- Size = 15
- Charset = 134
- Weight = 400
- Underline = -1 'True
- Italic = 0 'False
- Strikethrough = 0 'False
- EndProperty
- ForeColor = &H00FFFFFF&
- Height = 300
- Left = 1080
- TabIndex = 0
- Top = 3240
- Width = 1020
- End
- Begin VB.Image Image1
- Height = 6000
- Index = 1
- Left = 6600
- Picture = "Form1.frx":8DBB4
- Top = 2160
- Width = 4500
- End
- Begin VB.Image Image1
- Height = 6000
- Index = 0
- Left = 720
- Picture = "Form1.frx":909E4
- Top = 2160
- Width = 4500
- End
- Begin VB.Line Line1
- BorderColor = &H00FFFF00&
- BorderWidth = 4
- X1 = 42
- X2 = 258
- Y1 = 156
- Y2 = 156
- End
- Begin VB.Line Line2
- BorderColor = &H00FFFF00&
- BorderWidth = 4
- X1 = 336
- X2 = 552
- Y1 = 162
- Y2 = 162
- End
- End
- Attribute VB_Name = "zngk"
- Attribute VB_GlobalNameSpace = False
- Attribute VB_Creatable = False
- Attribute VB_PredeclaredId = True
- Attribute VB_Exposed = False
- Public x, x1, x2, x3, x4, x5, x6, x7, x8 As Integer
- Private Sub Command1_Click()
- shuoming.Show
- End Sub
- Private Sub Command2_Click() '为了大家学习方便我没有添加各种错误检出方法,输入端口号只要输入纯数字即可默认为1
- MSComm1.InBufferSize = 1024
- MSComm1.OutBufferSize = 1024
- MSComm1.CommPort = Text1.Text
- MSComm1.Settings = "9600,E,7,1"
- MSComm1.PortOpen = True
- End Sub
- Private Sub d10_Click(Index As Integer)
- Dim sum As String
- Dim rr As String
- Dim zz As String
- Select Case Index
- Case 0
- If x1 = 1 Then
- zz = CHANGE(0) '转换成16进制
- sum = "7" + "0" & zz & "05" + Chr(&H3) '这些是求和校检用的数据
- MSComm1.Output = Chr(&H2) + sum + CHACKSUM(sum) '向PLC发送开的消息
- x1 = 2
- d11.BackColor = vbGreen
- d10(0).Caption = "关" '这里我就不计算返回数据了!如果做程序的时候大家赢定要记得计算!
- d11.Caption = "开"
- x1 = 2
- Else
- zz = CHANGE(0) '转换成16进制
- sum = "8" + "0" & zz & "05" + Chr(&H3) '这些是求和校检用的数据
- MSComm1.Output = Chr(&H2) + sum + CHACKSUM(sum)
- d11.BackColor = vbRed
- d10(0).Caption = "开" '这里我就不计算返回数据了!如果做程序的时候大家赢定要记得计算!
- d11.Caption = "关"
- x1 = 1
- End If
- Case 1
- If x2 = 1 Then
- zz = CHANGE(1) '转换成16进制
- sum = "7" + "0" & zz & "05" + Chr(&H3) '这些是求和校检用的数据
- MSComm1.Output = Chr(&H2) + sum + CHACKSUM(sum) '向PLC发送开的消息
- x2 = 2
- d21.BackColor = vbGreen
- d10(1).Caption = "关" '这里我就不计算返回数据了!如果做程序的时候大家赢定要记得计算!
- d21.Caption = "开"
- x2 = 2
- Else
- zz = CHANGE(1) '转换成16进制
- sum = "8" + "0" & zz & "05" + Chr(&H3) '这些是求和校检用的数据
- MSComm1.Output = Chr(&H2) + sum + CHACKSUM(sum)
- d21.BackColor = vbRed
- d10(1).Caption = "开" '这里我就不计算返回数据了!如果做程序的时候大家赢定要记得计算!
- d21.Caption = "关"
- x2 = 1
- End If
- Case 2
- If x3 = 1 Then
- zz = CHANGE(2) '转换成16进制
- sum = "7" + "0" & zz & "05" + Chr(&H3) '这些是求和校检用的数据
- MSComm1.Output = Chr(&H2) + sum + CHACKSUM(sum) '向PLC发送开的消息
- x3 = 2
- d31.BackColor = vbGreen
- d10(2).Caption = "关" '这里我就不计算返回数据了!如果做程序的时候大家赢定要记得计算!
- d31.Caption = "开"
- x3 = 2
- Else
- zz = CHANGE(2) '转换成16进制
- sum = "8" + "0" & zz & "05" + Chr(&H3) '这些是求和校检用的数据
- MSComm1.Output = Chr(&H2) + sum + CHACKSUM(sum)
- d31.BackColor = vbRed
- d10(2).Caption = "开" '这里我就不计算返回数据了!如果做程序的时候大家赢定要记得计算!
- d31.Caption = "关"
- x3 = 1
- End If
- Case 3
- If x4 = 1 Then
- zz = CHANGE(3) '转换成16进制
- sum = "7" + "0" & zz & "05" + Chr(&H3) '这些是求和校检用的数据
- MSComm1.Output = Chr(&H2) + sum + CHACKSUM(sum) '向PLC发送开的消息
- x4 = 2
- d41.BackColor = vbGreen
- d10(3).Caption = "关" '这里我就不计算返回数据了!如果做程序的时候大家赢定要记得计算!
- d41.Caption = "开"
- x4 = 2
- Else
- zz = CHANGE(3) '转换成16进制
- sum = "8" + "0" & zz & "05" + Chr(&H3) '这些是求和校检用的数据
- MSComm1.Output = Chr(&H2) + sum + CHACKSUM(sum)
- d41.BackColor = vbRed
- d10(3).Caption = "开" '这里我就不计算返回数据了!如果做程序的时候大家赢定要记得计算!
- d41.Caption = "关"
- x4 = 1
- End If
- Case 4
- If x5 = 1 Then
- zz = CHANGE(4) '转换成16进制
- sum = "7" + "0" & zz & "05" + Chr(&H3) '这些是求和校检用的数据
- MSComm1.Output = Chr(&H2) + sum + CHACKSUM(sum) '向PLC发送开的消息
- x5 = 2
- d51.BackColor = vbGreen
- d10(4).Caption = "关" '这里我就不计算返回数据了!如果做程序的时候大家赢定要记得计算!
- d51.Caption = "开"
- x5 = 2
- Else
- zz = CHANGE(4) '转换成16进制
- sum = "8" + "0" & zz & "05" + Chr(&H3) '这些是求和校检用的数据
- MSComm1.Output = Chr(&H2) + sum + CHACKSUM(sum)
- d51.BackColor = vbRed
- d10(4).Caption = "开" '这里我就不计算返回数据了!如果做程序的时候大家赢定要记得计算!
- d51.Caption = "关"
- x5 = 1
- End If
- Case 5
- If x6 = 1 Then
- zz = CHANGE(5) '转换成16进制
- sum = "7" + "0" & zz & "05" + Chr(&H3) '这些是求和校检用的数据
- MSComm1.Output = Chr(&H2) + sum + CHACKSUM(sum) '向PLC发送开的消息
- x6 = 2
- d61.BackColor = vbGreen
- d10(5).Caption = "关" '这里我就不计算返回数据了!如果做程序的时候大家赢定要记得计算!
- d61.Caption = "开"
- x1 = 2
- Else
- zz = CHANGE(5) '转换成16进制
- sum = "8" + "0" & zz & "05" + Chr(&H3) '这些是求和校检用的数据
- MSComm1.Output = Chr(&H2) + sum + CHACKSUM(sum)
- d61.BackColor = vbRed
- d10(5).Caption = "开" '这里我就不计算返回数据了!如果做程序的时候大家赢定要记得计算!
- d61.Caption = "关"
- x6 = 1
- End If
- Case 6
- If x7 = 1 Then
- zz = CHANGE(6) '转换成16进制
- sum = "7" + "0" & zz & "05" + Chr(&H3) '这些是求和校检用的数据
- MSComm1.Output = Chr(&H2) + sum + CHACKSUM(sum) '向PLC发送开的消息
- x7 = 2
- d71.BackColor = vbGreen
- d10(6).Caption = "关" '这里我就不计算返回数据了!如果做程序的时候大家赢定要记得计算!
- d71.Caption = "开"
- x7 = 2
- Else
- zz = CHANGE(6) '转换成16进制
- sum = "8" + "0" & zz & "05" + Chr(&H3) '这些是求和校检用的数据
- MSComm1.Output = Chr(&H2) + sum + CHACKSUM(sum)
- d71.BackColor = vbRed
- d10(6).Caption = "开" '这里我就不计算返回数据了!如果做程序的时候大家赢定要记得计算!
- d71.Caption = "关"
- x7 = 1
- End If
- End Select
- End Sub
- Private Sub Form_Load()
- Text1.Text = 1
- x1 = 1
- x2 = 1
- x3 = 1
- x4 = 1
- x5 = 1
- x6 = 1
- x7 = 1
- End Sub
- Private Sub sz1_Click()
- x = 1
- sz.Caption = "一区设置"
- sz.Show
- End Sub
- Private Sub sz2_Click()
- x = 2
- sz.Caption = "二区设置"
- sz.Show
- End Sub