📄 form2.frm
字号:
End
Begin VB.Label Label5
Caption = "UID3:"
Height = 255
Left = 3360
TabIndex = 14
Top = 2520
Width = 495
End
Begin VB.Label Label6
Caption = "UID4:"
Height = 375
Left = 3360
TabIndex = 13
Top = 3000
Width = 735
End
End
Attribute VB_Name = "Form2"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private Sub Command1_Click()
Dim i&, j%, port&, baud&, buf1(200) As Byte, b1 As Byte, s1$
port = cb_ckh.ListIndex + 1
If (port = 0) Then
lb_info.Caption = "Select COM Port Please!"
End If
baud = CLng(cb_btl.Text)
If (baud = 0) Then
lb_info.Caption = "Select Baud Rate Please!"
End If
'打开串口
i = rf_init_com(port, baud)
If (i <> 0) Then
lb_info.Caption = "Open Port Fail!"
Exit Sub
Else: lb_info.Caption = "Open Port Success!"
End If
End Sub
Private Sub Command10_Click()
Dim i&, m&, buf1(200) As Byte, buf2(200) As Byte, pData$, b1 As Byte, b2 As Byte, b3 As Byte
'参数: icdev: [In] 通讯设备标识符
'model: [In] bit0 = Select_flag, bit1 = Addres_flag, bit2 = Option_flag
' pUID: [IN] UID 8字节
'block: [In] 块号
' number: [IN] 要读取的块数,< 0x10
'pData: [OUT] 读出的数据
'pLen: [OUT] 读出数据的长度
'返回: 成功则返回0
'说明:如Select_flag = 1,只有处于SELECT状态的卡都将执行该命令
' 如Addres_flag = 1,只有UID符合的卡执行该命令
' 设Option_flag = 0
s1 = Text1.Text
For i = 0 To 7
buf1(i) = Val("&H" & Mid(s1, i * 2 + 1, 2))
Next i
i = ISO15693_Read(0, 2, buf1(0), Combo2.ListIndex, 1, buf2(0), b3)
For i = 0 To b3 - 1
pData = pData & Right("00" & Hex(buf2(i)), 2)
Next i
Text6.Text = pData
' 0 为设备地址,常为“0”;"2" 表示操作UID 对应的卡;buf1 为UID ;b1 为起始块号;b2 为要测多少块;
' buf2 为读回来的数据; b3 为返回字节的长度.
End Sub
Private Sub Command11_Click()
'功能: ISO15693_Write
'原型:int WINAPI ISO15693_Write(unsigned short icdev,
' unsigned char model,
' unsigned char *pUID,
' unsigned char block,
' unsigned char *pData);
'参数: icdev: [In] 通讯设备标识符
'model: [In] bit0 = Select_flags, bit1 = Addres_flags
' pUID: [IN] UID 8字节
'block: [In] 块号
' pData: [IN] 要写入的数据,4字节'
'返回: 成功则返回0
Dim i&, m&, buf1(200) As Byte, buf2(200) As Byte, pData$, b1 As Byte, b2 As Byte, b3 As Byte
s1 = Text1.Text
For i = 0 To 7
buf1(i) = Val("&H" & Mid(s1, i * 2 + 1, 2))
Next i
s1 = Text6.Text
For i = 0 To 4
buf2(i) = Val("&H" & Mid(s1, i * 2 + 1, 2))
Next i
i = ISO15693_Write(0, 6, buf1(0), 0, buf2(0))
' 0 为设备地址,常为“0”;"2" 表示操作UID 对应的卡;buf1 为UID ;b1 为起始块号;
' buf2 要写入对应块的值 ;
End Sub
Private Sub Command12_Click()
Dim i&, m&, buf1(200) As Byte, buf2(200) As Byte, pData$, b1 As Byte, b2 As Byte, b3 As Byte
i = ISO15693_Write_AFI(0, 2, buf1(0), buf1(0))
End Sub
Private Sub Command13_Click()
Dim i&, m&, buf1(200) As Byte, buf2(200) As Byte, pData$, b1 As Byte, b2 As Byte, b3 As Byte
'功能: ISO15693_Lock_Block
'原型:int WINAPI ISO15693_Lock_Block(unsigned short icdev,
' unsigned char model,
' unsigned char *pUID,
' unsigned char block)
'参数: icdev: [In] 通讯设备标识符
'model: [In] bit0 = Select_flags, bit1 = Addres_flags
' pUID: [IN] UID 8字节
'block: [In] 块号
'返回: 成功则返回0
i = ISO15693_Lock_Block(0, 2, buf1(0), b1)
End Sub
Private Sub Command14_Click()
Dim i&, m&, buf1(200) As Byte, buf2(200) As Byte, pData$, b1 As Byte, b2 As Byte, b3 As Byte
'功能: ISO15693_Lock_AFI
'原型:int WINAPI ISO15693_Lock_AFI(unsigned short icdev,
' unsigned char model,
' unsigned char *pUID)
'参数: icdev: [In] 通讯设备标识符
'model: [In] bit0 = Select_flags, bit1 = Addres_flags
' pUID: [IN] UID 8字节
'返回: 成功则返回0
i = ISO15693_Lock_AFI(0, 2, buf1(0))
End Sub
Private Sub Command15_Click()
Dim i&, m&, buf1(200) As Byte, buf2(200) As Byte, pData$, b1 As Byte, b2 As Byte, b3 As Byte
'功能: ISO15693_Write_DSFID
'原型:int WINAPI ISO15693_Write_DSFID(unsigned short icdev,
' unsigned char model,
' unsigned char *UID,
' unsigned char DSFID)
'参数: icdev: [In] 通讯设备标识符
'model: [In] bit0 = Select_flags, bit1 = Addres_flags
' pUID: [IN] UID 8字节
'DSFID: [In] 要写入的DSFID
'返回: 成功则返回0
i = ISO15693_Write_DSFID(0, 2, buf1(0), buf2(0))
End Sub
Private Sub Command16_Click()
Dim i&, m&, buf1(200) As Byte, buf2(200) As Byte, pData$, b1 As Byte, b2 As Byte, b3 As Byte
'功能: ISO15693_Lock_DSFID
'原型:int WINAPI ISO15693_Lock_DSFID(unsigned short icdev,
' unsigned char model,
' unsigned char *pUID)
'参数: icdev: [In] 通讯设备标识符
'model: [In] bit0 = Select_flags, bit1 = Addres_flags
' pUID: [IN] UID 8字节
'返回: 成功则返回0
i = ISO15693_Lock_DSFID(0, 2, buf1(0))
End Sub
Private Sub Command2_Click()
Dim i&
i = rf_ClosePort()
If (i <> 0) Then
lb_info.Caption = "Close Port Fail!"
Exit Sub
Else: lb_info.Caption = "Close Port Success!"
End If
End Sub
Private Sub Command3_Click()
Dim i&, m&, buf1(200) As Byte, buf2(200) As Byte, pData$, b1 As Byte, b2 As Byte, b3 As Byte
i = ISO15693_Inventorys(0, buf2(0), b2)
If (i <> 0) Then
lb_info.Caption = "Find Card Fail!"
Exit Sub
End If
For i = 0 To b2 - 1
pData = pData & Right("00" & Hex(buf2(i)), 2)
Next i
If (b2 = 9) Then
Text1 = Mid(pData, 3, 16)
Text2 = ""
Text3 = ""
Text4 = ""
lb_info.Caption = "Find A Card!"
End If
If (b2 = 18) Then
Text1 = Mid(pData, 3, 16)
Text2 = Mid(pData, 21, 16)
Text3 = ""
Text4 = ""
lb_info.Caption = "Find Two Piece Card!"
End If
If (b2 = 27) Then
Text1 = Mid(pData, 3, 16)
Text2 = Mid(pData, 21, 16)
Text3 = Mid(pData, 39, 16)
Text4 = ""
lb_info.Caption = "Find Three Piece Card!"
End If
If (b2 = 36) Then
Text1 = Mid(pData, 3, 16)
Text2 = Mid(pData, 21, 16)
Text3 = Mid(pData, 39, 16)
Text4 = Mid(pData, 57, 16)
lb_info.Caption = "Find Four Piece Card!"
End If
End Sub
Private Sub Command4_Click()
Dim i&, m&, buf1(200) As Byte, buf2(200) As Byte, pData$, b1 As Byte, b2 As Byte, b3 As Byte
i = ISO15693_Select(0, buf1(0)) '如读卡器上只有一张卡这个命令用不着,buf1(0) 为某一张卡UID的首地址。
End Sub
Private Sub Command5_Click()
Dim i&, m&, buf1(200) As Byte, buf2(200) As Byte, pData$, b1 As Byte, b2 As Byte, b3 As Byte
i = ISO15693_Inventory(0, buf2(0), b2)
If (i <> 0) Then
lb_info.Caption = "Find Card Fail!"
Exit Sub
End If
For i = 0 To b2 - 1
pData = pData & Right("00" & Hex(buf2(i)), 2)
Next i
If (b2 = 9) Then
Text1 = Mid(pData, 3, 16)
Text2 = ""
Text3 = ""
Text4 = ""
lb_info.Caption = "Find A Card!"
End If
End Sub
Private Sub Command6_Click()
Dim i&, m&, buf1(200) As Byte, buf2(200) As Byte, pData$, b1 As Byte, b2 As Byte, b3 As Byte
'请注意,针对你现在用的卡,model =0,即cobo1.listindex=0 才行。
' b3 = Val(Text8.Text)
i = ISO15693_Get_System_Information(0, 0, buf1(0), buf2(0), b2)
If (i <> 0) Then
lb_info.Caption = "Get System Information Fail!"
Exit Sub
End If
For i = 0 To b2 - 1
pData = pData & Right("00" & Hex(buf2(i)), 2)
Next i
Text7 = Mid(pData, 3, 16)
lb_info.Caption = "Get Information Success!"
End Sub
Private Sub Command7_Click()
Dim i&, m&, buf1(200) As Byte, buf2(200) As Byte, pData$, b1 As Byte, b2 As Byte, b3 As Byte
i = ISO15693_Stay_Quiet(0, buf1(0))
End Sub
Private Sub Command8_Click()
Dim i&, m&, buf1(200) As Byte, buf2(200) As Byte, pData$, b1 As Byte, b2 As Byte, b3 As Byte
i = ISO15693_Reset_To_Ready(0, 2, buf1(0)) 'model=2 表示相同UID 的卡片才能接受此命令
End Sub
Private Sub Command9_Click()
Dim i&, m&, buf1(200) As Byte, buf2(200) As Byte, pData$, b1 As Byte, b2 As Byte, b3 As Byte
' 返回的数据为零对应的块未锁定,非零锁定
i = ISO15693_Get_Block_Security(0, 2, buf1(0), b1, b2, buf2(0), b3)
' 0 为设备地址,常为“0”;"2" 表示操作UID 对应的卡;buf1 为UID ;b1 为起始块号;b2 为要测多少块;
' buf2 为返回值,为零对应的块未锁定 ; B3 为返回字节的长度.
End Sub
Private Sub Form_Load()
Combo1.ListIndex = 0
cb_ckh.ListIndex = 0: cb_btl.ListIndex = 1
Combo2.ListIndex = 0
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -