我正在尝试使用rfid读取器和qt creator c ++作为编程平台来获取rfid卡的芯片序列号。
但是每次我运行代码时,它总是在rf_anticoll处停止。谁能指出我的错误。 rf_anticoll是MasterRD.dll的功能
这是我的代码
void testWindow::get_rf_id()
{
lib->load();
unsigned char mode = 0x52;
unsigned short TagType;
unsigned char bcnt = 0x04;
unsigned char len;
unsigned char Snr;
unsigned char Size;
int run = rf_init_com(com,baud);
if(run){
qDebug() << "failed to conect to RF Device";
return;
}
rf_light(icdev,1);
run = rf_request(icdev,mode,&TagType);
if(run){
qDebug() << "Failed to request";
return;
}
run = rf_anticoll(icdev,bcnt,&Snr,&len);
if(run || len != 4){
qDebug() << "Failed in rf_anticoll";
return;
}
run = rf_select(icdev,&Snr,len,&Size);
if(run){
qDebug() << "Failed in select";
return;
}
qDebug()<<"select passed!";
rf_beep(icdev,9);
rf_light(icdev,3);
}