Coils
Each mapped coil is bound either to a signal or to an action in the printer. The mapping list gives, for each coil, its address, its access and the name of the signal or action.
Coils that are not mapped read as 0. A read may cover any range within 0–65535, mapped or not, so the PLC can read all the coils it needs in one request.
Signal coils
Signals are the printer's booleans: digital inputs, status flags, user signals and user expressions. See Built-in signals for the signals the printer provides, such as:
| Signal | Active when |
|---|---|
printer.<printerID>.ready | The printer is ready to print. |
printer.<printerID>.printing | The printer is printing. |
printer.<printerID>.label_selected | A print job is selected. |
printer.<printerID>.red | The status light is red. |
printer.<printerID>.ink_low | The ink level is low. |
- A read-only coil (access
R) reports the signal's current state. - A read/write coil (access
RW) can also be set and cleared by the PLC. Only signals that can be written from outside, such as user signals, can be mapped as writable.
A write sets a level, not a pulse. Writing 1 turns the signal on, and it stays on until the PLC writes 0 or something else on the printer changes it.
A user signal written by the PLC can be used on the printer like any other signal: to drive an output pin, in an expression, or to run an action on its edge. See Using a PLC bit in the printer.
Action coils
An action coil is a command bit held by the printer. Writing 1 to a coil that reads 0 runs the action once. Examples of actions:
| Action | Does |
|---|---|
printer.<printerID>.abort_print | Aborts the current print. |
printer.<printerID>.deselect | Deselects the current print job. |
printer.<printerID>.start_request | Starts the ink system (Marvin1 and Blade). |
printer.<printerID>.stop_request | Stops the ink system (Marvin1 and Blade). |
printer.<printerID>.standby_request | Puts the ink system in standby (Marvin1 and Blade). |
signal.<signal>.activate | Activates a writable signal. |
signal.<signal>.deactivate | Deactivates a writable signal. |
See Actions for more.
Writing 0 never runs anything, and writing 1 to a coil that already reads 1 does nothing. An action coil works in one of two ways:
- Latching (access
RW, the default). The coil keeps the written value and reads it back. To run the action again, the PLC must first write 0 and then 1, so a rising edge in the PLC program becomes a rising edge in the coil. Use the PLC's one-shot or pulse instruction for this. - Auto-clear (access
W). The coil resets to 0 as soon as it is written, so it always reads 0 and every write of 1 runs the action. It is safe to include in a polled read.
The coil reports the command bit, not the state of the printer. To know
whether the command took effect, read a signal that reflects the result, for
example printer.<printerID>.ready.
All action coils read 0 after the printer restarts, and after the coil's mapping is changed.
If the action does not exist on the printer, for example because it belongs to a printer that has been removed, the write returns exception 04 and the error is logged on the printer.
Writing several coils
Function 15 (Write Multiple Coils) is checked as a whole before anything is written. If the request includes any coil that is not writable, including unmapped coils, the whole request is rejected with exception 02 and nothing is written.
Example
With the example mapping list:
| Request | Result |
|---|---|
| Read coils 0–4 (function 01) | Ready, printing, label selected, red and ink low. |
| Write coil 8 = 1 (function 05) | Sets the user signal plc.line_running. Reading coil 8 returns 1. |
| Write coil 0 = 1 | Exception 02, coil 0 is read-only. |
| Write coil 16 = 1 | Starts the ink system. Coil 16 reads 1 until the PLC writes 0. |
| Write coil 16 = 1 again | Nothing, the coil already reads 1. |
| Write coil 18 = 1 | Aborts the print. Coil 18 reads 0 at once. |
| Write coils 0–8 (function 15) | Exception 02, the range includes read-only and unmapped coils. Nothing is written. |