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

📄 24c02.frm

📁 十分好的一个医院管理系统
💻 FRM
字号:
VERSION 5.00
Begin VB.Form Form1 
   Caption         =   "AT24C02"
   ClientHeight    =   2010
   ClientLeft      =   60
   ClientTop       =   345
   ClientWidth     =   4650
   LinkTopic       =   "Form1"
   ScaleHeight     =   2010
   ScaleWidth      =   4650
   StartUpPosition =   3  'Windows Default
   Begin VB.TextBox Text2 
      Height          =   285
      Left            =   1680
      TabIndex        =   3
      Text            =   "Text2"
      Top             =   1320
      Width           =   2775
   End
   Begin VB.TextBox Text1 
      Height          =   285
      Left            =   1680
      TabIndex        =   2
      Text            =   "Text1"
      Top             =   480
      Width           =   2775
   End
   Begin VB.CommandButton Read 
      Caption         =   "Read"
      Height          =   495
      Left            =   240
      TabIndex        =   1
      Top             =   1200
      Width           =   1215
   End
   Begin VB.CommandButton Write 
      Caption         =   "Write"
      Height          =   495
      Left            =   240
      TabIndex        =   0
      Top             =   360
      Width           =   1215
   End
End
Attribute VB_Name = "Form1"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
'This program demostrates the usage of 24C01A/02 APIs.
'The APIs of 24C01A work with 24C02, the only difference is the address range.


'*****************************************************
'*
'* ReaderInitialization Functions
'*
'*****************************************************
        
Private Declare Function OpenPort Lib "micro900.dll" (ByVal PortName As String, ByRef PortHandle As Long) As Long
        
Private Declare Function ClosePort Lib "micro900.dll" () As Long
        
Private Declare Function SelectPort Lib "micro900.dll" (ByVal PortHandle As Long) As Long
        
Private Declare Function PowerOn Lib "micro900.dll" () As Long
        
Private Declare Function PowerOff Lib "micro900.dll" () As Long
        
Private Declare Function CardChanged Lib "micro900.dll" () As Long
        
Private Declare Function GetCardType Lib "micro900.dll" (ByRef atr As Byte) As Long
        
Private Declare Function GetCardName Lib "micro900.dll" (ByVal CardType As Long) As String
        
Private Declare Function CardPresent Lib "micro900.dll" () As Integer
        
        
'*****************************************************
'*
'* 24C02 functions
'*
'*****************************************************
Private Declare Function Read_AT24C01A _
            Lib "micro900.dll" (ByVal Address As Long, ByVal NOB As Long, ByRef data As Byte) As Long

Private Declare Function Write_AT24C01A_Byte _
            Lib "micro900.dll" (ByVal Address As Long, ByVal data As Byte) As Long

Private Declare Function Write_AT24C01A_Page _
            Lib "micro900.dll" (ByVal Address As Long, ByVal NOB As Long, ByRef data As Byte) As Long
Dim NewData As Integer


Private Sub Form_Load()
    Dim result As Long
    Dim PortHandle As Long
    result = OpenPort("COM1", PortHandle)
    result = PowerOn()
End Sub

Private Sub Form_Unload(Cancel As Integer)
   Dim result As Long
   result = PowerOff()
   result = ClosePort()
   End
End Sub

Private Sub Read_Click()
    Dim atr(4) As Byte
    Dim data(10) As Byte
    
    If CardPresent() <> 1 Then
        MsgBox "Please insert card"
    Else
        result = GetCardType(atr(0))
        result = Read_AT24C01A(0, 8, data(0))
        Text2.Text = Hex(data(0))
    End If
End Sub

Private Sub Write_Click()
    Dim atr(4) As Byte
    Dim data(10) As Byte
    NewData = NewData + 1
    data(0) = NewData
    
    If CardPresent() <> 1 Then
        MsgBox "Please insert card"
    Else
        result = GetCardType(atr(0))
        result = Write_AT24C01A_Page(0, 8, data(0))
        Text1.Text = Hex(NewData)
    End If
End Sub

⌨️ 快捷键说明

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