Arduino RFID(Wiegand)连续读取

Arduino RFID(Wiegand)连续读取,arduino,rfid,Arduino,Rfid,我有RFID阅读器“Rosslare AY-X12”,它与Wiegand 26位一起工作。我有一个arduino mini Pro,连接在一起,工作正常,但它只读取一次卡,然后我什么都没有 当我放卡时,arduino会读那张卡,但只有一次卡在读卡器附近,当我放卡时,它会再次读那张卡,然后我就放了。但是我想连续地读那张卡,我的意思是当读卡器靠近读卡器时,每1ms读一次那张卡 你知道怎么做吗?有没有RFID arduino图书馆可以做到这一点?我有米法雷,它能做到。但是这个125Khz的阅读器可以通

我有RFID阅读器“Rosslare AY-X12”,它与Wiegand 26位一起工作。我有一个arduino mini Pro,连接在一起,工作正常,但它只读取一次卡,然后我什么都没有

当我放卡时,arduino会读那张卡,但只有一次卡在读卡器附近,当我放卡时,它会再次读那张卡,然后我就放了。但是我想连续地读那张卡,我的意思是当读卡器靠近读卡器时,每1ms读一次那张卡

你知道怎么做吗?有没有RFID arduino图书馆可以做到这一点?我有米法雷,它能做到。但是这个125Khz的阅读器可以通过Wiegand进行通信,但它不能做到这一点,或者我不知道如何做到这一点

我正在使用这个库:

试试这个计时器库,也许可以试试这个代码,它对我有用,我的标签和卡片现在可以连续读取。 来自丹麦的问候 格雷戈

#包括
//******************************************************************
//ATmega168、ATmega328:
//-使用定时器1禁用引脚9和10上的PWM(模拟写入)
//ATmega2560:
//-使用定时器1禁用针脚11和12上的PWM(模拟写入)
//-使用定时器3禁用针脚2、3和5上的PWM(模拟写入)
//-使用定时器4禁用针脚6、7和8上的PWM(模拟写入)
//-使用定时器5禁用引脚44、45和46上的PWM(模拟写入)
//******************************************************************
上次未签名整数;
#包括
SoftwareSerial RFID=SoftwareSerial(2,4);
字符;
串上我们的id;
无效设置()
{
//禁用Arduino的默认毫秒计数器(从现在开始,毫秒(),微秒(),
//延迟()和延迟微秒()将不起作用)
残疾();
//准备计时器1进行计数
//在16 MHz Arduino板上,此功能的分辨率为4us
//在8MHz Arduino板上,此功能的分辨率为8us
startCountingTimer1();
lastTime=readTimer1();
Serial.begin(9600);
RFID.begin(9600);
}
void循环()
{
unsigned int now=readTimer1();
而(RFID.available()>0)
{
character=RFID.read();
我们的_id+=角色;
上次=现在;
}
如果(我们的_id.length()>10){
我们的子字符串(1,13);
Serial.println(我们的_id);
我们的_id=“”;
}
延迟(1000);

}
我自己编写了wiegand代码。没那么难。我将中断连接到数据管脚,当它们改变时,我记录0或1。然后,构建二进制字符串,并且有一次因为没有比特进入而超时。然后将二进制转换为十进制

#include <LiquidCrystal.h>
int data0 = 2;                      //set wiegand data 0 pin
int data1 = 3;                      //set wiegand data 1 pin

unsigned long bit_holder;           //unsigned long (positive 32 bit number)
unsigned long oldbit = 0;
volatile int bit_count = 0;
LiquidCrystal lcd(8, 9, 10, 11, 12, 13);
unsigned long badge;
unsigned int timeout;
unsigned int t = 800;

void setup() {
  Serial.begin(9600);
  lcd.begin(16, 2);
  lcd.print("Present Badge");
  delay(2);
  Serial.println("Present Badge");

  pinMode(data0, INPUT);
  digitalWrite(data0, HIGH);
  pinMode(data1, INPUT);
  digitalWrite(data1, HIGH);
  attachInterrupt(0, zero, FALLING);   //attach interrupts and assign functions
  attachInterrupt(1, one, FALLING);
}


void zero(){
  bit_count ++; 
  bit_holder = (bit_holder << 1) + 0;  //shift left one and add a 0
  timeout = t;
}

void one(){
  bit_count ++; 
  bit_holder = (bit_holder << 1) + 1;  //shift left one and add a 1
  timeout = t;
}

void loop() {
  timeout --;
  if (timeout == 0 && bit_count > 0){
    lcd.clear();
    lcd.print("Dec:");
    lcd.print(bit_holder);
    lcd.setCursor(0,1);
    lcd.print("Hex:");
    lcd.print(String(bit_holder,HEX));

    Serial.print("bit count= "); 
    Serial.println(bit_count);
    Serial.print("bits= "); 
    Serial.println(bit_holder,BIN);
    oldbit = bit_holder;                //store previous this value as previous
    bit_count = 0;                     //reset bit count
    bit_holder = 0;      //reset badge number

  }

}
#包括
int data0=2//将wiegand数据设置为0引脚
int data1=3//将wiegand数据设置为1引脚
无符号长位固定器//无符号长(正32位数字)
无符号长oldbit=0;
易失性整数位_计数=0;
液晶液晶显示器(8,9,10,11,12,13);
未签名的长徽章;
无符号整数超时;
无符号整数t=800;
无效设置(){
Serial.begin(9600);
lcd.begin(16,2);
lcd.打印(“当前徽章”);
延迟(2);
序列号。打印号(“当前徽章”);
pinMode(数据0,输入);
数字写入(数据0,高);
pinMode(数据1,输入);
数字写入(数据1,高);
附加中断(0,零,下降);//附加中断并分配函数
附着中断(1,1,坠落);
}
无效零(){
比特计数++;

bit_holder=(bit_holder您可能需要找到一个提供连续读取的读卡器,正如我所知,市场上几乎有Wiegand reader无法执行连续读取,因为他们有一个“板载”控件来控制这一点。。。
也许你可以尝试使用Arduino串行RFID阅读器…

我以前的答案已被删除。我将再次尝试回答这些问题

你知道怎么做吗

Arduino无法做到这一点,因为在您的情况下,Arduino只是从RFID读卡器读取D0和D1脉冲。由于RFID读卡器Rosslare AY-X12不发送wiegand协议的连续输出,Arduino无法读取比未发送到它的更多的数据

普通RFID读卡器不会发送同一张卡的连续数据,因为在普通用例中(进入/退出/出勤),通常一个点击用于办理入住手续,另一个点击用于办理退房手续。如果RFID读卡器发送同一张卡的连续数据,则接收多个wiegand数据的主系统将被混淆,无法确定用户是否确实希望办理入住或退房手续

有没有RFID arduino图书馆可以做到这一点

没有。没有这样的RFID Arduino库。如果RFID读卡器没有发送连续数据,则接收器(Arduino)无法接收这些数据

有没有办法做到这一点

是的,例如,有些读卡器可以选择打开数据的连续输出。在其规范中:

带标签的连续输出在现场或单次传输中


将此读卡器配置为连续输出,然后您可以使用Arduino和读取数据。

是的,此卡上有一个PIC微控制器。工作得很好,谢谢。我必须将超时时间提高到8000以使其工作
unsigned int t=8000;