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

📄 frmeepromregister.frm

📁 利用VB开发的针对Maxim-Dallas DS2770电量检测芯片
💻 FRM
字号:
VERSION 5.00
Begin VB.Form frmEEPROMRegister 
   Caption         =   "EEPROM Register"
   ClientHeight    =   4185
   ClientLeft      =   60
   ClientTop       =   345
   ClientWidth     =   5205
   Icon            =   "frmEEPROMRegister.frx":0000
   LinkTopic       =   "Form1"
   ScaleHeight     =   4185
   ScaleWidth      =   5205
   StartUpPosition =   1  'CenterOwner
   Begin VB.CommandButton cmdWriteRegister 
      Caption         =   "Write Register"
      Height          =   375
      Left            =   1200
      TabIndex        =   19
      Top             =   3240
      Width           =   1935
   End
   Begin VB.CommandButton cmdReadRegister 
      Caption         =   "Read Register"
      Height          =   375
      Left            =   3240
      TabIndex        =   18
      Top             =   3240
      Width           =   1935
   End
   Begin VB.CommandButton cmdDone 
      Caption         =   "Done"
      Height          =   375
      Left            =   3240
      TabIndex        =   17
      Top             =   3720
      Width           =   1935
   End
   Begin VB.Frame Frame1 
      Height          =   3135
      Left            =   0
      TabIndex        =   0
      Top             =   0
      Width           =   5175
      Begin VB.ComboBox cmbLOCK 
         Height          =   315
         Left            =   3360
         TabIndex        =   10
         Top             =   880
         Width           =   1695
      End
      Begin VB.Line Line1 
         BorderColor     =   &H80000003&
         X1              =   0
         X2              =   5760
         Y1              =   1920
         Y2              =   1920
      End
      Begin VB.Label Label16 
         BackStyle       =   0  'Transparent
         Caption         =   "Bit 0"
         Height          =   255
         Left            =   240
         TabIndex        =   23
         Top             =   2760
         Width           =   615
      End
      Begin VB.Label lblBL2 
         BackStyle       =   0  'Transparent
         ForeColor       =   &H00FF0000&
         Height          =   255
         Left            =   3360
         TabIndex        =   22
         Top             =   1560
         Width           =   2895
      End
      Begin VB.Label Label7 
         BackStyle       =   0  'Transparent
         Caption         =   "Block 2 is : "
         Height          =   255
         Left            =   2040
         TabIndex        =   21
         Top             =   1560
         Width           =   1215
      End
      Begin VB.Label Label3 
         Alignment       =   2  'Center
         BackStyle       =   0  'Transparent
         Caption         =   "BL2"
         Height          =   255
         Left            =   840
         TabIndex        =   20
         Top             =   1560
         Width           =   1095
      End
      Begin VB.Label lblBL0 
         BackStyle       =   0  'Transparent
         ForeColor       =   &H00FF0000&
         Height          =   255
         Left            =   3360
         TabIndex        =   16
         Top             =   2760
         Width           =   2895
      End
      Begin VB.Label Label15 
         Alignment       =   2  'Center
         BackStyle       =   0  'Transparent
         Caption         =   "BL0"
         Height          =   255
         Left            =   840
         TabIndex        =   15
         Top             =   2760
         Width           =   1095
      End
      Begin VB.Label Label14 
         BackStyle       =   0  'Transparent
         Caption         =   "Bit 1"
         Height          =   255
         Left            =   240
         TabIndex        =   14
         Top             =   2160
         Width           =   615
      End
      Begin VB.Label Label13 
         BackStyle       =   0  'Transparent
         Caption         =   "Block 0 is : "
         Height          =   255
         Left            =   2040
         TabIndex        =   13
         Top             =   2760
         Width           =   1215
      End
      Begin VB.Label Label8 
         BackStyle       =   0  'Transparent
         Caption         =   "Block 1 is : "
         Height          =   255
         Left            =   2040
         TabIndex        =   12
         Top             =   2160
         Width           =   1215
      End
      Begin VB.Label Label6 
         BackStyle       =   0  'Transparent
         Caption         =   "Copy Flag is : "
         Height          =   255
         Left            =   2040
         TabIndex        =   11
         Top             =   360
         Width           =   1455
      End
      Begin VB.Label lblBL1 
         BackStyle       =   0  'Transparent
         ForeColor       =   &H00FF0000&
         Height          =   255
         Left            =   3360
         TabIndex        =   9
         Top             =   2160
         Width           =   2895
      End
      Begin VB.Label Label5 
         BackStyle       =   0  'Transparent
         Caption         =   "Lock Enable is : "
         Height          =   255
         Left            =   2040
         TabIndex        =   8
         Top             =   960
         Width           =   1935
      End
      Begin VB.Label lblEEC 
         BackStyle       =   0  'Transparent
         ForeColor       =   &H00FF0000&
         Height          =   255
         Left            =   3360
         TabIndex        =   7
         Top             =   360
         Width           =   1695
      End
      Begin VB.Label Label4 
         BackStyle       =   0  'Transparent
         Caption         =   "Bit 2"
         Height          =   255
         Left            =   240
         TabIndex        =   6
         Top             =   1560
         Width           =   615
      End
      Begin VB.Label Label2 
         BackStyle       =   0  'Transparent
         Caption         =   "Bit 6"
         Height          =   255
         Left            =   240
         TabIndex        =   5
         Top             =   960
         Width           =   615
      End
      Begin VB.Label Label1 
         BackStyle       =   0  'Transparent
         Caption         =   "Bit 7"
         Height          =   255
         Left            =   240
         TabIndex        =   4
         Top             =   360
         Width           =   615
      End
      Begin VB.Line Line5 
         BorderColor     =   &H80000003&
         X1              =   840
         X2              =   840
         Y1              =   120
         Y2              =   4920
      End
      Begin VB.Line Line6 
         BorderColor     =   &H80000003&
         X1              =   1920
         X2              =   1920
         Y1              =   120
         Y2              =   4920
      End
      Begin VB.Line Line7 
         BorderColor     =   &H80000003&
         X1              =   0
         X2              =   5760
         Y1              =   720
         Y2              =   720
      End
      Begin VB.Line Line8 
         BorderColor     =   &H80000003&
         X1              =   0
         X2              =   5760
         Y1              =   1320
         Y2              =   1320
      End
      Begin VB.Line Line9 
         BorderColor     =   &H80000003&
         X1              =   0
         X2              =   5760
         Y1              =   2520
         Y2              =   2520
      End
      Begin VB.Label Label9 
         Alignment       =   2  'Center
         BackStyle       =   0  'Transparent
         Caption         =   "EEC"
         Height          =   255
         Left            =   840
         TabIndex        =   3
         Top             =   360
         Width           =   1095
      End
      Begin VB.Label Label10 
         Alignment       =   2  'Center
         BackStyle       =   0  'Transparent
         Caption         =   "LOCK"
         Height          =   255
         Left            =   840
         TabIndex        =   2
         Top             =   960
         Width           =   1095
      End
      Begin VB.Label Label12 
         Alignment       =   2  'Center
         BackStyle       =   0  'Transparent
         Caption         =   "BL1"
         Height          =   255
         Left            =   840
         TabIndex        =   1
         Top             =   2160
         Width           =   1095
      End
   End
End
Attribute VB_Name = "frmEEPROMRegister"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Dim lEEPROM As Integer

Private Sub cmdDone_Click()
    Unload Me
End Sub

Private Sub cmdReadRegister_Click()
    ReadBytes 7, 1
    lEEPROM = DataRead(7)
    
    If (lEEPROM And &H80) = &H80 Then
        lblEEC.Caption = "Set"
    Else
        lblEEC.Caption = "Clear"
    End If
    
    If (lEEPROM And &H40) = &H40 Then
        cmbLOCK.Text = "Enabled"
    Else
        cmbLOCK.Text = "Disabled"
    End If
    
    If (lEEPROM And &H4) = &H4 Then
        lblBL2.Caption = "Locked"
    Else
        lblBL2.Caption = "Unlocked"
    End If
    
    If (lEEPROM And &H2) = &H2 Then
        lblBL1.Caption = "Locked"
    Else
        lblBL1.Caption = "Unlocked"
    End If
    
    If (lEEPROM And &H1) = &H1 Then
        lblBL0.Caption = "Locked"
    Else
        lblBL0.Caption = "Unlocked"
    End If
End Sub

Private Sub cmdWriteRegister_Click()
    MousePointer = 11
    If cmbLOCK.Text = "Enabled" Then
        lEEPROM = lEEPROM Or &H40
    Else
        lEEPROM = lEEPROM And &HBF
    End If
    
    DataIn(7) = lEEPROM
    WriteBytes 7, 1
    cmdReadRegister_Click
    MousePointer = 0
End Sub

Private Sub Form_Load()
    cmbLOCK.AddItem "Disabled", 0
    cmbLOCK.AddItem "Enabled", 1
    cmdReadRegister_Click
End Sub

⌨️ 快捷键说明

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