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

📄 form1.frm

📁 21世纪的一个重要标志就是人类社会从后工业时代过渡到信息时代。随着计算机技术的发展和成熟
💻 FRM
📖 第 1 页 / 共 2 页
字号:
VERSION 5.00
Object = "{648A5603-2C6E-101B-82B6-000000000014}#1.1#0"; "MSCOMM32.OCX"
Begin VB.Form Form1 
   Caption         =   "Form1"
   ClientHeight    =   4770
   ClientLeft      =   60
   ClientTop       =   345
   ClientWidth     =   5880
   BeginProperty Font 
      Name            =   "宋体"
      Size            =   15.75
      Charset         =   134
      Weight          =   400
      Underline       =   0   'False
      Italic          =   0   'False
      Strikethrough   =   0   'False
   EndProperty
   LinkTopic       =   "Form1"
   ScaleHeight     =   4770
   ScaleWidth      =   5880
   StartUpPosition =   3  '窗口缺省
   Begin VB.CommandButton Command1 
      Caption         =   "Command1"
      BeginProperty Font 
         Name            =   "宋体"
         Size            =   9
         Charset         =   134
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   495
      Left            =   3480
      TabIndex        =   6
      Top             =   1320
      Width           =   1215
   End
   Begin VB.Timer Timer2 
      Left            =   4080
      Top             =   600
   End
   Begin VB.TextBox Text1 
      BeginProperty Font 
         Name            =   "宋体"
         Size            =   9
         Charset         =   134
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   495
      Left            =   720
      TabIndex        =   3
      Text            =   "Text1"
      Top             =   3720
      Width           =   2895
   End
   Begin VB.Timer Timer1 
      Left            =   3600
      Top             =   600
   End
   Begin MSCommLib.MSComm MSComm1 
      Left            =   3600
      Top             =   2400
      _ExtentX        =   1005
      _ExtentY        =   1005
      _Version        =   393216
      DTREnable       =   -1  'True
   End
   Begin VB.Label Label6 
      Caption         =   "Label6"
      BeginProperty Font 
         Name            =   "宋体"
         Size            =   9
         Charset         =   134
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   495
      Left            =   1200
      TabIndex        =   8
      Top             =   120
      Width           =   2415
   End
   Begin VB.Label lblclock 
      Caption         =   "0"
      BeginProperty Font 
         Name            =   "宋体"
         Size            =   9
         Charset         =   134
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   495
      Left            =   1440
      TabIndex        =   7
      Top             =   720
      Width           =   1215
   End
   Begin VB.Label Label5 
      Caption         =   "Label5"
      BeginProperty Font 
         Name            =   "宋体"
         Size            =   9
         Charset         =   134
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   495
      Left            =   1440
      TabIndex        =   5
      Top             =   2400
      Width           =   1215
   End
   Begin VB.Label Label4 
      Caption         =   "Label4"
      BeginProperty Font 
         Name            =   "宋体"
         Size            =   9
         Charset         =   134
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   495
      Left            =   0
      TabIndex        =   4
      Top             =   2400
      Width           =   1215
   End
   Begin VB.Label Label3 
      Caption         =   "Label3"
      BeginProperty Font 
         Name            =   "宋体"
         Size            =   9
         Charset         =   134
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   495
      Left            =   1440
      TabIndex        =   2
      Top             =   1440
      Width           =   1215
   End
   Begin VB.Label Label2 
      Caption         =   "Label2"
      BeginProperty Font 
         Name            =   "宋体"
         Size            =   9
         Charset         =   134
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   495
      Left            =   0
      TabIndex        =   1
      Top             =   840
      Width           =   1215
   End
   Begin VB.Label Label1 
      Caption         =   "Label1"
      BeginProperty Font 
         Name            =   "宋体"
         Size            =   9
         Charset         =   134
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   495
      Left            =   0
      TabIndex        =   0
      Top             =   1560
      Width           =   1215
   End
End
Attribute VB_Name = "Form1"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Public summ As Single
Public flag As Integer
Dim bytes() As Byte
Dim rebytes() As Byte
Dim shar As Integer
Public biaodizhi As Single
Public biaodiriqi As String



Private Sub Command1_Click()
If shar = 0 Then
 Timer1.Interval = 1000
 Timer2.Interval = 1000
 Command1.Caption = "开截门"
 shar = 1
Else
    Timer1.Interval = 0
    Timer2.Interval = 0
    Command1.Caption = "截门关"
  shar = 0
End If
End Sub

Private Sub Form_Load()

flag = 1
Timer1.Interval = 0
Timer2.Interval = 0
Label1.Caption = "日期"
Label2.Caption = "时间"
Label4.Caption = "用量"
Label5.Caption = summ
Label6.Caption = "NO 1  "
Command1.Caption = "截门关"
 MSComm1.RThreshold = 1
 MSComm1.InputMode = comInputModeText
 MSComm1.CommPort = 2
 MSComm1.Settings = "9600,n,8,1"
 MSComm1.PortOpen = True

End Sub

Private Sub MSComm1_OnComm()
Dim a As String
Dim st As String
Dim l As Integer
Dim ln As Integer
Dim s As Integer
Dim c(16) As String * 1
Dim nian As Date
Dim yue As Date
Dim ri As Date
Dim shi As Date
Dim fen As Date
Dim miao As Date
Dim endtime As Long
If (MSComm1.CommEvent = comEvReceive) Then
 jiaoyanhe = 0
 endtime = 10 + Timer
       If flag = 2 Then
       Timer2.Interval = 0
     '加沿时
     
      End If
Do
     b = b + MSComm1.Input
begin = InStr(1, b, "*~1")
bend = InStr(1, b, "#")
If begin <> 0 And bend <> 0 And bend - begin > 0 Then '1
 a = Mid(b, begin, bend - begin + 1)
 l = Len(a)
 Exit Do
End If

If Time > endtime Then
   Exit Do
  End If
Loop
'拆包
   ReDim bytes(l)
   For i = 0 To l - 1
   bytes(i) = 0
   Next i
           Text1 = a
           
          
           
           For i = 0 To l - 1
             bytes(i) = Asc(Mid(a, i + 1, 1))
           Next i
 '校验
               jiaoyanhe = 0
            For i = 0 To l - 3
               jiaoyanhe = jiaoyanhe Xor bytes(i)
            Next i
 If Asc(jiaoyanhe) = bytes(l - 2) Then '2
 '****************************************************
 If bytes(3) = Asc("a") And bytes(4) = Asc("q") And bytes(6) = Asc("#") Then '3
        ' For i = 0 To 1000
        ' Next i

⌨️ 快捷键说明

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