System designHow-to

Ethernet IP barcode reader to PLC: map the implicit I/O assembly

Map a fixed barcode reader's EtherNet/IP I/O into PLC tags: input assembly 24 words, output 4, where the ASCII result lands, and the handshake that gates it.

LumaSpec Vision10 min read Share on LinkedIn

On this page 8 sections
  1. 01The map: three instances and two arrays
  2. 02Configure the generic Ethernet module in the PLC
  3. 03The handshake: trigger, acknowledge, read complete
  4. 04Decode the result: two characters per element
  5. 05Why the array reads all zeros
  6. 06When implicit I/O is the wrong link
  7. 07Checks before the first trigger
  8. 08Questions

You wired a fixed barcode reader to the PLC over Ethernet, the reader's own set-up tool decodes every code, and the PLC input array sits at zero. The gap is rarely the reader: an EtherNet/IP implicit connection moves bytes only after the generic module is configured with the reader's exact assembly instances and sizes, and the result string still has to be gated on a status bit and decoded in ladder. This walkthrough gives the numbers for the common industrial layout — input instance 11 with 24 16-bit elements, output instance 21 with 4, configuration instance 1 — where each status bit and ASCII character lands, the trigger handshake, and the arithmetic that turns integer elements back into a 10-digit string.

The map: three instances and two arrays

An EtherNet/IP implicit link is three assemblies: an input assembly the reader publishes, an output assembly the reader consumes, and a configuration assembly the PLC sends once at connect time. On the common industrial reader layout the numbers are:

Assembly Instance Size What lands where
Input, reader to PLC 11 24 elements × 16 bits Element 1 status word; elements 2 to 8 housekeeping; elements 9 to 23 result string, two ASCII characters per element
Output, PLC to reader 21 4 elements × 16 bits Element 1 control word with the trigger bit; elements 2 to 4 reserved
Configuration 1 0 bytes unless the manual lists a payload Connection set-up, rarely used

Element counts in the manual are one-based: element 1 is the first word of the PLC array, index 0 in the tag database. The same off-by-one that bites barcode detection coordinate indexing applies here — your array starts at 0, the table starts at 1.

The first input element is the status word: bit 0 is trigger ready, bit 1 is trigger acknowledge, and the read-complete flag sits at bit 8 of the same word on this layout. The first output element is the control word, with the network trigger at bit 0; if its bit table lists a trigger-enable bit, set it once at start-up, because the trigger bit alone is ignored while enable is clear.

result elements = ceil(code length / 2) element = 256 × char1 + char2

Two characters ride in every element, so elements 9 through 23 carry up to 30 characters. A 10-digit code takes ceil(10 / 2) = 5 elements — 9 through 13 — and the reader pads the unused words with null bytes. If your reader's table starts the string at a different offset, that offset moves and nothing else in the method does.

A compact reader for close-range codes:

Fixed code readersHikrobot MV-ID3013PM-12M-WBN 12mm focal length 1.3 MP Compact Industrial Code ReaderMV-ID3013PM-12M-WBN
Interface
Fast Ethernet
Resolution
Up to 3 MP
Shutter
Global
Lens mount
M12
$1,979.00View part

Configure the generic Ethernet module in the PLC

EtherNet/IP is cyclic: the reader republishes the whole input assembly every Requested Packet Interval whether anything changed or not. The configuration work is making both sides agree on the map.

  1. Set the reader to a static IP on the PLC subnet and ping it from the engineering PC. For the wider link plan — addressing, switching, timeouts — read the barcode reader PLC communication guide first.
  2. In the reader's set-up tool, open the industrial-protocol page and enable the EtherNet/IP connection, then save and power-cycle if the tool asks. The reader serves the assemblies only after this service is on.
  3. Add a generic Ethernet module to the PLC — some suites call it a generic EtherNet/IP adapter — and enter the reader's IP address.
  4. Type the three numbers: input assembly instance 11, size 24 elements; output assembly instance 21, size 4 elements; configuration instance 1. Where the dialog wants bytes, enter 48 in, 8 out, 0 configuration.
  5. Leave any status-header option unchecked. The published assembly is the whole payload; four header bytes would push the status word into element 3 and every character two words late.
  6. Set the RPI to 20 ms and leave the connection timeout at three intervals, 60 ms.
  7. Assign the tags: input INT[24], output INT[4], and the module status and extended-status tags. The status tags are the ones people skip and the ones that answer faults.
  8. Download and read the module status. Running means the reader accepted the connection and the array is live; anything else, read the extended-status code before touching ladder.

The handshake: trigger, acknowledge, read complete

The transport is automatic; valid data is not. Four rungs:

  1. Gate on the module running and trigger ready (element 1, bit 0) at 1.
  2. Set the trigger bit (output element 1, bit 0) and hold it at least one RPI — 20 ms at the setting above.
  3. Trigger acknowledge (input element 1, bit 1) answers 1; clear your trigger bit with a one-shot.
  4. Wait for the rising edge of read complete (element 1, bit 8). On that edge, copy elements 9 through 13 to your string buffer and decode.

Where the shot starts — PLC bit, photoeye into the reader, or the reader's own button — is a station decision; the trigger step of the vision system configurator lists the source options for a line build.

Decode the result: two characters per element

Worked example, code 1234567890. ASCII digits run 48 for 0 to 57 for 9, so 1 = 49 through 9 = 57 and 0 = 48:

Element Characters High byte first Low byte first
9 1 2 256 × 49 + 50 = 12594 256 × 50 + 49 = 12849
10 3 4 256 × 51 + 52 = 13108 13363
11 5 6 256 × 53 + 54 = 13622 13877
12 7 8 256 × 55 + 56 = 14136 14391
13 9 0 256 × 57 + 48 = 14640 256 × 48 + 57 = 12345

The last number is the trap: element 13 reading decimal 12345 is not the code leaking through, it is 9 and 0 packed low byte first. Decide the order once from element 9 — 12594 or 12849 — and map every element the same way.

Two ways to unpack:

  • Arithmetic per element: first character = (element AND 0xFF00) / 256, second = element AND 0x00FF.
  • Cleaner: copy the five elements into a ten-byte buffer and read one character per byte. The byte-order question disappears.

Validate before the string leaves the rung: length equals 10, digits only, and the no-read flag in the housekeeping elements clear. Judging how trustworthy a decode is is the same job over an assembly as over a socket. Once the tag holds a good string, routing it to robot job selection is a downstream rung, not a protocol problem.

Why the array reads all zeros

In order of probability:

  1. The connection is not online. The reader's EtherNet/IP service is off, or the PLC module never left the faulted state. Test: module status not running and an extended-status code present. Fix: enable the service in the reader tool and correct the instances.
  2. The open was refused. A wrong element count or instance fails at connect time, not at trigger time. Test: extended-status error as soon as you download. Fix: retype 11 with 24 and 21 with 4; in byte dialogs, 48 and 8.
  3. A status header shifted the map. Test: the status bits show up in element 3 instead of element 1. Fix: uncheck the header option.
  4. Right data, wrong window. Elements 2 to 8 read as zeros and the string sits at 9 through 13.
  5. No read has completed yet. Before the first trigger, zeros are honest.

The 24-element assembly carries 30 characters, and that is the ceiling of the format. Move off implicit messaging when:

When one wide shot must hold several labels at once, the MV-ID5120RM-08M-RBN brings a 12 MP sensor over GigE.

Fixed code readersHikrobot MV-ID5120RM-08M-RBN Industrial Code ReaderMV-ID5120RM-08M-RBN
Interface
GigE
Resolution
12 MP
Shutter
Rolling
Lens mount
M12
$1,969.00View part

Or take the decode off the reader entirely: a vision controller runs the cameras and hands the PLC one short string. The vision controllers class exists for that split, and the MV-VC3301H-128G66 runs a Core i3 processor with 8 GB of memory across five or more LAN ports.

Vision controllersHikrobot MV-VC3301H-128G66 I3-8100, 8GB+128G SSD, No PoE, PCIe expansion supported, Incl. VM6200Pro licenseMV-VC3301H-128G66
LAN ports
5+ LAN ports
USB 3 ports
3-4 USB 3 ports
Light outputs
4 built-in channels
Memory
8 GB
$2,419.00View partBuild a system with it

Checks before the first trigger

  • Reader industrial-protocol page: EtherNet/IP enabled and reporting online.
  • Module dialog: input instance 11 with 24 INT elements (48 bytes), output instance 21 with 4 INT elements (8 bytes), configuration instance 1, status header off, RPI 20 ms.
  • Status and extended-status tags assigned and on screen; they settle most faults in one look.
  • Handshake bits named as tags: trigger ready, trigger acknowledge, read complete, trigger bit.
  • Decode rung gated on the read-complete edge, null-trimmed, length-checked.
  • Element budget: code length plus any check characters at or under 30, or plan explicit messaging before commissioning.
  • One shielded Ethernet run per reader, code reader cables at the reader connector, straight RJ45 to the switch.

Both ends of the link:

The MV-IDA-PE-M12A17pF-openRJ45DB9-HF-5m runs 17-pin to RJ45 in a 5 m high-flex build for the reader end; the LS-CBL-0117 covers 15 m to the switch with a locking RJ45 stud.

If the station is still on paper, the code reader finder filters fixed code readers by interface and resolution, and the contact page puts an integration question in front of our applications team.

Questions

How many elements do I enter for the input and output assemblies?

Twenty-four 16-bit elements in on instance 11 and four out on instance 21; in a dialog that wants bytes, 48 and 8. The sizes must match the reader's published assembly exactly, because a wrong count is refused at connect time and the connection faults with an extended-status error. The configuration assembly is instance 1 with zero bytes.

Why does the PLC array stay at zero when the reader reads the code?

Because the connection is not online. Enable the EtherNet/IP service in the reader's set-up tool, then confirm the PLC module status reads running and the extended-status tag is clear. Only a running connection refreshes the array cyclically. Triggering with the button on the reader proves the decode works, not that the link is up.

How do I turn the integer elements back into ASCII characters?

Two ASCII characters ride in each element. Divide by 256 for one character and take the remainder for the other, or copy the elements into a byte buffer and read one character per byte, which removes the byte-order question. For the pair 1 and 2, 256 × 49 + 50 = 12594 when the first character is the high byte; 12849 means it is the low byte.

What RPI should I set for a barcode reader?

Set 20 ms. The cyclic exchange republishes a latched result, so a faster rate does not speed up decode — it only adds network load. Twenty milliseconds also gives the trigger handshake one clean interval per bit change, and the default three-interval timeout of 60 ms covers a slow scan.

How long a result fits in the implicit assembly?

Elements 9 through 23 are 15 elements of two characters each, so 30 characters is the limit. A 10-digit code uses five elements and leaves room for 20 more characters. Past 30, or with several codes in one image, use explicit messaging or a TCP socket and keep the implicit link for status and trigger bits only.