.
  • 作者:city7cc
  • 积分:4065
  • 等级:专家教授
  • 2019/12/30 13:18:58
  • 中国面包师贴吧-楼主(阅:3794/回:0)VB串口程序2

    Begin VB.TextBox Text3

          Alignment       =   1  'Right Justify

          Appearance      =   0  'Flat

          BackColor       =   &H00FFFFFF&

          DataField       =   "定值3比例"

          DataSource      =   "Data1"

          BeginProperty Font

             Name            =   "宋体"

             Size            =   10.5

             Charset         =   134

             Weight          =   700

             Underline       =   0   'False

             Italic          =   0   'False

             Strikethrough   =   0   'False

          EndProperty

          ForeColor       =   &H00808080&

          Height          =   315

          Index           =   2

          Left            =   2400

          TabIndex        =   1

          Text            =   "1"

          Top             =   2160

          Width           =   615

       End

       Begin VB.TextBox Text2

          Alignment       =   1  'Right Justify

          BackColor       =   &H00FFFFFF&

          DataField       =   "定值3"

          DataSource      =   "Data1"

          BeginProperty Font

             Name            =   "宋体"

             Size            =   10.5

             Charset         =   134

             Weight          =   700

             Underline       =   0   'False

             Italic          =   0   'False

             Strikethrough   =   0   'False

          EndProperty

          ForeColor       =   &H00800000&

          Height          =   315

          Index           =   2

          Left            =   840

          TabIndex        =   0

          Text            =   "1.0 "

          Top             =   2160

          Width           =   972

       End

       Begin VB.Label Label2

          Caption         =   "元  件"

          BeginProperty Font

             Name            =   "宋体"

             Size            =   10.5

             Charset         =   0

             Weight          =   400

             Underline       =   0   'False

             Italic          =   0   'False

             Strikethrough   =   0   'False

          EndProperty

          Height          =   255

          Index           =   0

          Left            =   120

          TabIndex        =   12

          Top             =   720

          Width           =   855

       End

       Begin VB.Label Label2

          Caption         =   "定  值"

          BeginProperty Font

             Name            =   "宋体"

             Size            =   10.5

             Charset         =   0

             Weight          =   400

             Underline       =   0   'False

             Italic          =   0   'False

             Strikethrough   =   0   'False

          EndProperty

          Height          =   255

          Index           =   1

          Left            =   120

          TabIndex        =   11

          Top             =   1200

          Width           =   855

       End

       Begin VB.Label Label2

          Caption         =   "时  限"

          BeginProperty Font

             Name            =   "宋体"

             Size            =   10.5

             Charset         =   0

             Weight          =   400

             Underline       =   0   'False

             Italic          =   0   'False

             Strikethrough   =   0   'False

          EndProperty

          Height          =   255

          Index           =   2

          Left            =   120

          TabIndex        =   10

          Top             =   1680

          Width           =   855

       End

       Begin VB.Label Label2

          Caption         =   "参数1"

          BeginProperty Font

             Name            =   "宋体"

             Size            =   10.5

             Charset         =   0

             Weight          =   400

             Underline       =   0   'False

             Italic          =   0   'False

             Strikethrough   =   0   'False

          EndProperty

          Height          =   255

          Index           =   3

          Left            =   120

          TabIndex        =   9

          Top             =   2160

          Width           =   855

       End

    End

    Attribute VB_Name = "Comptform"

    Attribute VB_GlobalNameSpace = False

    Attribute VB_Creatable = False

    Attribute VB_PredeclaredId = True

    Attribute VB_Exposed = False

    Dim hcd(32) As Byte

    Private Sub Command2_Click()

        If Combo1.ListIndex < 0 Then Combo1.ListIndex = 1

        hcd(6) = &HFF: hcd(7) = &HFF: hcd(8) = &H66: hcd(9) = &H66

        hcd(12) = &HFF: hcd(13) = &HFF: hcd(14) = &H12: hcd(15) = &H34

        If Combo1.ListIndex = 1 Then

            hcd(8) = &HA5: hcd(9) = &H5A

        ElseIf Combo1.ListIndex = 2 Then

            hcd(8) = &H5A: hcd(9) = &HA5

        ElseIf Combo1.ListIndex = 4 Then

            hcd(6) = &H0: hcd(7) = &H1

        ElseIf Combo1.ListIndex = 5 Then

            hcd(6) = &H0: hcd(7) = &H2

        ElseIf Combo1.ListIndex = 6 Then

            hcd(6) = &H0: hcd(7) = &H3

        ElseIf Combo1.ListIndex = 7 Then

            hcd(6) = &H0: hcd(7) = &H55

        ElseIf Combo1.ListIndex = 8 Then

            hcd(6) = &H0: hcd(7) = &HAA

        End If

        For i = 0 To 2

            temp = Val(Text2(i).Text) * Val(Text3(i).Text)

            hcd(i * 2) = temp \ 256:    hcd(i * 2 + 1) = temp Mod 256                       'para0-2

        Next

        hcd(10) = &H34: hcd(11) = &HDA

        For i = 0 To 4

            hcd(10) = hcd(10) Xor hcd(i * 2): hcd(11) = hcd(11) Xor hcd(i * 2 + 1)

        Next

        If Combo3.Text = 15 Then

        i = (Combo3.Text + 1) * 8 + &H100

        Else

        i = (Combo3.Text - 1) * 8 + &H100

        End If

        tx_b(16) = Array(&H8, &H10, i \ 256, i Mod 256, 0, &H8, &H10, Hour(Time), Minute(Time), Second(Time), 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0)

        For i = 7 To 7 + 32:        tx_b(16)(i) = hcd(i - 7):    Next

        tx_REQ = 16

    End Sub

    VERSION 5.00

    Begin VB.Form controlform

       Caption         =   "操作"

       ClientHeight    =   1995

       ClientLeft      =   60

       ClientTop       =   345

       ClientWidth     =   5430

       LinkTopic       =   "Form1"

       ScaleHeight     =   1995

       ScaleWidth      =   5430

       StartUpPosition =   3  '窗口缺省

       Begin VB.Commanon J_ctrl

          Caption         =   "校时"

          BeginProperty Font

             Name            =   "宋体"

             Size            =   10.5

             Charset         =   0

             Weight          =   400

             Underline       =   0   'False

             Italic          =   0   'False

             Strikethrough   =   0   'False

          EndProperty

          Height          =   375

          Index           =   5

          Left            =   4200

          TabIndex        =   5

          Top             =   1320

          Width           =   735

       End

       Begin VB.Commanon J_ctrl

          Caption         =   "清除电度"

          BeginProperty Font

             Name            =   "宋体"

             Size            =   10.5

             Charset         =   0

             Weight          =   400

             Underline       =   0   'False

             Italic          =   0   'False

             Strikethrough   =   0   'False

          EndProperty

          Height          =   375

          Index           =   4

          Left            =   2160

          TabIndex        =   4

          Top             =   1320

          Width           =   1095

       End

       Begin VB.Commanon J_ctrl

          Caption         =   "复归"

          BeginProperty Font

             Name            =   "宋体"

             Size            =   10.5

             Charset         =   0

             Weight          =   400

             Underline       =   0   'False

             Italic          =   0   'False

             Strikethrough   =   0   'False

          EndProperty

          Height          =   375

          Index           =   3

          Left            =   360

          TabIndex        =   3

          Top             =   1320

          Width           =   735

       End

       Begin VB.Commanon J_ctrl

          Caption         =   "停车"

          BeginProperty Font

             Name            =   "宋体"

             Size            =   10.5

             Charset         =   0

             Weight          =   400

             Underline       =   0   'False

             Italic          =   0   'False

             Strikethrough   =   0   'False

          EndProperty

          Height          =   375

          Index           =   2

          Left            =   4200

          TabIndex        =   2

          Top             =   360

          Width           =   735

       End

       Begin VB.Commanon J_ctrl

          Caption         =   "启动B"

          BeginProperty Font

             Name            =   "宋体"

             Size            =   10.5

             Charset         =   0

             Weight          =   400

             Underline       =   0   'False

             Italic          =   0   'False

             Strikethrough   =   0   'False

          EndProperty

          Height          =   375

          Index           =   1

          Left            =   2280

          TabIndex        =   1

          Top             =   360

          Width           =   735

       End

       Begin VB.Commanon J_ctrl

          Caption         =   "启动A"

          BeginProperty Font

             Name            =   "宋体"

             Size            =   10.5

             Charset         =   0

             Weight          =   400

             Underline       =   0   'False

             Italic          =   0   'False

             Strikethrough   =   0   'False

          EndProperty

          Height          =   375

          Index           =   0

          Left            =   360

          TabIndex        =   0

          Top             =   360

          Width           =   735

       End

    End

    Attribute VB_Name = "controlform"

    Attribute VB_GlobalNameSpace = False

    Attribute VB_Creatable = False

    Attribute VB_PredeclaredId = True

    Attribute VB_Exposed = False

    Private Sub J_ctrl_Click(Index As Integer)

    If Index < 5 Then                                   '继电器

        tx_b(16) = Array(0, 0, &H0, &HD2, &H0, &H1, &H2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0)

        tx_b(16)(7) = (Index + 1) * 17

        tx_b(16)(8) = (Index + 1) * 17

    '    tx_b(16)(14 + 8) = 40

    Else                                                '校时

        ts = d_BCD(Second(Time)):   tm = d_BCD(Minute(Time)):   th = d_BCD(Hour(Time))

        dd = d_BCD(Day(Date)):      dM = d_BCD(Month(Date)):    dY = d_BCD(Year(Date) Mod 100)

        tx_b(16) = Array(0, 0, &H0, &HD8, &H0, &H4, &H8, dY, dM, dd, th, tm, ts, &H12, &H34, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0)

    End If

    tx_REQ = 16                                         '0x10 命令

    End Sub

    VERSION 5.00

    Begin VB.Form Factor_Seting

       Appearance      =   0  'Flat

       BackColor       =   &H00E0E0E0&

       BorderStyle     =   3  'Fixed Dialog

       Caption         =   "通道校正系数"

       ClientHeight    =   2400

       ClientLeft      =   1980

       ClientTop       =   4365

       ClientWidth     =   11895

       BeginProperty Font

          Name            =   "System"

          Size            =   12

          Charset         =   134

          Weight          =   700

          Underline       =   0   'False

          Italic          =   0   'False

          Strikethrough   =   0   'False

       EndProperty

       LinkTopic       =   "Form1"

       MaxButton       =   0   'False

       MinButton       =   0   'False

       Picture         =   "Factor_seting.frx":0000

       ScaleHeight     =   2400

       ScaleWidth      =   11895

       Begin VB.Commanon Command1

          BeginProperty Font

             Name            =   "宋体"

             Size            =   9

             Charset         =   134

             Weight          =   400

             Underline       =   0   'False

             Italic          =   0   'False

             Strikethrough   =   0   'False

          EndProperty

          Height          =   375

          Index           =   0

          Left            =   9840

          Picture         =   "Factor_seting.frx":0342

          Style           =   1  'Graphical

          TabIndex        =   1

          Top             =   600

          Width           =   375

       End

       Begin VB.TextBox Text0

          Alignment       =   2  'Center

          Height          =   360

          Index           =   7

          Left            =   5880

          TabIndex        =   42

          Text            =   "0.0"

          Top             =   1200

          Width           =   735

       End

       Begin VB.TextBox Text0

          Alignment       =   2  'Center

          Height          =   360

          Index           =   6

          Left            =   5880

          TabIndex        =   41

          Text            =   "0.0"

          Top             =   720

          Width           =   735

       End

       Begin VB.TextBox Text0

          Alignment       =   2  'Center

          Height          =   360

          Index           =   5

          Left            =   5880

          TabIndex        =   40

          Text            =   "0.0"

          Top             =   240

          Width           =   735

       End

       Begin VB.TextBox Text0

          Alignment       =   2  'Center

          Height          =   360

          Index           =   4

          Left            =   1080

          TabIndex        =   39

          Text            =   "0.0"

          Top             =   240

          Width           =   735

       End

       Begin VB.TextBox Text0

          Alignment       =   2  'Center

          Height          =   360

          Index           =   3

          Left            =   1080

          TabIndex        =   38

          Text            =   "0.0"

          Top             =   720

          Width           =   735

       End

       Begin VB.TextBox Text0

          Alignment       =   2  'Center

          Height          =   360

          Index           =   2

          Left            =   1080

          TabIndex        =   37

          Text            =   "0.0"

          Top             =   1200

          Width           =   735

       End

       Begin VB.TextBox Text0

          Alignment       =   2  'Center

          Height          =   360

          Index           =   1

          Left            =   1080

          TabIndex        =   36

          Text            =   "0.0"

          Top             =   1680

          Width           =   735

       End

       Begin VB.CheckBox Check0

          Caption         =   "Check1"

          Height          =   225

          Index           =   7

          Left            =   5520

          TabIndex        =   35

          Top             =   1320

          Width           =   255

       End

       Begin VB.CheckBox Check0

          Caption         =   "Check1"

          Height          =   225

          Index           =   6

          Left            =   5520

          TabIndex        =   34

          Top             =   840

          Width           =   255

       End

       Begin VB.CheckBox Check0

          Caption         =   "Check1"

          Height          =   225

          Index           =   5

          Left            =   5520

          TabIndex        =   33

          Top             =   360

          Width           =   255

       End

       Begin VB.CheckBox Check0

          Caption         =   "Check1"

          Height          =   225

          Index           =   4

          Left            =   720

          TabIndex        =   32

          Top             =   360

          Width           =   255

       End

       Begin VB.CheckBox Check0

          Caption         =   "Check1"

          Height          =   225

          Index           =   3

          Left            =   720

          TabIndex        =   31

          Top             =   840

          Width           =   255

       End

       Begin VB.CheckBox Check0

          Caption         =   "Check1"

          Height          =   255

          Index           =   2

          Left            =   720

          TabIndex        =   30

          Top             =   1320

          Width           =   255

       End

       Begin VB.CheckBox Check0

          Caption         =   "Check1"

          Height          =   225

          Index           =   1

          Left            =   720

          TabIndex        =   29

          Top             =   1800

          Width           =   255

       End

       Begin VB.CheckBox Check0

          Caption         =   "Check1"

          Height          =   225

          Index           =   0

          Left            =   5520

          TabIndex        =   28

          Top             =   1800

          Width           =   255

       End

       Begin VB.TextBox Text0

          Alignment       =   2  'Center

          Height          =   360

          Index           =   0

          Left            =   5880

          TabIndex        =   27

          Text            =   "0.0"

          Top             =   1680

          Width           =   735

       End

       Begin VB.Commanon command3

          Caption         =   "计算"

          Height          =   495

          Left            =   10080

          TabIndex        =   26

          Top             =   1560

          Width           =   855

       End

       Begin VB.VScrollBar VScroll1

          Height          =   345

          Index           =   7

          Left            =   9240

          Max             =   127

          Min             =   -127

          TabIndex        =   25

          Top             =   1200

          Width           =   255

       End

       Begin VB.VScrollBar VScroll1

          Height          =   345

          Index           =   6

          Left            =   9240

          Max             =   127

          Min             =   -127

          TabIndex        =   24

          Top             =   720

          Width           =   255

       End

       Begin VB.VScrollBar VScroll1

          Height          =   345

          Index           =   5

          Left            =   9240

          Max             =   127

          Min             =   -127

          TabIndex        =   23

          Top             =   240

          Width           =   255

       End

       Begin VB.VScrollBar VScroll1

          Height          =   345

          Index           =   4

          Left            =   4440

          Max             =   127

          Min             =   -127

          TabIndex        =   22

          Top             =   240

          Width           =   255

       End

       Begin VB.VScrollBar VScroll1

          Height          =   345

          Index           =   3

          Left            =   4440

          Max             =   127

          Min             =   -127

          TabIndex        =   21

          Top             =   720

          Width           =   255

       End

       Begin VB.VScrollBar VScroll1

          Height          =   345

          Index           =   2

          Left            =   4440

          Max             =   127

          Min             =   -127

          TabIndex        =   20

          Top             =   1200

          Width           =   255

       End

       Begin VB.VScrollBar VScroll1

          Height          =   345

          Index           =   1

          Left            =   4440

          Max             =   127

          Min             =   -127

          TabIndex        =   19

          Top             =   1680

          Width           =   255

       End

       Begin VB.Commanon Command2

          BeginProperty Font

             Name            =   "宋体"

             Size            =   9

             Charset         =   134

             Weight          =   400

             Underline       =   0   'False

             Italic          =   0   'False

             Strikethrough   =   0   'False

          EndProperty

          Height          =   375

          Index           =   0

          Left            =   10560

          Picture         =   "Factor_seting.frx":0874

          Style           =   1  'Graphical

          TabIndex        =   2

          Top             =   600

          Width           =   375

       End

       Begin VB.VScrollBar VScroll1

          Height          =   345

          Index           =   0

          Left            =   9240

          Max             =   127

          Min             =   -127

          TabIndex        =   0

          Top             =   1680

          Width           =   255

       End

       Begin VB.Label Label9

          Caption         =   "Ua"

          Height          =   255

          Left            =   360

          TabIndex        =   58

          Top             =   360

          Width           =   405

       End

       Begin VB.Label Label13

          Caption         =   "Ipa"

          Height          =   255

          Left            =   5160

          TabIndex        =   57

          Top             =   360

          Width           =   405

       End

       Begin VB.Label Label12

          Caption         =   "Ub"

          Height          =   255

          Left            =   360

          TabIndex        =   56

          Top             =   840

          Width           =   405

       End

       Begin VB.Label Label11

          Caption         =   "Ia"

          Height          =   255

          Left            =   360

          TabIndex        =   55

          Top             =   1800

          Width           =   405

       End

       Begin VB.Label Label10

          Caption         =   "Ipb"

          Height          =   255

          Left            =   5160

          TabIndex        =   54

          Top             =   840

          Width           =   405

       End

       Begin VB.Label Label8

          Caption         =   "Uc"

          Height          =   255

          Left            =   360

          TabIndex        =   53

          Top             =   1320

          Width           =   405

       End

       Begin VB.Label Label7

          Caption         =   "Ic"

          Height          =   255

          Left            =   5160

          TabIndex        =   52

          Top             =   1800

          Width           =   405

       End

       Begin VB.Label Label4

          Caption         =   "Ipc"

          Height          =   255

          Left            =   5160

          TabIndex        =   51

          Top             =   1320

          Width           =   405

       End

       Begin VB.Label Label2

          Alignment       =   2  'Center

          BackColor       =   &H80000005&

          Caption         =   "0.0"

          Height          =   330

          Index           =   7

          Left            =   7800

          TabIndex        =   50

          Top             =   1200

          Width           =   615

       End

       Begin VB.Label Label2

          Alignment       =   2  'Center

          BackColor       =   &H80000005&

          Caption         =   "0.0"

          Height          =   330

          Index           =   6

          Left            =   7800

          TabIndex        =   49

          Top             =   720

          Width           =   615

       End



    发帖须知:

    1,发帖请遵守《计算机信息网络国际联网安全保护管理办法》、《互联网信息服务管理办法》、 《互联网电子公告服务管理规定》、《维护互联网安全的决定》等法律法规。

    2,请对您的言论负责,我们将保留您的上网记录和发帖信息。

    3,在此发帖表示认同我们的条款,我们有权利对您的言论进行审核、删除或者采取其他在法律、地方法规等条款规定之内的管理操作。
    内容:
    验证: 验证码,看不清楚?请点击刷新验证码 * 匿名发表需要进行验证!
     
           
    中国面包师贴吧-中国烘焙师贴吧- 弹性深蓝色可爱版右侧悬浮qq在线客服代码
    在线咨询 x
    有什么可以帮到您
    点击咨询
    -粤ICP备13040473号-2