?? frmstatusregister.frm
字號(hào):
VERSION 5.00
Begin VB.Form frmStatusRegister
Caption = "Status Register"
ClientHeight = 4275
ClientLeft = 60
ClientTop = 345
ClientWidth = 8100
Icon = "frmStatusRegister.frx":0000
LinkTopic = "Form1"
ScaleHeight = 4275
ScaleWidth = 8100
StartUpPosition = 1 'CenterOwner
Begin VB.CommandButton cmdRecallRead31h
Caption = "Read Initialization (31h)"
Height = 375
Left = 3480
TabIndex = 26
Top = 3360
Width = 2175
End
Begin VB.CommandButton cmdRefresh
Caption = "Refresh Status"
Height = 375
Left = 1200
TabIndex = 25
Top = 3600
Width = 2175
End
Begin VB.CommandButton cmdCopy
Caption = "Write Initialization (31h)"
Height = 375
Left = 5760
TabIndex = 15
Top = 3360
Width = 2175
End
Begin VB.CommandButton cmdRead1
Caption = "Read Address 01h"
Height = 375
Left = 3480
TabIndex = 14
Top = 3840
Width = 2175
End
Begin VB.CommandButton cmdCancel
Caption = "Done"
Height = 375
Left = 5760
TabIndex = 10
Top = 3840
Width = 2175
End
Begin VB.Frame Frame1
Height = 3255
Left = 0
TabIndex = 0
Top = 0
Width = 8055
Begin VB.CommandButton cmdClearCSTAT
Caption = "Clear CSTAT"
Height = 495
Left = 3840
TabIndex = 27
Top = 160
Width = 855
End
Begin VB.ComboBox cmbCTYPE
Height = 315
Left = 4800
TabIndex = 22
Top = 2700
Width = 3015
End
Begin VB.ComboBox cmbCINI
Height = 315
Left = 4800
TabIndex = 21
Top = 2085
Width = 3015
End
Begin VB.ComboBox cmbCSTAT
Height = 315
Left = 4800
TabIndex = 13
Top = 285
Width = 3015
End
Begin VB.ComboBox cmbRNAOP
Height = 315
Left = 4800
TabIndex = 12
Top = 1485
Width = 3015
End
Begin VB.ComboBox cmbPMOD
Height = 315
ItemData = "frmStatusRegister.frx":030A
Left = 4800
List = "frmStatusRegister.frx":030C
TabIndex = 11
Top = 885
Width = 3015
End
Begin VB.Label Label16
BackStyle = 0 'Transparent
Caption = "Charge Type is :"
Height = 255
Left = 2160
TabIndex = 24
Top = 2760
Width = 2415
End
Begin VB.Label Label12
BackStyle = 0 'Transparent
Caption = "Charge is Initiated by :"
Height = 255
Left = 2160
TabIndex = 23
Top = 2160
Width = 2415
End
Begin VB.Label Label15
Alignment = 2 'Center
BackStyle = 0 'Transparent
Caption = "CTYPE"
Height = 255
Left = 840
TabIndex = 20
Top = 2760
Width = 1095
End
Begin VB.Label Label14
Alignment = 2 'Center
BackStyle = 0 'Transparent
Caption = "CINI"
Height = 255
Left = 840
TabIndex = 19
Top = 2160
Width = 1095
End
Begin VB.Label Label13
Alignment = 2 'Center
BackStyle = 0 'Transparent
Caption = "CSTAT0"
Height = 255
Left = 840
TabIndex = 18
Top = 480
Width = 1095
End
Begin VB.Line Line7
BorderColor = &H80000003&
X1 = 0
X2 = 8040
Y1 = 720
Y2 = 720
End
Begin VB.Line Line5
BorderColor = &H80000003&
X1 = 0
X2 = 8040
Y1 = 2520
Y2 = 2520
End
Begin VB.Label Label11
BackStyle = 0 'Transparent
Caption = "Bit 0"
Height = 255
Left = 240
TabIndex = 17
Top = 2760
Width = 615
End
Begin VB.Label Label10
BackStyle = 0 'Transparent
Caption = "Bit 1"
Height = 255
Left = 240
TabIndex = 16
Top = 2160
Width = 615
End
Begin VB.Label Label9
BackStyle = 0 'Transparent
Caption = "Charge Status is :"
Height = 255
Left = 2160
TabIndex = 9
Top = 360
Width = 2415
End
Begin VB.Label Label8
BackStyle = 0 'Transparent
Caption = "Read Net Address Opcode Set to :"
Height = 255
Left = 2160
TabIndex = 8
Top = 1560
Width = 2655
End
Begin VB.Label Label7
BackStyle = 0 'Transparent
Caption = "Sleep Mode is : "
Height = 255
Left = 2160
TabIndex = 7
Top = 960
Width = 1455
End
Begin VB.Label Label4
BackStyle = 0 'Transparent
Caption = "Bit 4"
Height = 255
Left = 240
TabIndex = 6
Top = 1560
Width = 615
End
Begin VB.Label Label3
Alignment = 2 'Center
BackStyle = 0 'Transparent
Caption = "Bit 7 , 6"
Height = 255
Left = 0
TabIndex = 5
Top = 360
Width = 855
End
Begin VB.Label Label1
BackStyle = 0 'Transparent
Caption = "Bit 5"
Height = 255
Left = 240
TabIndex = 4
Top = 960
Width = 615
End
Begin VB.Line Line4
BorderColor = &H80000003&
X1 = 0
X2 = 8040
Y1 = 1920
Y2 = 1920
End
Begin VB.Line Line3
BorderColor = &H80000003&
X1 = 0
X2 = 8040
Y1 = 1320
Y2 = 1320
End
Begin VB.Label Label6
Alignment = 2 'Center
BackStyle = 0 'Transparent
Caption = "CSTAT1"
Height = 255
Left = 840
TabIndex = 3
Top = 240
Width = 1095
End
Begin VB.Label Label5
Alignment = 2 'Center
BackStyle = 0 'Transparent
Caption = "RNAOP"
Height = 255
Left = 840
TabIndex = 2
Top = 1560
Width = 1095
End
Begin VB.Line Line2
BorderColor = &H80000003&
X1 = 1920
X2 = 1920
Y1 = 120
Y2 = 3840
End
Begin VB.Line Line1
BorderColor = &H80000003&
X1 = 840
X2 = 840
Y1 = 120
Y2 = 3720
End
Begin VB.Label Label2
Alignment = 2 'Center
BackStyle = 0 'Transparent
Caption = "PMOD"
Height = 255
Left = 840
TabIndex = 1
Top = 960
Width = 1095
End
End
End
Attribute VB_Name = "frmStatusRegister"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Dim lStatus As Integer
Private Sub cmdCancel_Click()
Unload Me
End Sub
Private Sub cmdClearCSTAT_Click()
ReadBytes 1, 1
DataIn(1) = DataRead(1) And &H3F
WriteBytes 1, 1
cmdRead1_Click
End Sub
Private Sub cmdCopy_Click()
Dim SRAM(16) As Integer
Dim i As Integer
MousePointer = 11
lStatus = 0
If cmbCSTAT.Text = "Charge sequence completed" Then
lStatus = lStatus + &HC0
ElseIf cmbCSTAT.Text = "Charge source is present" Then
lStatus = lStatus + &H80
ElseIf cmbCSTAT.Text = "Charge in progress" Then
lStatus = lStatus + &H40
End If
If cmbPMOD.Text = "Enabled" Then
lStatus = lStatus + &H20
End If
If cmbRNAOP.Text = "39h" Then
lStatus = lStatus + &H10
End If
If cmbCINI.Text = "Command or Charge Source" Then
lStatus = lStatus + &H2
End If
If cmbCTYPE.Text = "NiMH Charger" Then
lStatus = lStatus + &H1
End If
DataIn(49) = lStatus
WriteBytes 49, 1
ReadBytes 48, 16
For i = 0 To 15
SRAM(i) = DataRead(i + 48)
Next i
RecallBytes 48
ReadBytes 48, 16
For i = 0 To 15
DataIn(i + 48) = DataRead(i + 48)
Next i
DataIn(49) = SRAM(1)
WriteBytes 48, 16
CopyBytes 48
For i = 0 To 15
DataIn(i + 48) = SRAM(i)
Next i
WriteBytes 48, 16
MousePointer = 0
End Sub
Private Sub cmdRead1_Click()
ReadBytes 1, 1
lStatus = DataRead(1)
If (lStatus And &HC0) = &HC0 Then
cmbCSTAT.Text = "Charge sequence completed"
cmdClearCSTAT.Visible = True
ElseIf (lStatus And &HC0) = &H80 Then
cmbCSTAT.Text = "Charge source is present"
cmdClearCSTAT.Visible = False
ElseIf (lStatus And &HC0) = &H40 Then
cmbCSTAT.Text = "Charge in progress"
cmdClearCSTAT.Visible = False
Else
cmbCSTAT.Text = "No charge source present"
cmdClearCSTAT.Visible = False
End If
If (lStatus And &H20) = &H20 Then
cmbPMOD.Text = "Enabled"
Else
cmbPMOD.Text = "Disabled"
End If
If (lStatus And &H10) = &H10 Then
cmbRNAOP.Text = "39h"
Else
cmbRNAOP.Text = "33h"
End If
If (lStatus And &H2) = &H2 Then
cmbCINI.Text = "Command or Charge Source"
Else
cmbCINI.Text = "Command Only"
End If
If (lStatus And &H1) = &H1 Then
cmbCTYPE.Text = "NiMH Charger"
Else
cmbCTYPE.Text = "Li-Ion Charger"
End If
End Sub
Private Sub cmdRefresh_Click()
RefreshStatus
cmdRead1_Click
End Sub
Private Sub cmdRecallRead31h_Click()
RecallBytes &H30
ReadBytes &H31, 1
lStatus = DataRead(&H31)
If (lStatus And &HC0) = &HC0 Then
cmbCSTAT.Text = "Charge sequence completed"
ElseIf (lStatus And &HC0) = &H80 Then
cmbCSTAT.Text = "Charge source is present"
ElseIf (lStatus And &HC0) = &H40 Then
cmbCSTAT.Text = "Charge in progress"
Else
cmbCSTAT.Text = "No charge source present"
End If
If (lStatus And &H20) = &H20 Then
cmbPMOD.Text = "Enabled"
Else
cmbPMOD.Text = "Disabled"
End If
If (lStatus And &H10) = &H10 Then
cmbRNAOP.Text = "39h"
Else
cmbRNAOP.Text = "33h"
End If
If (lStatus And &H2) = &H2 Then
cmbCINI.Text = "Command or Charge Source"
Else
cmbCINI.Text = "Command Only"
End If
If (lStatus And &H1) = &H1 Then
cmbCTYPE.Text = "NiMH Charger"
Else
cmbCTYPE.Text = "Li-Ion Charger"
End If
End Sub
Private Sub Form_Load()
cmbPMOD.AddItem "Disabled", 0
cmbPMOD.AddItem "Enabled", 1
cmbRNAOP.AddItem "33h", 0
cmbRNAOP.AddItem "39h", 1
cmbCSTAT.AddItem "No charge source present", 0
cmbCSTAT.AddItem "Charge in progress", 1
cmbCSTAT.AddItem "Charge source is present", 2
cmbCSTAT.AddItem "Charge sequence completed", 3
cmbCINI.AddItem "Command Only", 0
cmbCINI.AddItem "Command or Charge Source", 1
cmbCTYPE.AddItem "Li-Ion Charger", 0
cmbCTYPE.AddItem "NiMH Charger", 1
cmdRead1_Click
End Sub
?? 快捷鍵說(shuō)明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號(hào)
Ctrl + =
減小字號(hào)
Ctrl + -