Skip to main content

Monitoring printer status

Goal: show the printer's state on an HMI, and stop the line if the printer has a fault.

Printer setup​

Add a read-only coil for each status signal:

AddressBind toSignal
0Signalprinter.NoLabel.ready
1Signalprinter.NoLabel.printing
2Signalprinter.NoLabel.label_selected
3Signalprinter.NoLabel.red
4Signalprinter.NoLabel.ink_low

Any signal can be mapped, including user expressions that combine other signals, for example "ready and label selected". See Built-in signals.

PLC​

Read coils 0–4 in one request with function 01 or 02, every cycle or every few hundred milliseconds. Coils that are not mapped read 0, so a larger read, for example 0–31, also works and leaves room for more signals later.

Try it​

from common import *

names = ["ready", "printing", "label_selected", "red", "ink_low"]
bits = check(client.read_coils(0, count=5)).bits
for name, bit in zip(names, bits):
print(f"{name:15} {bit}")