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

📄 灯的测试.frm

📁 模拟屏 实时控制 监测 报警 监测报告
💻 FRM
📖 第 1 页 / 共 5 页
字号:
         TabIndex        =   20
         Top             =   600
         Width           =   600
      End
      Begin VB.CommandButton Command7 
         Caption         =   "全绿"
         Height          =   400
         Left            =   2520
         TabIndex        =   19
         Top             =   600
         Width           =   600
      End
      Begin VB.CommandButton Command9 
         Caption         =   "全亮"
         Height          =   400
         Left            =   3360
         TabIndex        =   18
         Top             =   600
         Width           =   600
      End
      Begin VB.CommandButton Command10 
         Caption         =   "全灭"
         Height          =   400
         Left            =   4200
         TabIndex        =   17
         Top             =   600
         Width           =   600
      End
      Begin VB.Label Label1 
         Caption         =   "A"
         Height          =   375
         Index           =   0
         Left            =   240
         TabIndex        =   77
         Top             =   1200
         Width           =   375
      End
      Begin VB.Label Label1 
         Caption         =   "B"
         Height          =   375
         Index           =   2
         Left            =   240
         TabIndex        =   76
         Top             =   1800
         Width           =   375
      End
      Begin VB.Label Label1 
         Caption         =   "C"
         Height          =   375
         Index           =   3
         Left            =   240
         TabIndex        =   75
         Top             =   2400
         Width           =   375
      End
      Begin VB.Label Label1 
         Caption         =   "D"
         Height          =   375
         Index           =   4
         Left            =   240
         TabIndex        =   74
         Top             =   3000
         Width           =   375
      End
      Begin VB.Label Label1 
         Caption         =   "E"
         Height          =   375
         Index           =   5
         Left            =   240
         TabIndex        =   73
         Top             =   3600
         Width           =   375
      End
      Begin VB.Label Label1 
         Caption         =   "F"
         Height          =   375
         Index           =   6
         Left            =   240
         TabIndex        =   72
         Top             =   4200
         Width           =   375
      End
      Begin VB.Label Label1 
         Caption         =   "G"
         Height          =   375
         Index           =   7
         Left            =   240
         TabIndex        =   71
         Top             =   4800
         Width           =   375
      End
      Begin VB.Label Label1 
         Caption         =   "H"
         Height          =   375
         Index           =   8
         Left            =   240
         TabIndex        =   70
         Top             =   5400
         Width           =   375
      End
   End
   Begin VB.CommandButton Command6 
      Caption         =   "双色灯直观测试"
      Height          =   375
      Left            =   3600
      TabIndex        =   15
      Top             =   6240
      Width           =   1695
   End
   Begin VB.CommandButton Command4 
      Caption         =   "三色灯直观测试"
      Height          =   375
      Left            =   3600
      TabIndex        =   14
      Top             =   5520
      Width           =   1695
   End
   Begin VB.TextBox Text1 
      Height          =   270
      Index           =   0
      Left            =   1440
      MaxLength       =   15
      TabIndex        =   8
      Top             =   2520
      Width           =   1935
   End
   Begin VB.CommandButton Command5 
      Caption         =   "发送"
      Default         =   -1  'True
      Height          =   375
      Left            =   3840
      TabIndex        =   7
      Top             =   2520
      Width           =   855
   End
   Begin VB.TextBox Text4 
      Height          =   270
      Left            =   960
      MaxLength       =   4
      TabIndex        =   6
      Top             =   720
      Width           =   615
   End
   Begin VB.CommandButton Command2 
      Caption         =   "初始化"
      Height          =   375
      Left            =   4080
      TabIndex        =   5
      Top             =   840
      Width           =   855
   End
   Begin VB.CommandButton Command11 
      Caption         =   "广播命令"
      Height          =   375
      Left            =   4920
      TabIndex        =   4
      Top             =   2520
      Width           =   975
   End
   Begin VB.TextBox Text2 
      Height          =   270
      Left            =   1200
      MaxLength       =   4
      TabIndex        =   3
      Top             =   4200
      Width           =   615
   End
   Begin VB.TextBox Text6 
      Height          =   270
      Left            =   3240
      MaxLength       =   4
      TabIndex        =   2
      Top             =   4200
      Width           =   615
   End
   Begin VB.CommandButton Command12 
      Caption         =   "修改地址"
      Height          =   375
      Left            =   4200
      TabIndex        =   1
      Top             =   4080
      Width           =   975
   End
   Begin VB.ComboBox Combo3 
      Height          =   300
      ItemData        =   "灯的测试.frx":4494
      Left            =   2760
      List            =   "灯的测试.frx":44A7
      TabIndex        =   0
      Text            =   "19200"
      Top             =   840
      Width           =   855
   End
   Begin VB.Label Label1 
      Caption         =   "发送数据:"
      Height          =   255
      Index           =   1
      Left            =   360
      TabIndex        =   13
      Top             =   2520
      Width           =   1095
   End
   Begin VB.Label Label8 
      Caption         =   "地址:"
      Height          =   255
      Left            =   360
      TabIndex        =   12
      Top             =   840
      Width           =   615
   End
   Begin VB.Label Label9 
      Caption         =   "数据:"
      Height          =   375
      Left            =   2040
      TabIndex        =   11
      Top             =   840
      Width           =   735
   End
   Begin VB.Label Label2 
      Caption         =   "原地址:"
      Height          =   255
      Left            =   360
      TabIndex        =   10
      Top             =   4200
      Width           =   855
   End
   Begin VB.Label Label6 
      Caption         =   "新地址:"
      Height          =   255
      Left            =   2400
      TabIndex        =   9
      Top             =   4200
      Width           =   975
   End
End
Attribute VB_Name = "Form2"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Public inttime As Integer  '发送时间间隔
Public strset As String
Dim myarray(12) As String
Public intport As Integer   '串行口号

Private Sub Command1_Click()
If Text4.Text = "" Then      '判断地址是否为四位
  MsgBox ("请输入芯片的地址")
Else
Dim n3 As Integer
Dim i As Integer, s3 As String, s2 As String, s1 As String

Dim myarray1(8) As String
'将8位数据和4位地址的ASC码累加并取其后两位
For i = 1 To 8
    myarray1(i) = "1"  '1是代表红
    s2 = s2 + myarray1(i)
    n3 = n3 + Asc(myarray1(i))
     Dim j As Integer
  For j = 1 To 39
  Option1(j).Value = False
  Next
           
Next
For i = 1 To 4
n3 = n3 + Asc(Mid(Trim(Text4.Text), i, 1))
Next
n3 = n3 + Asc("$")
s3 = Right(Hex(n3), 2)
  '发送数据
  If Not Form1.MSComm1.PortOpen Then
      MsgBox ("请先选择串口后,再执行此操作")
  Else
      s1 = Text4.Text
      Form1.MSComm1.Output = "UU$" + s1 + s2 + s3
  End If
End If
Text3.Text = "UU$" + s1 + s2 + s3 + Chr$(13) + Chr$(10) + Text3.Text
End Sub

Private Sub Command10_Click()
If Text4.Text = "" Then
MsgBox ("请输入芯片的地址")
Else
Dim n3 As Integer
Dim i As Integer, s3 As String, s2 As String, s1 As String

Dim myarray1(8) As String
For i = 1 To 8
    myarray1(i) = "0"
s2 = s2 + myarray1(i)
n3 = n3 + Asc(myarray1(i))
  Dim j As Integer
  For j = 1 To 39
  Option1(j).Value = False
  Next
Next
For i = 1 To 4
n3 = n3 + Asc(Mid(Trim(Text4.Text), i, 1))
Next
n3 = n3 + Asc("$")
s3 = Right(Hex(n3), 2)
  
  If Not Form1.MSComm1.PortOpen Then
      MsgBox ("请先选择串口后,再执行此操作")
Else
      s1 = Text4.Text
    
      Form1.MSComm1.Output = "UU$" + s1 + s2 + s3
End If
End If
Text3.Text = "UU$" + s1 + s2 + s3 + Chr$(13) + Chr$(10) + Text3.Text
End Sub

Private Sub Command11_Click()
 If Not Form1.MSComm1.PortOpen Then
       MsgBox ("请先选择串口后,再执行此操作")
   Else
       Form1.MSComm1.Output = "UUg13333d"  ' 向串口发送广播命令
  End If
End Sub

Private Sub Command12_Click()
 If Len(Trim(Text2.Text)) < 4 Then   '判断旧地址的位数是否为四位,如果不是高位补0,
   m1 = 4 - Len(Trim(Text2.Text))
   Dim d As Integer, sss As String
   For d = 1 To m1
     sss = sss + "0"
   Next
 Text2.Text = sss + Trim(Text2.Text)
 End If
 If Len(Trim(Text6.Text)) < 4 Then      '判断新地址的位数是否为四位,如果不是高位补0
   m1 = 4 - Len(Trim(Text6.Text))
  sss = ""
   For d = 1 To m1
     sss = sss + "0"
   Next
 Text6.Text = sss + Trim(Text6.Text)
 End If
 Dim n1 As Integer, n2 As Integer
Dim i As Integer, s As String
Dim myarray() As String
'将旧地址和新地址都读取到myarray()数组中,并且将每位数据的ASC码值累加到n2中
ReDim myarray(8)
For i = 1 To 4
myarray(i) = Mid(Trim(Text2.Text), i, 1)
n2 = n2 + Asc(myarray(i))
Next
For i = 5 To 8
myarray(i) = Mid(Trim(Text6.Text), i - 4, 1)
n2 = n2 + Asc(myarray(i))
Next
'累加两个%的ASC码值并取其低位字节
n2 = n2 + Asc("%")
n2 = n2 + Asc("%")
s = Right(Hex(n2), 2)
 '发送
  If Not Form1.MSComm1.PortOpen Then
       MsgBox ("请先选择串口后,再执行此操作")
  Else
      Form1.MSComm1.Output = "UU%" + Text2.Text + Text6.Text + "%" + s
       
  End If
Text4.Text = Text6.Text
End Sub

Private Sub Command13_Click()
Frame1.Visible = False
Frame10.Visible = False
Frame23.Visible = True
End Sub

Private Sub Command14_Click()
If Text4.Text = "" Then
  MsgBox ("请输入芯片的地址")
Else
Dim n3 As Integer
Dim i As Integer, s3 As String, s2 As String, s1 As String

Dim myarray1(6) As String
'将8位数据和4位地址的ASC码累加并取其后两位
For i = 1 To 6
    myarray1(i) = "A"
    s2 = s2 + myarray1(i)
    n3 = n3 + Asc(myarray1(i))
     Dim j As Integer
  For j = 1 To 47
  Option2(j).Value = False
  Next
        
Next
For i = 1 To 4
n3 = n3 + Asc(Mid(Trim(Text4.Text), i, 1))
Next
n3 = n3 + Asc("$")

⌨️ 快捷键说明

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