Registers
Registers are grouped into items. An item occupies one or more consecutive registers, as given by its data type and length in the mapping list. Each item is bound to a target:
| Target | Access | Holds |
|---|---|---|
| Counter | R or RW | A label counter. |
| Variable | R or RW | A label variable. |
| Statistic | R | A statistics counter, such as printed labels. |
| Fixed speed | R or RW | The printer's fixed speed, in mm/s. |
| Select label | W | Selects a label to print. |
| Select from table | W | Selects a label to print by looking up a key in a table. |
| Internal register | R or RW | Storage shared with software on the printer. |
| Reserved | R | Always 0, fills gaps between items. |
Reading
Functions 03 and 04 read the same registers. A read request must consist of whole items:
- It may cover several consecutive items, as long as it starts at the first register of an item and ends at the last register of an item.
- A read that includes a register with no mapping returns exception 02.
- A read that covers only part of a multi-register item returns exception 02.
Write-only items read as 0, so a block read may include them.
If an item cannot be read at the moment, for example because its counter has been deleted, its registers read as 0 and the request succeeds. The problem is logged on the printer.
Writing
Each item is read-only (R), read/write (RW) or write-only (W).
- Writing a read-only item returns exception 02. A function 16 request is checked as a whole first, so a request that touches any read-only item is rejected without writing anything.
- A function 16 write must consist of whole items, with the same rules as a
read. The exception is a
STRINGitem, which may be written short, see Strings. - A function 06 write is accepted for items that occupy one register, and for
the first register of a
STRINGitem. Function 06 on any other multi-register item returns exception 02. - A value the item does not accept, such as text that is not valid UTF-8 or a negative speed, returns exception 03.
- A write the printer cannot carry out, for example because the counter or label does not exist, returns exception 04. The reason is logged on the printer.
Example
With the example mapping list:
| Request | Result |
|---|---|
| Read 0–12 (13 registers) | Serial, lot, speed and printed labels, in one request. |
| Read 0–35 (36 registers) | As above, plus the reserved block and the Select label item, which read 0. |
| Read 1 (1 register) | Exception 02, the second half of the UINT32 at 0–1. |
| Read 50 | Exception 02, not mapped. |
Write 0–1 = 0x0001 0xE240 (function 16) | Sets the counter Serial to 123456. |
| Write 0 = 5 (function 06) | Exception 02, the item has two registers. |
| Write 11–12 (function 16) | Exception 02, statistics are read-only. |