Search code examples
c#zebra-printerszpl

Why always fail for the first read ID Tag on Zebra ZT411 RFID


I have Zebra ZT411 models and im using ZPL combined C# to get the ID Tag, but i don't know why its alway fail for the first tag. Sometime it response null, sometime it response serial number of ZT411. Always the first tag and all the next is fine. Im using USB connector and this is my code and ZPL command

string zplData = "^XA^RFR,H,2,6,1^FN1^FS^HV1,,^FS^XZ";

byte[] encodeData = Encoding.UTF8.GetBytes(zplData);
received = connection.SendAndWaitForResponse(encodeData, 960, 650, "null");
if (received != null)
{
   string response2string = Encoding.ASCII.GetString(received);
}

first read and response

the second read and real ID response

So i dont know what im doing wrong in zpl command or c#


Solution

  • I have a Zebra ZD500R printer. I had problems running this command. I increased the initialResponseTimeout in the command

    byte[] SendAndWaitForResponse(byte[] dataToSend, int initialResponseTimeout, int responseCompletionTimeout, string terminator);
    

    to 2500ms and no more problems.

    byte[] received = connection.SendAndWaitForResponse(encodeData, 2500, 500, "null");