A calibration fixture measures three analog voltages and needs a label with the readings as a barcode and the decimal values readable underneath. A second fixture reads those values back later in the process. You can run the whole chain from two PLCs: one sends an ASCII job over a serial port to a label printer that takes text commands, and the other reads the label with a fixed code reader wired to its own PLC. No PC, no print server, no driver stack to maintain. This guide covers the wiring, the serial settings, the string you build in PLC memory, a worked example for three 12-bit channels, and the reader choice for the read-back fixture.
What you need
Five items cover the job, and none of them is a computer:
- A PLC with a spare serial port that sends ASCII strings, or an Ethernet port that can open a raw connection to the printer.
- A thermal or thermal-transfer label printer that accepts a text command language. In the common caret-delimited language, the ^BC command places a Code 128 symbol; the printer manual lists every field command with its parameters in order.
- A serial cable built to that manual's pin list. The same page says whether the cable is straight-through or crossed.
- A fixed code reader for the second fixture, with a discrete trigger input you can drive from a PLC output.
- Label stock wide enough for the symbol plus a quiet zone at each end.
Step 1: bring the serial link up
Start at 9600 baud, 8 data bits, no parity, one stop bit (8-N-1) on both ends. That combination is the usual factory setting, so it is the first pair of values to try, and at this speed the link forgives marginal cables and electrically noisy cabinets. If the printer's menu or DIP switches show a different factory value, set the PLC port to match instead of reconfiguring the printer. When nothing arrives at all, swap the two data conductors before you touch the software: crossed versus straight cabling is the most common fault on this link.
Keep the RS-232 run short and inside the cell. If the printer lives in another cabinet, put a serial-to-Ethernet converter next to the PLC rather than stretching cable across the floor.
Step 2: build the job string with fixed-width fields
A 12-bit measurement spans 0 to 4095, so four ASCII characters hold any value the fixture can produce. Fix every field at four characters and pad with leading zeros, and the payload length never changes from part to part.
- Convert each raw count to ASCII decimal with the PLC's integer-to-string instruction.
- Pad to four characters: 315 becomes 0315, and 7 becomes 0007.
- Concatenate in channel order: channel A, then B, then C.
- Place the 12-character payload in the barcode field of the job template, and the same digits grouped by channel into the human-readable text field.
- End with the print-quantity command and the terminator the manual specifies.
In the caret language the barcode field command is ^BC, and the manual defines its orientation, height and remaining parameters in order. Put the readable digits in their own text field rather than inside the symbol: operators proof the label by eye, and the reader ignores text.
Assembling that string and clearing stale bytes between jobs is the same problem as handling any ASCII device on a serial port. Storing ASCII barcode strings in PLC memory walks through byte order, word boundaries and the clears.
Step 3: send one job per part, then wait for the printer
Gate the transmit behind a one-shot on the part-present signal. A PLC that writes the label string out like an output coil re-sends it every scan cycle, tens of times per second, and the printer responds with a stack of identical labels or a mix of partial jobs. One rising edge sends one job and produces one label.
After the send, hold the part until the printer reports completion: a busy output, a fault relay or a status return, whichever the manual provides. Wire that signal to a PLC input and let the part-release interlock require it.
Wire time is predictable and print time is not. At 8-N-1 each character costs 10 bits on the wire, one start, eight data, one stop:
A 150-character job spends 0.16 s on the wire. The thermal print itself usually takes longer, which is why the completion handshake matters more than the baud rate.
Worked example: three 12-bit channels on one label at 9600 baud
Inputs: three analog channels digitized at 12 bits, so each reading spans 0-4095 counts; illustrative readings of A = 2748, B = 315 and C = 7 counts; the serial link at 9600 baud, 8-N-1, from step 1; a job of about 150 characters, which a three-field label of this shape typically reaches.
Rule: pad each reading to four ASCII digits, concatenate in channel order into one Code 128 payload, and repeat the same digits in the text line. The fixed field width keeps the symbol geometry identical for every part.
Arithmetic:
- A = 2748 prints as 2748, B = 315 as 0315, C = 7 as 0007.
- Payload = 274803150007, 12 characters.
- Text line = A2748 B0315 C0007, 17 characters.
- Wire time = 150 x 10 / 9600 = 0.156 s, about 160 ms.
Result: every label carries a 12-digit symbol in the same position and size, so the read-back fixture needs one reader setup, and its decode parses at fixed positions 1-4, 5-8 and 9-12.
Decision: keep every field four digits as you add channels, so the payload stays a multiple of four. Treat 9600 baud as sufficient until a job passes roughly 300 characters, where wire time reaches 0.31 s. The timing constraint to engineer is the completion handshake, not the baud rate.
Choose the reader for the read-back fixture
Match three things: the reading distance the fixture geometry allows, the interface the second PLC speaks, and a trigger input you can wire like any discrete sensor. A reader left in free-run double-reads and floods the PLC; trigger it from a GPIO pin instead so one part yields one decode.
For a label at a fixed working distance with the result going back over the network, a compact Ethernet reader is the direct path:
- Interface
- Fast Ethernet
- Resolution
- Up to 3 MP
- Shutter
- Global
- Lens mount
- M12
The MV-ID3013PM-12M-WBN pairs a 1.3 MP sensor with a 12 mm focal length and reports over Fast Ethernet on an M12 mount. When the label is smaller, sits deeper in the fixture, or shares the image with other marks, weigh reach and sensor resolution across the family:
| Specification | MV-ID813M-05S-WBN-SR | MV-ID5120RM-08M-RBN |
|---|---|---|
| Symbologies | 1D code: Code 39, Code 93, Code 128 (incl. GS1-128), ITF14, ITF25, CodaBar, EAN8, EAN13, UPCA, UPCE; Matrix 2D code: QR Code (incl. GS1-QR), Data Matrix (incl. GS1-DM), Micro QR, AZTEC, Han Xin; Stacked 2D code: PDF417 | 1D codes: Code 39, Code 93, Code 128 (GS1-128 included), CodaBar, EAN 8, EAN 13, UPCA, UPCE, ITF 14, ITF 25, Matrix 25, MSI, China Post, Code 11, Industrial 2of5, and Pharmacode; 2D codes: QR Code (GS1-QR included), Data Matrix (GS1-DM included), MicroQR, AZTEC, HanXin; Stacked codes: PDF417, MicroPDF417 |
| Max. frame rate | 60 fps | 10 fps |
| Max. reading speed | 20 codes/s | 30 codes/sec |
| Sensor type | Mono, 1/4", 2.7 μm × 2.7 μm | Rolling shutter, mono, 1/1.57", 2 μm × 2 μm |
| Resolution | 1280 × 1024 | 4096 × 3024 |
| Exposure time | 60 us ~7000 us | 33 μs to 1 sec |
| Gain | 1 dB ~ 15 dB | 0 dB to 34 dB |
| Data interface | RJ45 | Gigabit Ethernet (1000 Mbit/s) |
| Communication protocol | SmartSDK, TCP Client, Serial, FTP, TCP Server, UDP | SmartSDK, TCP Client, Serial, FTP, TCP Server, Profinet, MELSEC/SLMP, Ethernet/IP, ModBus, ModBus RTU, UDP, Fins |
| Digital I/O | 1 non-isolated input (pin 1 input), 1 non-isolated output (pin 3 output), 1× RS-232; Device trigger via top button supported | 12-pin M12 connector provides power and I/O, including opto-isolated input (LineIn 0/1/2) × 3, opto-isolated output (LineOut 3/4/5) × 3, RS-232 input × 1, and RS-232 output × 1.; Supports device triggering via pressing button on device and smart tune. |
| Power supply | 12 ~ 24 VDC | 24 VDC |
| Power consumption | Max. power: 2.5 W @ 12 VDC | Avg.: 15.5 W @ 24 VDC (light source enabled); Max.: 36 W @ 24 VDC (light source enabled) |
| Price | $719.00 | $1,969.00 |
All 2 share: Shell material Metal; Client software IDMVS; Certification CE, RoHS, KC. Values as printed in each product's data sheet; open a part for its drawing and full specifications.
These readers carry power, trigger and data in one integrated cable, so the panel side is a handful of conductors plus a network plug:
- Type
- Code Reader Cables
The MV-IDA-PE-M12A17pF-openRJ45DB9-HF-5m runs 5 m from reader to panel, is built for high-flex routing, and breaks out to open leads plus RJ45 and DB9 tails, so trigger and power land on PLC I/O terminals and data on the switch. The cables range covers these leads and their spares.
Size symbol and geometry together: Code 128 module size, reading angle and reader distance works that arithmetic, and the first-connection setup checks for a fixed code reader apply when you commission the reader before it mounts. For the decode's path into the second PLC, barcode reader PLC communication: plan a reliable link covers interface choice and handshaking.
The configurator matches a camera, lens, light, light controller and cables to each other, step by step, and lists only parts that fit what you already picked.
Verify the label before the part moves on
The read-back PLC accepts a decode only when three checks pass. First, the symbol decodes: a no-read is a reject, never a pass-through. Second, the payload splits cleanly into three four-character fields, and splitting a barcode string into fields shows the parse. Third, every field converts to a number from 0 to 4095, the only range a 12-bit fixture can produce.
That range check is a strong guard against wrong labels: a 12-digit string with 9999 in the middle field cannot have come from this fixture. When labels run through an applicator or a harsh process, add print grading to the read-back station; barcode reader verification for label inspection explains what a graded read adds beyond pass or fail.
When a PLC is the wrong print controller
Commit the PLC route when labels carry measured values in a fixed layout, which is exactly this case. Move the formatting up a level when labels need variable graphics, many typefaces, 2D symbols with structured payloads, or on-demand reprints from history. An HMI or SCADA application can own the template and still send plain ASCII; sending print commands to a networked label printer from SCADA is one worked example. Either way the PLC keeps the measurement and the interlocks.
Checks before you commit the design
- Serial settings identical at both ends, 9600 baud 8-N-1 first. Defaults differ between printer models, and a mismatch means silence.
- One-shot gating on the transmit. Scan-rate re-sends print stacks of labels.
- Four-digit fixed fields. Variable width changes the symbol from part to part and voids the reader setup.
- Quiet zone on the artwork, at least 10 times the module width per side, the Code 128 minimum. Edge-crowded symbols read marginally.
- Print-complete input wired to the part-release interlock. Without it the part can leave before the symbol exists.
- 0-4095 range check per field at the read-back PLC. It rejects misreads and labels from other fixtures.
- Reader bracket inside the reader's stated reading distance. Geometry drift shows up as intermittent no-reads.
If the printer's command table fights back, send it to us through the contact page together with the exact string your PLC emits, and we will shape the job with you. The code-reading topic page gathers the read-side guides, starting with how to plan the reader-to-PLC link.
Questions
Which symbology should the PLC print: Code 128 or Code 39?
Code 128, unless an older reader elsewhere in the plant only speaks Code 39. Code 128 encodes digits densely, accepts any payload length, and the printer computes its mandatory check character for you, so no ladder logic is involved. Code 39 packs fewer characters per inch, which means a wider symbol or a smaller module for the same 12-digit payload.
What serial settings should I try first on the printer port?
9600 baud, 8 data bits, no parity, one stop bit, set identically on both ends. Most printers leave the factory that way. Handshaking off is fine while you send one short job at a time; enable it only when you queue jobs faster than the printer empties its receive buffer. If the printer's menu shows another factory value, copy that value into the PLC port configuration.
How much quiet zone does a printed Code 128 label need?
At least 10 times the narrow module width of blank label on each side of the symbol, which is the Code 128 minimum, and more if an applicator or product handling can crowd the ends. A symbol butted against the label edge reads marginally or not at all, and that failure usually appears at the read-back fixture long after the artwork was approved.
How does the PLC know the label actually printed?
Most printers expose a busy or fault state on a discrete pin, and some return a status frame on the serial port after each job; wire whichever your model provides into a PLC input and interlock part release on it. Read the label independently before the part leaves the fixture as well, because a printer can consider a job complete while a worn head produced a light symbol.
Do the printed measurement values need a check digit?
No. Code 128 already carries a mandatory check character that the printer computes internally, so the symbol itself verifies every read. Add the 0-4095 range check per four-digit field at the read-back PLC and you also catch swapped or wrong-field values. A computed check digit only earns its label space when people will key the same numbers in by hand downstream.

