Shop OBEX P1 Docs P2 Docs Learn Events
RFID read issue with #28440 read/write RFID board. — Parallax Forums

RFID read issue with #28440 read/write RFID board.

tekatitekati Posts: 1
edited 2013-02-11 17:34 in General Discussion
I am using the test code on arduino.cc modified for the arduino mega. It was working at first but now all I get is -1 for each byte response for all tags.

Here is the test code.
//Code to read data from Parallax RFID reader/writer 28440 via Arduino//Program reads data from the old EM4100-based tags and prints their value in the serial monitor.


//Writen by vgrhcp, uberdude, sebflippers and sixeyes


#define RFID_LEGACY 0x0F


int  val = 0; 
char code[11];     //Note this is 11 for the extra null char?
int bytesread = 0;


void setup()
{
  Serial.begin(9600);
  Serial1.begin(9600);


//  pinMode(2, OUTPUT);
//  pinMode(4, OUTPUT);


  Serial.println("RFID Read/Write Test");
}


void loop()
{
  Serial1.print("!RW");
  Serial1.write(byte(RFID_LEGACY));


  if(Serial1.available() > 0) {          // if data available from reader 


    if((val = Serial1.read()) == 10) {   // check for header 
      bytesread = 0; 
      while(bytesread<10) {              // read 10 digit code 
        if( Serial1.available() > 0) { 
          val = Serial.read(); 
          Serial.println(val);
          if((val == 10)||(val == 13)) { // if header or stop bytes before the 10 digit reading 
            break;                       // stop reading 
          } 
          code[bytesread] = val;         // add the digit           
          bytesread++;                   // ready to read next digit  
        } 
      } 


      if(bytesread == 10) {              // if 10 digit read is complete 
        Serial.print("TAG code is: ");   // possibly a good TAG 
        Serial.println(code);            // print the TAG code 
        delay(3000);
      } 
      bytesread = 0;
      delay(500);                       // wait for a 1/2 second 
    } 
  } 
}

Here is the output of the serial window.
RFID Read/Write Test-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
TAG code is: ÿÿÿÿÿÿÿÿÿÿ
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
TAG code is: ÿÿÿÿÿÿÿÿÿÿ
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
TAG code is: ÿÿÿÿÿÿÿÿÿÿ
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
TAG code is: ÿÿÿÿÿÿÿÿÿÿ
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
TAG code is: ÿÿÿÿÿÿÿÿÿÿ
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
TAG code is: ÿÿÿÿÿÿÿÿÿÿ
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
TAG code is: ÿÿÿÿÿÿÿÿÿÿ

Not sure why this started. I have of course repowered everything. Uploaded the code several times. Still nothing but -1 its like the board is not working anymore.

Comments

  • FranklinFranklin Posts: 4,747
    edited 2013-02-11 17:34
    Are you sure you have the correct baud rate between the reader and the Arduino?
Sign In or Register to comment.