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

📄 form1.frm

📁 omrong校验码,提供校验尾码用,很方便的东西.
💻 FRM
字号:
VERSION 5.00
Begin VB.Form Form1 
   BorderStyle     =   1  'Fixed Single
   Caption         =   "欧姆龙FCS计算校验"
   ClientHeight    =   1740
   ClientLeft      =   45
   ClientTop       =   435
   ClientWidth     =   7515
   DrawMode        =   2  'Blackness
   LinkTopic       =   "Form1"
   MaxButton       =   0   'False
   MinButton       =   0   'False
   ScaleHeight     =   1740
   ScaleWidth      =   7515
   StartUpPosition =   2  '屏幕中心
   Begin VB.CommandButton Command1 
      Caption         =   "计算校验"
      Height          =   375
      Left            =   6000
      TabIndex        =   7
      Top             =   1200
      Width           =   1335
   End
   Begin VB.TextBox textL 
      Height          =   375
      Left            =   3840
      TabIndex        =   6
      Top             =   1200
      Width           =   1215
   End
   Begin VB.TextBox textA 
      Height          =   375
      Left            =   1200
      TabIndex        =   5
      Top             =   1200
      Width           =   1455
   End
   Begin VB.TextBox TextFCSCK 
      Height          =   375
      Left            =   6120
      TabIndex        =   4
      Top             =   720
      Width           =   1215
   End
   Begin VB.TextBox TextFCSP 
      Height          =   375
      Left            =   3840
      TabIndex        =   3
      Top             =   720
      Width           =   1215
   End
   Begin VB.TextBox TextFCSD 
      Height          =   375
      Left            =   1200
      TabIndex        =   2
      Top             =   720
      Width           =   1455
   End
   Begin VB.TextBox TextResponse 
      Height          =   375
      Left            =   1200
      TabIndex        =   0
      Top             =   240
      Width           =   6135
   End
   Begin VB.Label Label6 
      Caption         =   "字符长度"
      Height          =   255
      Left            =   2760
      TabIndex        =   12
      Top             =   1320
      Width           =   855
   End
   Begin VB.Label Label5 
      Caption         =   "结束符"
      Height          =   255
      Left            =   240
      TabIndex        =   11
      Top             =   1320
      Width           =   735
   End
   Begin VB.Label Label4 
      Caption         =   "校验结果"
      Height          =   255
      Left            =   5160
      TabIndex        =   10
      Top             =   840
      Width           =   855
   End
   Begin VB.Label Label3 
      Caption         =   "FCS真实值"
      Height          =   255
      Left            =   2760
      TabIndex        =   9
      Top             =   840
      Width           =   975
   End
   Begin VB.Label Label2 
      Caption         =   "FCS实际值"
      Height          =   255
      Left            =   240
      TabIndex        =   8
      Top             =   840
      Width           =   855
   End
   Begin VB.Label Label1 
      Caption         =   "发送字符"
      Height          =   255
      Left            =   240
      TabIndex        =   1
      Top             =   360
      Width           =   855
   End
End
Attribute VB_Name = "Form1"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False

Private Sub Command1_Click()
RESPONSE = TextResponse.Text
L = Len(RESPONSE)
Q = 0
FCSCK = ""
A = Right(RESPONSE, 1)
textA.Text = A
textL.Text = L

If A = "*" Then
LENGS = Len(RESPONSE) - 3
Else
LENGS = Len(RESPONSE) - 2
End If

FCSP = Mid(RESPONSE, LENGS + 1, 2)      ' . . . . . . . . . . FCS 数据接收
For I = 1 To LENGS                      ' . . . . . . . . . . . . . . . . . . . . . . . . . FCS 里的字符数
Q = Asc(Mid(RESPONSE, I, 1)) Xor Q
Next I
FCSD = Hex(Q)
If Len(FCS0) = 1 Then FCSD = " 0 " + FCSD    ' . . . . . . . . . FCS 结果
If FCSD <> FCSP Then
FCSCK = " 校验错误 "
Else
FCSCK = " 校验正确 "
End If
TextFCSD.Text = FCSD
TextFCSP.Text = FCSP
TextFCSCK.Text = FCSCK
End Sub

⌨️ 快捷键说明

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