Sending the line speed
Goal: the line has no encoder for the printer, but the PLC knows the line speed. The PLC keeps the printer's speed up to date.
Printer setup
-
Set the printer's speed source to fixed speed, in the printer settings.
-
Add a register mapping:
Field Value Address 10 Mapping Fixed speed Data type UINT16Printer NoLabelWritable On
PLC
Write the speed in millimetres per second, as a whole number, whenever it changes. For example, 15 m/min is 250 mm/s. The printer saves the setting, so avoid writing it many times a second when the speed has not changed.
Try it
from common import *
metres_per_minute = 15
check(client.write_register(10, round(metres_per_minute * 1000 / 60)))
print(check(client.read_holding_registers(10, count=1)).registers[0]) # 250