佚名通过本文主要向大家介绍了rc531,瑞斯康达rc531,光收发器rc531求购,光纤收发器rc531求购,mf rc531等相关知识,希望对您有所帮助,也希望大家支持linkedu.com www.linkedu.com
问题:RC531调试CPU卡出现问题。
描述:
CPU卡---是已经初始话好的卡,我现在只需要做消费。消费需要用到的PSAM卡也已经调试完毕,具体的消费指令流程也知道了。
读卡芯片--RC531芯片。现在可以实现对M1卡进行减值,写值操作。应该来说我的读卡硬件是没问题。
控制器用的是C8051F系列的一款单片机。
现在的问题是,用我的读卡电路可以寻到卡,选中CPU卡片,然后我发送了RATS命令,卡片也有回复。当发送一条选MF命令时,提示我出错。
RATS命令:
MSndBuffer[0] = 0xE0; //
MSndBuffer[1] = 0x10;
MInfo.nBytesToSend = 2; //
status = M500PcdCmd(PCD_TRANSCEIVE,MSndBuffer,MRcvBuffer,&MInfo);
RATS回复:
status =0;----代表成功
收到的数据:12 78 B3 B1 02 00 81 4D 22 08 86 60 12 22 26 20 00 01
发送选择MF命令:
MSndBuffer[0]=0x0a;
MSndBuffer[1]=0x01;
MSndBuffer[2]=0x00;
MSndBuffer[3]=0xA4;
MSndBuffer[4]=0x00;
MSndBuffer[5]=0x00;
MSndBuffer[6]=0x02;
MSndBuffer[7]=0x3f;
MSndBuffer[8]=0x01;
MInfo.nBytesToSend = 9; //
status = M500PcdCmd(PCD_TRANSCEIVE,MSndBuffer,MRcvBuffer,&MInfo);
此时:status=0xff------无卡的意思。
下面是选择MF子函数
unsigned char select_mf(unsigned char *buf)
{
char idata status = MI_OK;
M500PcdSetTmo(3);
WriteIO(RegChannelRedundancy,0x0F);
ClearBitMask(RegControl,0x08);
ResetInfo(MInfo); //
MSndBuffer[0]=0x0a;
MSndBuffer[1]=0x01;
MSndBuffer[2]=0x00;
MSndBuffer[3]=0xA4;
MSndBuffer[4]=0x00;
MSndBuffer[5]=0x00;
MSndBuffer[6]=0x02;
MSndBuffer[7]=0x3f;
MSndBuffer[8]=0x01;
MInfo.nBytesToSend = 9; //
status = M500PcdCmd(PCD_TRANSCEIVE,MSndBuffer,MRcvBuffer,&MInfo);
if (status)
{
*buf = 0;
}
else
{
if (MInfo.nBytesReceived == 0)
{
*buf = 0;
status = MI_EMPTY;
}
else
{
status = MI_OK;
memcpy(buf,MRcvBuffer,MInfo.nBytesReceived);
}
}
return status;
}
M500PCBcommand 用的RC531原厂库函数
//////////////////////////////////////////////////////////////////////
// W R I T E A P C D C O M M A N D
///////////////////////////////////////////////////////////////////////
char M500PcdCmd(unsigned char cmd,
volatile unsigned char* send,
volatile unsigned char* rcv,
volatile MfCmdInfo *info)
{
char data status = MI_OK;
char data tmpStatus ;
unsigned char data lastBits;
unsigned char data irqEn = 0x00;
unsigned char data waitFor = 0x00;
unsigned char data timerCtl = 0x00;
WriteIO(RegInterruptEn,0x7F); // disable all interrupts
WriteIO(RegInterruptRq,0x7F); // reset interrupt requests
WriteIO(RegCommand,PCD_IDLE); // terminate probably running command
FlushFIFO(); // flush FIFO buffer
// save info structures to module pointers
MpIsrInfo = info;
MpIsrOut = send;
MpIsrIn = rcv;
info->irqSource = 0x0; // reset interrupt flags
// depending on the command code, appropriate interrupts are enabled (irqEn)
// and the commit interrupt is choosen (waitFor).
switch(cmd)
{
case PCD_IDLE: // nothing else required
irqEn = 0x00;
waitFor = 0x00;
break;
case PCD_WRITEE2: // LoAlert and TxIRq
irqEn = 0x11;
waitFor = 0x10;
break;
case PCD_READE2: // HiAlert, LoAlert and IdleIRq
irqEn = 0x07;
waitFor = 0x04;
break;
case PC
描述:
RC531调试CPU卡出现问题。单片机cpu调试
大家好,最近在调试CPU卡消费。CPU卡---是已经初始话好的卡,我现在只需要做消费。消费需要用到的PSAM卡也已经调试完毕,具体的消费指令流程也知道了。
读卡芯片--RC531芯片。现在可以实现对M1卡进行减值,写值操作。应该来说我的读卡硬件是没问题。
控制器用的是C8051F系列的一款单片机。
现在的问题是,用我的读卡电路可以寻到卡,选中CPU卡片,然后我发送了RATS命令,卡片也有回复。当发送一条选MF命令时,提示我出错。
RATS命令:
MSndBuffer[0] = 0xE0; //
MSndBuffer[1] = 0x10;
MInfo.nBytesToSend = 2; //
status = M500PcdCmd(PCD_TRANSCEIVE,MSndBuffer,MRcvBuffer,&MInfo);
RATS回复:
status =0;----代表成功
收到的数据:12 78 B3 B1 02 00 81 4D 22 08 86 60 12 22 26 20 00 01
发送选择MF命令:
MSndBuffer[0]=0x0a;
MSndBuffer[1]=0x01;
MSndBuffer[2]=0x00;
MSndBuffer[3]=0xA4;
MSndBuffer[4]=0x00;
MSndBuffer[5]=0x00;
MSndBuffer[6]=0x02;
MSndBuffer[7]=0x3f;
MSndBuffer[8]=0x01;
MInfo.nBytesToSend = 9; //
status = M500PcdCmd(PCD_TRANSCEIVE,MSndBuffer,MRcvBuffer,&MInfo);
此时:status=0xff------无卡的意思。
下面是选择MF子函数
unsigned char select_mf(unsigned char *buf)
{
char idata status = MI_OK;
M500PcdSetTmo(3);
WriteIO(RegChannelRedundancy,0x0F);
ClearBitMask(RegControl,0x08);
ResetInfo(MInfo); //
MSndBuffer[0]=0x0a;
MSndBuffer[1]=0x01;
MSndBuffer[2]=0x00;
MSndBuffer[3]=0xA4;
MSndBuffer[4]=0x00;
MSndBuffer[5]=0x00;
MSndBuffer[6]=0x02;
MSndBuffer[7]=0x3f;
MSndBuffer[8]=0x01;
MInfo.nBytesToSend = 9; //
status = M500PcdCmd(PCD_TRANSCEIVE,MSndBuffer,MRcvBuffer,&MInfo);
if (status)
{
*buf = 0;
}
else
{
if (MInfo.nBytesReceived == 0)
{
*buf = 0;
status = MI_EMPTY;
}
else
{
status = MI_OK;
memcpy(buf,MRcvBuffer,MInfo.nBytesReceived);
}
}
return status;
}
M500PCBcommand 用的RC531原厂库函数
//////////////////////////////////////////////////////////////////////
// W R I T E A P C D C O M M A N D
///////////////////////////////////////////////////////////////////////
char M500PcdCmd(unsigned char cmd,
volatile unsigned char* send,
volatile unsigned char* rcv,
volatile MfCmdInfo *info)
{
char data status = MI_OK;
char data tmpStatus ;
unsigned char data lastBits;
unsigned char data irqEn = 0x00;
unsigned char data waitFor = 0x00;
unsigned char data timerCtl = 0x00;
WriteIO(RegInterruptEn,0x7F); // disable all interrupts
WriteIO(RegInterruptRq,0x7F); // reset interrupt requests
WriteIO(RegCommand,PCD_IDLE); // terminate probably running command
FlushFIFO(); // flush FIFO buffer
// save info structures to module pointers
MpIsrInfo = info;
MpIsrOut = send;
MpIsrIn = rcv;
info->irqSource = 0x0; // reset interrupt flags
// depending on the command code, appropriate interrupts are enabled (irqEn)
// and the commit interrupt is choosen (waitFor).
switch(cmd)
{
case PCD_IDLE: // nothing else required
irqEn = 0x00;
waitFor = 0x00;
break;
case PCD_WRITEE2: // LoAlert and TxIRq
irqEn = 0x11;
waitFor = 0x10;
break;
case PCD_READE2: // HiAlert, LoAlert and IdleIRq
irqEn = 0x07;
waitFor = 0x04;
break;
case PC