在网上查资料,有网友试验成功,自己用可以读取TypeB的读卡器不能正常读取,按照网上的资料修改询卡指令后,不能返回正常的数据。没有卡的时候打印的数据如下:58 50 00 00 1D 1D 1D 1D 1D 1D 1D 1D 1D 1D 1D 1D 1D 00 6D 03 7B 最后的03是g_test。从50到最后一个1D是RegFIFOData返回的数据。刷身份证没啥变化。询卡函数如下:
uchar At88rf080Request(void) //TypeBѯ¿¨
{
char status = MI_OK;
int dd;
char m,i;
i = 0;
mrcreg.RegChannelRedundancy = 0x2c; //RegChannelRedundanc
//mrcreg.RegControl = mrcreg.RegControl | 0X01 ;
mrcreg.RegControl = mrcreg.RegControl & 0XF7 ;
//mrcreg.RegTxControl = mrcreg.RegTxControl | 0X03 ;
//mrcreg.RegInterruptEn = 0X7F ;
//mrcreg.RegInterruptRq = 0x7F ; // reset interrupt requests
mrcreg.RegCommand = 0x00 ; // terminate probably running command **0xa0;
/*
mrcreg.RegFIFOData = 0XA0;
mrcreg.RegFIFOData = 0X00;
mrcreg.RegFIFOData = 0X80;
mrcreg.RegFIFOData = 0X13;
mrcreg.RegFIFOData = 0X4D;
mrcreg.RegCommand= 0X1A ;
*/
mrcreg.RegFIFOData = 0x50;
mrcreg.RegFIFOData = 0x00;
mrcreg.RegFIFOData = 0x00;
mrcreg.RegCommand = 0X1A ;
dd=10000;
while ( (!(mrcreg.RegInterruptRq & 0x10)) && dd)
{
dd --;
}
m=( mrcreg.RegInterruptRq &0x10);
g_test3 = mrcreg.RegFIFOLength;
if(m>10)
{
while(m--)
{
Srn[i] =mrcreg.RegFIFOData ;
i++;
}
}
SendCardResult(0x58,Srn);
if (!m)
{
m = mrcreg.RegPrimaryStatus;
return m;
}
else
return 0;
}
初始化函数如下:
uchar InitialTypeB_080(void)
{
char status = MI_RESETERR;
status = MCRReset_1();
if (status == MI_OK)
{
mrcreg.RegTxControl =0x4B; // (0x11) disable Force100ASk--ok 13.56MHz
mrcreg.RegCwConductance =0x3f ; // ÉèÖÃÊä³öÇý¶¯µÄµçµ¼ÏµÊý
mrcreg.RegModConductance =0x03 ; //0x06 ·ùÒƼü¿ØASk 12%
mrcreg.RegCoderControl =0x20; //0x14 TypeB,²¨ÌØÂÊ106kbps, NRZ±àÂë ISO 14443B;NRZ acording ISO 14443B--ok
mrcreg.RegTypeBFraming =0x23; // ¶¨ÒåISO14443BÖ¡¸ñʽ
mrcreg.RegDecoderControl =0x19; //0x1a ISO14443BÖ¡,BPSK±àÂë TYPE_B ;BPSK Coding
mrcreg.RegRxThreshold =0xFF; //KAI ¿É½ÓÊÕµÄ×îСÐźÅÇ¿¶È
mrcreg.RegBPSKDemControl =0x3e; //0x1d ºöÂÔEOF,´ò¿ª¸ßͨÂ˲¨ ignore EOF, on amp. detect
mrcreg.RegClockQControl =0x07; // QʱÖÓ¿ØÖÆ
mrcreg.RegChannelRedundancy =0x20; // (0x22)RegChannelRedundancy
mrcreg.RegRxWait = 0x06; //ÉèÖýÓÊÕÑÓʱ
mrcreg.RegBitFraming = 0x00; // (0x0f)fangxiang
mrcreg.RegRxControl1 =0x73; // (0x19) 8 Pulses;GAIN 27 DB--ok
mrcreg.RegRxControl2 =0x01;
mrcreg.RegRxWait =0x06;
}
return(0);
}
有做过的朋友,帮忙看下,是哪里设置有问题,谢啦 |