T5557卡是美国Atmel公司生产的多功能非接触式射频卡芯片,属于125KHz的低频卡,在国内有广大的应用市场。该芯片共有330bit(比特)的EPROM(分布为10个区块, 每个区块33bit)。0页的块0是被保留用于设置T5557操作模式的参数配置块。第0页第7块可以作用户数据块使用,也可以作为保护全部数据的密码(假如在配置块中启用密码功能的话),防止非法改写数据。 第1页的1、2块保存了出厂商信息及唯一出厂ID,只能读取不可更改,我们的读写器取出其中的6个字节做为物理卡号,以实现与13.56等高频卡相同的应用场景。
T5567、T5577是T5557的升级版。
本示例使用的读写器介绍:T5557 T5567 T5577低频RFID读写器 EM4100 HID卡复制器 酒店门卡-淘宝网 (taobao.com)
01、初始配置块取值:00 08 80 E8,表示AOR请求应答模式=0、PWD密码有效=0、MAXBLK自动发送最大块=7,无需密码可读卡,自动发送0页的1-7块;
02、配置块取值:00 08 82 F8,表示AOR应答模式=1、PWD密码有效=1,卡片为密码保护模式,需要认证密码才能读、写卡;
03、配置块取值:00 08 80 F8,表示AOR应答模式=0、PWD密码有效=1,读卡(自动发送)不需要密码,写卡要带密码操作。
函数声明:
&&读卡函数声明
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
修改配置块数据
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
读取块内数据
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
改写块内数据
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
将T555卡制做成ID、HID卡
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
读取ID、HID原始卡号
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]为返回的bit数量,pserial[6-1]为HID卡号缓冲,当pserial[0]为1时,仅pserial[6]的bit0位有效。当pserial[0]为2时,仅pserial[6]的bit0,bit2位有效,以此类推
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
修改t5557卡密码
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
newkey = ALLTRIM(thisform.newkey.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)))
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("更改T5557卡密码成功,卡号:"+seriaStr ,0+64,"提示")
ELSE
thisform.disperrinf (status )
ENDIF