Can anyone help me with the following?
I have connected a SkyeTek M1 mini RFiD module to an Arduino and successfully got the arduino to talk to the M1, send a read command, and output the RFiD data through the serial port.
The code that I have used for this is as follows:
/* Original code sourced from http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl?num=1195486917/4
modified by Ian Culverhouse to filter some of the unwanted data being printed to serial
*/
#include <SoftwareSerial.h>
#define txPin 5
#define rxPin 4
#define ledPin 13
#define readPin 8
// set up a soft serial port
SoftwareSerial mySerial(rxPin, txPin);
// create some space for receiving data from tag reader
#define d_size 68
byte dta[ d_size];
void setup() {
// define pin modes for tx, rx, led pins:
pinMode(rxPin, INPUT);
pinMode(txPin, OUTPUT);
// set txPin high (as recommended in forum)
digitalWrite(txPin, HIGH);
// set the data rate for the serial ports
mySerial.begin(9600);
Serial.begin(9600);
Serial.println("begin ");
}
void loop() {
int in_count;
// send command
mySerial.print( 0x0d, BYTE); //send CR
mySerial.print("001400"); // Send read command to M1 mini
mySerial.print( 0x0d, BYTE); //send CR
// get first byte of answer
byte ch = mySerial.read();
// if it was not a LF, send read command again
// if it was, store all bytes until ending LF was received
if (ch == 0x0a)
{
ch = mySerial.read();
in_count = 0;
while( (ch != 0x0a) && ( in_count < d_size))
{
dta[in_count] = ch;
in_count++;
ch = mySerial.read();
}
}
// and print the received characters to Serial
// Before it enters the printing loop, it checks to see if the first character of the array is 9
// if it is then it will not print to serial. This is done to remove a constant stream of 94
// being printed to the serial port.
if (dta[0] != '9') {
for ( int i = 0; i < in_count; i++) Serial.print( dta*, BYTE);*
-
Serial.println();*
-
}*
}
Can anyone help suggest to me how I can modify my existing code to allow me to read and write to the data blocks on an RFiD tag?
According to the SKyetek datasheets the read memory protocol command = 0x21, read_sys = 0x22, read_tag = 0x24.
Any advice anyone can offer will be very much appreciated