0

I want to write numeric data to the RFID Tag with Balluff BIS M-410 series Tag Reader and Writer. I can read data from the Tag but i can't write to the RFID Tag. The steps is here. It from Balluff pdf.

enter image description here

And my function is here :

public void WriteTag()
{
    byte[] b = new byte[17];

    b[0] = 0x02; //command header
    b[1] = 0x011; //command size
    b[2] = 0x0006;  // command id

    b[3] = 0x0000;
    b[4] = 0x0000;   //Start Adres

    b[5] = 0x0000;
    b[6] = 0x0006;  //Lenght

    b[7] = 0x007D;
    b[8] = 0x007D; //timeout value

    b[9] = 0x0001;
    b[10] = 0x0002;
    b[11] = 0x0003;
    b[12] = 0x0004;
    b[13] = 0x0005;
    b[14] = 0x0006;

    b[15] = 255;
    b[16] = 255;

    serialPort1.Write(b, 0, 17);
}
Gerald Schneider
  • 17,416
  • 9
  • 60
  • 78

1 Answers1

0

Your command size is wrong. You say there will be 17 bytes of data for the command, while you send 17 bytes altogether. The device is probably waiting for more data. This can be seen in the example: it says the length is 0x0c and if you count the bytes after the command ID there are 13 bytes there.

I assume using the device as big endian is ok (length is sent as such), but where is the command terminator 0x03? Why is there 0xff 0xff in the end?

Also as a style thing I wouldn't use 0x0006 as a literal when the variable is a byte. It doesn't do anything wrong but easily gives the impression of a 16bit variable.

Sami Kuhmonen
  • 30,146
  • 9
  • 61
  • 74