T5557 card is a multi-functional non-contact radio frequency card chip produced by Atmel Corporation of the United States. It is a 125KHz low-frequency card and has a large application market in China. The chip has a total of 330bit (bit) EPROM (distributed into 10 blocks, each block is 33bit). Block 0 of page 0 is a parameter configuration block reserved for setting the T5557 operation mode. Block 7 on page 0 can be used as a user data block, or as a password to protect all data (if the password function is enabled in the configuration block), to prevent illegal rewriting of data. Blocks 1 and 2 on page 1 store the manufacturer's information and unique factory ID, which can only be read and cannot be changed. Our reader takes out 6 bytes of them as the physical card number to realize the high-frequency card such as 13.56 Same application scenario.
T5567 and T5577 are upgraded versions of T5557.
Introduction to the reader used in this example: T5557 T5567 T5577 Low Frequency RFID Reader EM4100 HID Card Duplicator Hotel Key Card - Taobao.com (taobao.com)
01. Initial configuration block value: 00 08 80 E8, indicating AOR request response mode = 0, PWD password valid = 0, MAXBLK automatically sends the largest block = 7, can read the card without a password, and automatically sends 1-7 blocks of page 0 ;
02. The value of the configuration block: 00 08 82 F8, which means AOR response mode = 1, PWD password is valid = 1, the card is in password protection mode, and the authentication password is required to read and write the card;
03. The value of the configuration block: 00 08 80 F8, which means AOR response mode = 0, PWD password valid = 1, card reading (automatic sending) does not require a password, and card writing requires a password operation.
Function declaration:
&&读卡函数声明
declare integer idr_read in 'OUR_IDR.dll' string @pserial
&&驱动蜂鸣器函数声明
declare integer idr_beep in 'OUR_IDR.dll' integer xms
&&读出设备序列编号函数声明
declare integer pcdgetdevicenumber in 'OUR_IDR.dll' string @pdevicenumber
&&读t5557卡块内数据
declare integer t5557_read in 'OUR_IDR.dll' integer ctrlword,string @mypiccserial,string @mypicckey,string @blockflag,string @mypiccdata
&&写t5557卡块数据
declare integer t5557_write in 'OUR_IDR.dll' integer ctrlword,string @mypiccserial,string @mypicckey,string @blockflag,string @mypiccdata
&&写t5557卡配置块
declare integer t5557_init in 'OUR_IDR.dll' integer ctrlword,string @mypiccserial,string @mypicckey,string @configdata,string @newkey
&&修改t5557卡密码
declare integer t5557_changekey in 'OUR_IDR.dll' integer ctrlword,string @mypiccserial,string @mypicckey,string @newkey
&&读兼容EM4100的ID卡
declare integer idr_read in 'OUR_IDR.dll' string @mypiccserial
&&将t5557卡制作成ID卡
declare integer t5557_to4100 in 'OUR_IDR.dll' integer ctrlword,string @mypiccserial,string @mypicckey,string @newkey,string @mypiccdata
&&读HID卡
declare integer hid_read in 'OUR_IDR.dll' string @mypiccserial
&&将t5557卡制作成HID卡
declare integer t5557_tohid in 'OUR_IDR.dll' integer ctrlword,string @mypiccserial,string @mypicckey,string @newkey,string @mypiccdata
Modify configuration block data
NEEDSERIAL=1 &&需要只对指定系列号的卡操作
NEEDKEY=2 &&需要用密码认证
LOCKBIT=4 &&锁定配置块或数据块,仅对 t5557_init,t5557_write ,t5557_changekey函数有效
KEYENABLE=8 &&启用本卡的密码功能
RESETCARD=16 &&操作成功后重启卡片
myctrlword=0
IF thisform.check1.Value >0 &&卡片已启用密码保护功能,本次操作需先认证卡密码
myctrlword=myctrlword+ NEEDKEY
oldkey = ALLTRIM(thisform.oldkey.Value)
IF LEN(oldkey)<>8 OR thisform.checkinput(oldkey)=.f.
messagebox('密码输入错误,请输入8位16进制密码!',0+16+0,'提示')
RETURN
ENDIF
oldpicckey =CHR(thisform.hextodec1b(SUBSTR(oldkey,1,2)))+CHR(thisform.hextodec1b(SUBSTR(oldkey,3,2)))+CHR(thisform.hextodec1b(SUBSTR(oldkey,5,2)))+CHR(thisform.hextodec1b(SUBSTR(oldkey,7,2)))
ELSE
oldpicckey =CHR(0)+CHR(0)+CHR(0)+CHR(0)
ENDIF
mypiccserial=CHR(0)+CHR(0)+CHR(0)+CHR(0)+CHR(0)+CHR(0)
IF thisform.check12.Value >0 &&卡片启用密码保护功能
myctrlword=myctrlword+ KEYENABLE
newkey = ALLTRIM(thisform.cardkey.Value)
IF LEN(newkey)<>8 OR thisform.checkinput(newkey)=.f.
messagebox('卡片保护密码输入错误,请输入8位16进制卡片保护密码!',0+16+0,'提示')
RETURN
ENDIF
newpicckey=CHR(thisform.hextodec1b(SUBSTR(newkey,1,2)))+CHR(thisform.hextodec1b(SUBSTR(newkey,3,2)))+CHR(thisform.hextodec1b(SUBSTR(newkey,5,2)))+CHR(thisform.hextodec1b(SUBSTR(newkey,7,2)))
ELSE
newpicckey=CHR(0)+CHR(0)+CHR(0)+CHR(0)
ENDIF
cardconfig= ALLTRIM(thisform.cardconfig.Value)
IF LEN(cardconfig)<>8 OR thisform.checkinput(cardconfig)=.f.
messagebox('卡片配置值输入错误,请输入8位16进制卡片配置值!',0+16+0,'提示')
RETURN
ENDIF
mypiccdata=CHR(thisform.hextodec1b(SUBSTR(cardconfig,1,2)))+CHR(thisform.hextodec1b(SUBSTR(cardconfig,3,2)))+CHR(thisform.hextodec1b(SUBSTR(cardconfig,5,2)))+CHR(thisform.hextodec1b(SUBSTR(cardconfig,7,2)))
status = t5557_init(myctrlword,@mypiccserial,@oldpicckey,@mypiccdata,@newpicckey)
IF status =0
=idr_beep(50)
seriaStr=''
FOR i=1 TO 6
seriaStr=seriaStr+thisform.dectohex(ASC(SUBSTR(mypiccserial,i,1)))
ENDFOR
MESSAGEBOX("更改T5557卡配置值成功,卡号:"+seriaStr ,0+64,"提示")
ELSE
thisform.disperrinf (status )
ENDIF
read block data
NEEDSERIAL=1 &&需要只对指定系列号的卡操作
NEEDKEY=2 &&需要用密码认证
LOCKBIT=4 &&锁定配置块或数据块,仅对 t5557_init,t5557_write ,t5557_changekey函数有效
KEYENABLE=8 &&启用本卡的密码功能
RESETCARD=16 &&操作成功后重启卡片
myctrlword=0
IF thisform.check1.Value >0 &&卡片已启用密码保护功能,本次操作需先认证卡密码
myctrlword=myctrlword+ NEEDKEY
oldkey = ALLTRIM(thisform.oldkey.Value)
IF LEN(oldkey)<>8 OR thisform.checkinput(oldkey)=.f.
messagebox('密码输入错误,请输入8位16进制密码!',0+16+0,'提示')
RETURN
ENDIF
oldpicckey =CHR(thisform.hextodec1b(SUBSTR(oldkey,1,2)))+CHR(thisform.hextodec1b(SUBSTR(oldkey,3,2)))+CHR(thisform.hextodec1b(SUBSTR(oldkey,5,2)))+CHR(thisform.hextodec1b(SUBSTR(oldkey,7,2)))
ELSE
oldpicckey =CHR(0)+CHR(0)+CHR(0)+CHR(0)
ENDIF
IF thisform.check2.Value >0 &&本次操作只对指定ID的卡片
myctrlword=myctrlword+ NEEDSERIAL
serial=ALLTRIM(thisform.cardid.Value)
IF LEN(serial)<>12 OR thisform.checkinput(serial)=.f.
messagebox('卡号输入错误,请输入12位16进制密码!',0+16+0,'提示')
RETURN
ENDIF
mypiccserial=CHR(thisform.hextodec1b(SUBSTR(serial,1,2)))+CHR(thisform.hextodec1b(SUBSTR(serial,3,2)))+CHR(thisform.hextodec1b(SUBSTR(serial,5,2)))+CHR(thisform.hextodec1b(SUBSTR(serial,7,2)))+CHR(thisform.hextodec1b(SUBSTR(serial,9,2)))+CHR(thisform.hextodec1b(SUBSTR(serial,11,2)))
ELSE
mypiccserial=CHR(0)+CHR(0)+CHR(0)+CHR(0)+CHR(0)+CHR(0) &&本次操作可对任意卡片
ENDIF
seleblock='' &&本次操作 第0页的块选
FOR i=0 TO 7
t='block'+ALLTRIM(STR(i))+'.value'
IF thisform.&t>0
seleblock="1"+seleblock
ELSE
seleblock="0"+seleblock
ENDIF
ENDFOR
mypiccblockflag=CHR(thisform.bintodec(seleblock) )
seleblock='0' &&本次操作 第1页的块选
FOR i=8 TO 11
t='block'+ALLTRIM(STR(i))+'.value'
IF thisform.&t>0
seleblock="1"+seleblock
ELSE
seleblock="0"+seleblock
ENDIF
ENDFOR
mypiccblockflag=mypiccblockflag+CHR(thisform.bintodec(seleblock)) &&块选参数
mypiccdata=space(50)
blockdata=""
status = t5557_read(myctrlword,@mypiccserial,@oldpicckey,@mypiccblockflag,@mypiccdata)
IF status =0
=idr_beep(50)
FOR i=1 TO ASC(SUBSTR(mypiccdata,2,1))
blockdata=blockdata+thisform.dectohex(ASC(SUBSTR(mypiccdata,2+i,1)))
ENDFOR
j=1
FOR i=0 TO 11
c='block'+ALLTRIM(STR(i))+'.value'
t='Text_block'+ALLTRIM(STR(i))+'.value'
IF thisform.&c>0
thisform.&t=SUBSTR(blockdata,j,8)
j=j+8
ENDIF
ENDFOR
seriaStr=''
FOR i=1 TO 6
seriaStr=seriaStr+thisform.dectohex(ASC(SUBSTR(mypiccserial,i,1)))
ENDFOR
MESSAGEBOX("读T5557卡成功,卡无线传输分频比:"+ALLTRIM(STR(ASC(SUBSTR(mypiccdata,1,1))))+",卡号:"+seriaStr ,0+64,"提示")
ELSE
thisform.disperrinf (status )
ENDIF
Rewrite the data in the block
NEEDSERIAL=1 &&需要只对指定系列号的卡操作
NEEDKEY=2 &&需要用密码认证
LOCKBIT=4 &&锁定配置块或数据块,仅对 t5557_init,t5557_write ,t5557_changekey函数有效
KEYENABLE=8 &&启用本卡的密码功能
RESETCARD=16 &&操作成功后重启卡片
myctrlword=0
IF thisform.check1.Value >0 &&卡片已启用密码保护功能,本次操作需先认证卡密码
myctrlword=myctrlword+ NEEDKEY
oldkey = ALLTRIM(thisform.oldkey.Value)
IF LEN(oldkey)<>8 OR thisform.checkinput(oldkey)=.f.
messagebox('密码输入错误,请输入8位16进制密码!',0+16+0,'提示')
RETURN
ENDIF
oldpicckey =CHR(thisform.hextodec1b(SUBSTR(oldkey,1,2)))+CHR(thisform.hextodec1b(SUBSTR(oldkey,3,2)))+CHR(thisform.hextodec1b(SUBSTR(oldkey,5,2)))+CHR(thisform.hextodec1b(SUBSTR(oldkey,7,2)))
ELSE
oldpicckey =CHR(0)+CHR(0)+CHR(0)+CHR(0)
ENDIF
IF thisform.check2.Value >0 &&本次操作只对指定ID的卡片
myctrlword=myctrlword+ NEEDSERIAL
serial=ALLTRIM(thisform.cardid.Value)
IF LEN(serial)<>12 OR thisform.checkinput(serial)=.f.
messagebox('卡号输入错误,请输入12位16进制密码!',0+16+0,'提示')
RETURN
ENDIF
mypiccserial=CHR(thisform.hextodec1b(SUBSTR(serial,1,2)))+CHR(thisform.hextodec1b(SUBSTR(serial,3,2)))+CHR(thisform.hextodec1b(SUBSTR(serial,5,2)))+CHR(thisform.hextodec1b(SUBSTR(serial,7,2)))+CHR(thisform.hextodec1b(SUBSTR(serial,9,2)))+CHR(thisform.hextodec1b(SUBSTR(serial,11,2)))
ELSE
mypiccserial=CHR(0)+CHR(0)+CHR(0)+CHR(0)+CHR(0)+CHR(0) &&本次操作可对任意卡片
ENDIF
seleblock='' &&本次操作 第0页的块选
FOR i=0 TO 7
t='block'+ALLTRIM(STR(i))+'.value'
IF thisform.&t>0
seleblock="1"+seleblock
ELSE
seleblock="0"+seleblock
ENDIF
ENDFOR
mypiccblockflag=CHR(thisform.bintodec(seleblock) )
seleblock='0' &&本次操作 第1页的块选
FOR i=8 TO 11
t='block'+ALLTRIM(STR(i))+'.value'
IF thisform.&t>0
seleblock="1"+seleblock
ELSE
seleblock="0"+seleblock
ENDIF
ENDFOR
mypiccblockflag=mypiccblockflag+CHR(thisform.bintodec(seleblock)) &&块选参数
mypiccdata=''
FOR i=0 TO 11
c='block'+ALLTRIM(STR(i))+'.value'
t='Text_block'+ALLTRIM(STR(i))+'.value'
IF thisform.&c>0
writestr=thisform.&t
IF LEN(writestr)<>8 OR thisform.checkinput(writestr)=.f.
messagebox('第 '+ALLTRIM(STR(i))+' 块数据输入错误,请输入8位16进制数据!',0+16+0,'提示')
RETURN
ENDIF
mypiccdata=mypiccdata+CHR(thisform.hextodec1b(SUBSTR(writestr,1,2)))+CHR(thisform.hextodec1b(SUBSTR(writestr,3,2)))+CHR(thisform.hextodec1b(SUBSTR(writestr,5,2)))+CHR(thisform.hextodec1b(SUBSTR(writestr,7,2)))
ENDIF
ENDFOR
status = t5557_write(myctrlword,@mypiccserial,@oldpicckey,@mypiccblockflag,@mypiccdata)
IF status =0
=idr_beep(50)
seriaStr=''
FOR i=1 TO 6
seriaStr=seriaStr+thisform.dectohex(ASC(SUBSTR(mypiccserial,i,1)))
ENDFOR
MESSAGEBOX("写T5557卡成功,卡号:"+seriaStr ,0+64,"提示")
ELSE
thisform.disperrinf (status )
ENDIF
Make T555 card into ID, HID card
NEEDSERIAL=1 &&需要只对指定系列号的卡操作
NEEDKEY=2 &&需要用密码认证
LOCKBIT=4 &&锁定配置块或数据块,仅对 t5557_init,t5557_write ,t5557_changekey函数有效
KEYENABLE=8 &&启用本卡的密码功能
RESETCARD=16 &&操作成功后重启卡片
myctrlword=0
IF thisform.check1.Value >0 &&卡片已启用密码保护功能,本次操作需先认证卡密码
myctrlword=myctrlword+ NEEDKEY
oldkey = ALLTRIM(thisform.oldkey.Value)
IF LEN(oldkey)<>8 OR thisform.checkinput(oldkey)=.f.
messagebox('密码输入错误,请输入8位16进制密码!',0+16+0,'提示')
RETURN
ENDIF
oldpicckey =CHR(thisform.hextodec1b(SUBSTR(oldkey,1,2)))+CHR(thisform.hextodec1b(SUBSTR(oldkey,3,2)))+CHR(thisform.hextodec1b(SUBSTR(oldkey,5,2)))+CHR(thisform.hextodec1b(SUBSTR(oldkey,7,2)))
ELSE
oldpicckey =CHR(0)+CHR(0)+CHR(0)+CHR(0)
ENDIF
IF thisform.check2.Value >0 &&本次操作只对指定ID的卡片
myctrlword=myctrlword+ NEEDSERIAL
serial=ALLTRIM(thisform.cardid.Value)
IF LEN(serial)<>12 OR thisform.checkinput(serial)=.f.
messagebox('卡号输入错误,请输入12位16进制密码!',0+16+0,'提示')
RETURN
ENDIF
mypiccserial=CHR(thisform.hextodec1b(SUBSTR(serial,1,2)))+CHR(thisform.hextodec1b(SUBSTR(serial,3,2)))+CHR(thisform.hextodec1b(SUBSTR(serial,5,2)))+CHR(thisform.hextodec1b(SUBSTR(serial,7,2)))+CHR(thisform.hextodec1b(SUBSTR(serial,9,2)))+CHR(thisform.hextodec1b(SUBSTR(serial,11,2)))
ELSE
mypiccserial=CHR(0)+CHR(0)+CHR(0)+CHR(0)+CHR(0)+CHR(0) &&本次操作可对任意卡片
ENDIF
IF thisform.check13.Value >0
newkey = ALLTRIM(thisform.addkey .Value)
IF LEN(newkey)<>8 OR thisform.checkinput(newkey)=.f.
messagebox('新密码输入错误,请输入8位16进制新密码!',0+16+0,'提示')
RETURN
ENDIF
myctrlword=myctrlword+ KEYENABLE
newpicckey=CHR(thisform.hextodec1b(SUBSTR(newkey,1,2)))+CHR(thisform.hextodec1b(SUBSTR(newkey,3,2)))+CHR(thisform.hextodec1b(SUBSTR(newkey,5,2)))+CHR(thisform.hextodec1b(SUBSTR(newkey,7,2)))
ELSE
newpicckey=CHR(0)+CHR(0)+CHR(0)+CHR(0)
ENDIF
myctrlword=myctrlword+ RESETCARD &&操作后重启卡片,否则在制卡后,需要拿开卡片重放才能成功读ID卡
IF thisform.opg.ID.Value =1
uidstr=thisform.hexcardno.Value
IF LEN(uidstr)<>10 OR thisform.checkinput(uidstr)=.f.
messagebox('写入卡号错误,请输入10位16进制卡号!',0+16+0,'提示')
RETURN
ENDIF
myuid=CHR(thisform.hextodec1b(SUBSTR(uidstr,1,2)))+CHR(thisform.hextodec1b(SUBSTR(uidstr,3,2)))+CHR(thisform.hextodec1b(SUBSTR(uidstr,5,2)))+CHR(thisform.hextodec1b(SUBSTR(uidstr,7,2)))+CHR(thisform.hextodec1b(SUBSTR(uidstr,9,2)))
status = t5557_to4100(myctrlword,@mypiccserial,@oldpicckey,@newpicckey,@myuid)
IF status =0
=idr_beep(50)
seriaStr=''
FOR i=1 TO 6
seriaStr=seriaStr+thisform.dectohex(ASC(SUBSTR(mypiccserial,i,1)))
ENDFOR
MESSAGEBOX("ID卡号写入成功,卡片变成ID卡!不能再用t5557的指令读写此卡,可重新设置配置块恢复t5557卡功能。" ,0+64,"提示")
ELSE
thisform.disperrinf (status )
ENDIF
ELSE
uidstr=thisform.hexcardno.Value
IF LEN(uidstr)<>14 OR thisform.checkinput(uidstr)=.f.
messagebox('写入卡号错误,请输入14位16进制卡号!',0+16+0,'提示')
RETURN
ENDIF
myuid=CHR(thisform.hextodec1b(SUBSTR(uidstr,1,2)))+CHR(thisform.hextodec1b(SUBSTR(uidstr,3,2)))+CHR(thisform.hextodec1b(SUBSTR(uidstr,5,2)))+CHR(thisform.hextodec1b(SUBSTR(uidstr,7,2)))+CHR(thisform.hextodec1b(SUBSTR(uidstr,9,2)))+CHR(thisform.hextodec1b(SUBSTR(uidstr,11,2)))+CHR(thisform.hextodec1b(SUBSTR(uidstr,13,2)))
status = t5557_tohid(myctrlword,@mypiccserial,@oldpicckey,@newpicckey,@myuid)
IF status =0
=idr_beep(50)
seriaStr=''
FOR i=1 TO 6
seriaStr=seriaStr+thisform.dectohex(ASC(SUBSTR(mypiccserial,i,1)))
ENDFOR
MESSAGEBOX("HID卡号写入成功,卡片变成HID卡!不能再用t5557的指令读写此卡,可重新设置配置块恢复t5557卡功能。" ,0+64,"提示")
ELSE
thisform.disperrinf (status )
ENDIF
ENDIF
Read ID, HID original card number
thisform.hexcardno.Value=""
IF thisform.opg.ID.Value =1
pserial=spac(5)
recu=idr_read(@pserial)
if recu=0
thisform.hexcardno.Value = thisform.dectohex(ASC(SUBSTR(pserial,1,1)))+ thisform.dectohex(ASC(SUBSTR(pserial,2,1)))+thisform.dectohex(ASC(SUBSTR(pserial,3,1)))+thisform.dectohex(ASC(SUBSTR(pserial,4,1))) +thisform.dectohex(ASC(SUBSTR(pserial,5,1)))
thisform.command4.Click
else
thisform.disperrinf(recu)
endif
ELSE
pserial=spac(7)
recu=hid_read(@pserial)
if recu=0
&&/ /pserial[0] is the number of bits returned, pserial[6-1] is the HID card number buffer, when pserial[0] is 1, only bit0 of pserial[6] is valid. When pserial[0] is 2, only bit0 and bit2 of pserial[6] are valid, and so on
thisform.hexcardno.Value = thisform.dectohex(ASC(SUBSTR(pserial,1,1)))+thisform.dectohex(ASC(SUBSTR(pserial,2,1)))+thisform.dectohex(ASC(SUBSTR(pserial,3,1)))+thisform.dectohex(ASC(SUBSTR(pserial,4,1)))+thisform.dectohex(ASC(SUBSTR(pserial,5,1)))+thisform.dectohex(ASC(SUBSTR(pserial,6,1)))+thisform.dectohex(ASC(SUBSTR(pserial,7,1)))
thisform.command4.Click
else
thisform.disperrinf(recu)
endif
ENDIF
Modify t5557 card password
NEEDSERIAL=1 &&Need to operate only on the card with the specified serial number
NEEDKEY=2 &&Need to use password authentication
LOCKBIT=4 &&Lock configuration block or data block, only valid for t5557_init, t5557_write, t5557_changekey functions KEYENABLE
=8 &&Enable the password of this card Function
RESETCARD=16 &&restart the card after the operation is successful
myctrlword=0
IF thisform.check1.Value >0 && the card has enabled the password protection function, this operation needs to authenticate the card password first
myctrlword=myctrlword+ NEEDKEY
oldkey = ALLTRIM(thisform.oldkey.Value)
IF LEN(oldkey)<>8 OR thisform.checkinput (oldkey)=.f.
messagebox('Wrong password input, please enter an 8-digit hexadecimal password!',0+16+0,'Prompt')
RETURN
ENDIF
oldpicckey =CHR(thisform.hextodec1b(SUBSTR(oldkey,1 ,2)))+CHR(thisform.hextodec1b(SUBSTR(oldkey,3,2)))+CHR(thisform.hextodec1b(SUBSTR(oldkey,5,2)))+CHR(thisform.hextodec1b(SUBSTR(oldkey, 7,2)))
ELSE
oldpicckey =CHR(0)+CHR(0)+CHR(0)+CHR(0)
ENDIF
IF thisform.check2.Value >0 && this operation is only for the card with the specified ID
myctrlword=myctrlword+ NEEDSERIAL
serial=ALLTRIM(thisform.cardid.Value)
IF LEN(serial)<>12 OR thisform.checkinput(serial)=.f .messagebox
('Card number input error, please enter 12-digit hexadecimal password!',0+16+0,'Prompt')
RETURN
ENDIF
mypiccserial=CHR(thisform.hextodec1b(SUBSTR(serial,1,2)))+ CHR(thisform.hextodec1b(SUBSTR(serial,3,2)))+CHR(thisform.hextodec1b(SUBSTR(serial,5,2)))+CHR(thisform.hextodec1b(SUBSTR(serial,7,2))) +CHR(thisform.hextodec1b(SUBSTR(serial,9,2)))+CHR(thisform.hextodec1b(SUBSTR(serial,11,2)))
ELSE
mypiccserial=CHR(0)+CHR(0)+CHR(0 )+CHR(0)+CHR(0)+CHR(0) &&This operation can ENDIF any
card
newkey = ALLTRIM(thisform.newkey.Value)
IF LEN(newkey)<>8 OR thisform.checkinput(newkey)=.f.
messagebox('The new password is incorrectly entered, please enter an 8-digit hexadecimal new password!',0 +16+0,'prompt')
RETURN
ENDIF
newpicckey=CHR(thisform.hextodec1b(SUBSTR(newkey,1,2)))+CHR(thisform.hextodec1b(SUBSTR(newkey,3,2)))+CHR(thisform .hextodec1b(SUBSTR(newkey,5,2)))+CHR(thisform.hextodec1b(SUBSTR(newkey,7,2)))
status = t5557_changekey(myctrlword,@mypiccserial,@oldpicckey,@newpicckey)
IF status =0
= idr_beep(50)
seriaStr=''
FOR i=1 TO 6
seriaStr=seriaStr+thisform.dectohex(ASC(SUBSTR(mypiccserial,i,1)))
ENDFOR
MESSAGEBOX("Changed T5557 card password successfully, card number: "+seriaStr , 0+64,"Hint" )
ELSE
thisform.disperrinf (status )
ENDIF