Pages: [1]   Go Down
Author Topic: RFID reader not responding to query  (Read 1106 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Newbie
*
Karma: 0
Posts: 2
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hi,

I'm currently using an arduino uno to query a RFID reader, after query, it should return the version of the rfid reader. The RFID reader im using is of the following: "http://www.rfidshop.com.hk/datasheet/UHF-Reader/CD-UHF-MP-RW-232.zip". Can somebody please tell me what im doing wrong? I've used a rs232 -ttl converter before plugging it into the arduino board. Also, the checksum bit is XOR.  The myserial.write function doesnt seem to get through because when i measure the tx pin on the arduino board using a multimeter, the voltage remains constant and it doesnt fluctuate. When i open the serial terminal, myserial.available, is always 0, hence it doesnt go into that if function.

Thanks.

#include <SoftwareSerial.h>

#define rxPin 2
#define txPin 4
#define ledPin 13

//byte GetData[] = {0x0A,0xFF,0x02,0x22,0xD5};
// set up a new serial port
SoftwareSerial mySerial =  SoftwareSerial(rxPin, txPin);
 

void setup()  {
  // define pin modes for tx, rx, led pins:
  pinMode(rxPin, INPUT);
  pinMode(txPin, OUTPUT);
  pinMode(ledPin, OUTPUT);
  // set the data rate for the SoftwareSerial port
  Serial.begin(9600);
  mySerial.begin(9600);

}

void loop() {
 byte GetData[] = {0x0A,0xFF,0x02,0x22,0xD5};
  Serial.println("creating query");
  delay(2000);
  mySerial.write(GetData,sizeof(GetData));
    Serial.println(sizeof(GetData));
    Serial.println("sending query");
   delay(2000);
   if (mySerial.available() > 0) {
  char someChar = mySerial.read();
  Serial.println(someChar, HEX);
   
     // listen for new serial coming in:
  //
 // delay(1000);
   Serial.println("received: ");
   //delay(1000);
  digitalWrite(13, HIGH);   // set the LED on
  //delay(1000);              // wait for a second
  digitalWrite(13, LOW);    // set the LED off
 // delay(1000);   
   }
   
   Serial.println("nothing ");
   delay(2000);
}
Logged

Seattle, WA USA
Online Online
Brattain Member
*****
Karma: 613
Posts: 49301
Seattle, WA USA
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

How much of that code does NOT illustrate the problem you are having? Please modify your post, and post the code properly, using the # icon before pasting the code. Before pasting the code again, remove everything that is commented out. That it is commented out means that clearly it is not part of the problem. Using Tools + Auto format before reposting would be nice, too.

One question that comes to mind, though, is why you think that the version of code on the reader might change while the Arduino is talking to it. If it won't (and it won't), you should be trying to get the data in setup(), not loop().

Code:
#define rxPin 2
#define txPin 4
SoftwareSerial mySerial =  SoftwareSerial(rxPin, txPin);
Most people choose adjacent pins. Some reason that you didn't? Is the device connected correctly to these pins? Is it possible that you need to swap the pins that the device is connected to?
Logged

Pages: [1]   Go Up
Jump to: