问题
I'm attempting to read the TID bank of the current (Class 1 Generation 2) RFID tag sitting under the print-head in a Zebra RZ400 (running the latest firmware V53.17.22Z). I'm connected via USB.
I'm using the "Direct Communication" program in the Zebra Setup Utilities tool.
This is my program, annotated:
^XA Start program
^RS8 Set RFID mode to Class 1 Gen 2
^RFR,H,0,8,2 Read the first 8 bytes of the TID bank as a Hexadecimal string
^FN1 Store the data into Memory Field #1
^FS End Field
^HV1,,Foo Transfer the contents of Memory Field #2 to the Host PC
^FS End Field
^XZ End program
When I run this, I do not get any output in the "Data received" window.
However, if I append a command like ^HH to the end (after the ^XZ) and re-run the program then the previous expected output will appear (followed by the output of ^HH). I need to keep on re-running the commands to get the previous output, making it impossible to see the current TID value.
It's as though the printer isn't flushing its output buffer until I run ^HH - other commands work temperamentally. The ^HH command isn't appropriate for my application because of the sheer amount of data it produces.
Is there some command that forces a flush?
回答1:
I need to learn to read the documentation.
The ^HV command has 5 parameters. The sample code I based my program off only provides the first 3 parameters and I didn't think that the other parameters were relevant - mostly because Zebra gave the key parameter the nonobvious name "command applies to":
^HV(fieldNumber),(byteCount),(header),(terminator),(commandAppliesTo)
While I had set fieldNumber, byteCount, and header correctly (I ignored terminator) I completely overlooked the commandAppliesTo parameter, which states:
When
^PQis greater than1or if a void label occurs, send one response for a label format or one for every label printed.Accepted Values:
F= FormatL= LabelDefault Value:
F
So when you don't specify a value it defaults to F which means it will return the data only when the entire job has completed, by changing it to L I get a response for each label that is printed.
Here's my final working command:
^XA
^RS8
^RFR,H,0,8,2
^FN1
^FS
^HV1,256,HEADER,TERMINATOR,L
^FS
^XZ
Which gets me output like this:
HEADERE28011302000240CTERMINATORHEADERE28011302000241CTERMINATORHEADERE28011302000242CTERMINATOR
Sorted :)
来源:https://stackoverflow.com/questions/36642368/rfr-fn1-hv1-not-sending-output-to-computer