📄 demokitmodule.bas
字号:
Attribute VB_Name = "DemokitModule"
Declare Function mifsw_init% Lib "mfserial.dll" (ByVal comstr%, ByVal baudrate As Long)
Declare Function mifsw_config% Lib "mfserial.dll" (ByVal mode%, ByVal baud%)
Declare Function mifsw_exit% Lib "mfserial.dll" ()
Declare Function mifsw_load_key% Lib "mfserial.dll" (ByVal mode%, ByVal keynr%, ByRef TKey As Byte, ByRef Nkey As Byte)
Declare Function mifsw_request_2% Lib "mfserial.dll" (ByVal mode%, tagtype%)
Declare Function mifsw_anticoll% Lib "mfserial.dll" (ByVal Bcnt%, snr&)
Declare Function mifsw_select% Lib "mfserial.dll" (ByVal snr&, Size As Byte)
Declare Function mifsw_authentication% Lib "mfserial.dll" (ByVal mode%, ByVal SecNr%)
Declare Function mifsw_authentication_2% Lib "mfserial.dll" (ByVal mode%, ByVal keynr$, ByVal Addr$)
Declare Function mifsw_read% Lib "mfserial.dll" (ByVal Addr%, rdata As Byte)
Declare Function mifsw_write% Lib "mfserial.dll" (ByVal Addr%, ByRef Wdata As Byte)
Declare Function mifsw_halt% Lib "mfserial.dll" ()
Declare Function mifsw_unhalt% Lib "mfserial.dll" ()
Declare Function mifsw_increment% Lib "mfserial.dll" (ByVal Addr%, ByVal value&)
Declare Function mifsw_transfer% Lib "mfserial.dll" (ByVal Addr%)
Declare Function mifsw_decrement% Lib "mfserial.dll" (ByVal Addr%, ByVal value&)
Declare Function mifsw_restore% Lib "mfserial.dll" (ByVal Addr%)
Global commport As Variant
Global baudrate As Variant
Global MifStatus As Integer
Global snr As Long
Global snr1 As Long
Global snr2 As Long
Global tagtype As Integer
Global Size(0 To 7) As Byte
Global keynr(0 To 5) As Byte
Global Addr As Integer
Global SecNr As Integer
Global rdata(0 To 15) As Byte
Global rdatamiflight(0 To 7) As Byte
Global TKey(0 To 6, 0 To 15) As Byte
Global nKeyA(0 To 5) As Byte
Global nKeyB(0 To 5) As Byte
Global Blockstatus As Byte
Global MifLightPage As Byte
Global loadkeystatus As Byte
Global valuestatus As Byte
Global mode As Byte
Global modestring As String
Private Function Loadkey()
'There are all together 6 mode(keysets),i.e mode 0,1,2,4,5,6
'KeyA KeySet0 = mode 0 'KeyB KeySet0 = mode 4
'KeyA KeySet1 = mode 1 'KeyB KeySet1 = mode 5
'KeyA KeySet2 = mode 2 'KeyB KeySet2 = mode 6
'mifsw_load_key(mode,keynumber,transportkey,newkey)
'This example only loads Key Set into mode 0(KEYA KEYSET0) for 16 sectors (sector 0 to 15)
Dim intkeynr As Integer
Dim i As Integer
'********Transport Key(common for all keysets) ********************
'TKey(byte, secno)
TKey(0, 0) = &HBD
TKey(1, 0) = &HDE
TKey(2, 0) = &H6F
TKey(3, 0) = &H37
TKey(4, 0) = &H83
TKey(5, 0) = &H83
TKey(0, 1) = (&H14)
TKey(1, 1) = (&H8A)
TKey(2, 1) = (&HC5)
TKey(3, 1) = (&HE2)
TKey(4, 1) = (&H28)
TKey(5, 1) = (&H28)
TKey(0, 2) = (&H7D)
TKey(1, 2) = (&H3E)
TKey(2, 2) = (&H9F)
TKey(3, 2) = (&H4F)
TKey(4, 2) = (&H95)
TKey(5, 2) = (&H95)
TKey(0, 3) = (&HAD)
TKey(1, 3) = (&HD6)
TKey(2, 3) = (&H6B)
TKey(3, 3) = (&H35)
TKey(4, 3) = (&HC8)
TKey(5, 3) = (&HC8)
TKey(0, 4) = (&HDF)
TKey(1, 4) = (&HEF)
TKey(2, 4) = (&H77)
TKey(3, 4) = (&HBB)
TKey(4, 4) = (&HE4)
TKey(5, 4) = (&HE4)
TKey(0, 5) = (&H9)
TKey(1, 5) = (&H84)
TKey(2, 5) = (&H42)
TKey(3, 5) = (&H21)
TKey(4, 5) = (&HBC)
TKey(5, 5) = (&HBC)
TKey(0, 6) = (&H5F)
TKey(1, 6) = (&HAF)
TKey(2, 6) = (&HD7)
TKey(3, 6) = (&HEB)
TKey(4, 6) = (&HA5)
TKey(5, 6) = (&HA5)
TKey(0, 7) = (&H29)
TKey(1, 7) = (&H14)
TKey(2, 7) = (&H8A)
TKey(3, 7) = (&HC5)
TKey(4, 7) = (&H9F)
TKey(5, 7) = (&H9F)
TKey(0, 8) = (&HFA)
TKey(1, 8) = (&HFD)
TKey(2, 8) = (&HFE)
TKey(3, 8) = (&H7F)
TKey(4, 8) = (&HFF)
TKey(5, 8) = (&HFF)
TKey(0, 9) = (&H73)
TKey(1, 9) = (&H39)
TKey(2, 9) = (&H9C)
TKey(3, 9) = (&HCE)
TKey(4, 9) = (&HBE)
TKey(5, 9) = (&HBE)
TKey(0, 10) = (&HFC)
TKey(1, 10) = (&H7E)
TKey(2, 10) = (&HBF)
TKey(3, 10) = (&HDF)
TKey(4, 10) = (&HBF)
TKey(5, 10) = (&HBF)
TKey(0, 11) = (&HCF)
TKey(1, 11) = (&HE7)
TKey(2, 11) = (&H73)
TKey(3, 11) = (&H39)
TKey(4, 11) = (&H51)
TKey(5, 11) = (&H51)
TKey(0, 12) = (&HF7)
TKey(1, 12) = (&HFB)
TKey(2, 12) = (&H7D)
TKey(3, 12) = (&H3E)
TKey(4, 12) = (&H5A)
TKey(5, 12) = (&H5A)
TKey(0, 13) = (&HF2)
TKey(1, 13) = (&H79)
TKey(2, 13) = (&H3C)
TKey(3, 13) = (&H1E)
TKey(4, 13) = (&H8D)
TKey(5, 13) = (&H8D)
TKey(0, 14) = (&HCF)
TKey(1, 14) = (&HE7)
TKey(2, 14) = (&H73)
TKey(3, 14) = (&H39)
TKey(4, 14) = (&H45)
TKey(5, 14) = (&H45)
TKey(0, 15) = (&HB7)
TKey(1, 15) = (&HDB)
TKey(2, 15) = (&H6D)
TKey(3, 15) = (&HB6)
TKey(4, 15) = (&H7D)
TKey(5, 15) = (&H7D)
loadkeystatus = &H0
For i = 0 To 5
keynr(i) = "&HFF"
Next i
mode = 0
' For intkeynr = 0 To 15
MifStatus = mifsw_load_key(mode, 0, TKey(mode, 0), keynr(0))
If MifStatus = -4 Then
MifStatus = mifsw_exit%()
Exit Function
Else
cmdloadkey.Enabled = False
loadkeystatus = &HFF
End If
' Next intkeynr
End Function
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -