Code readingHow-to

Barcode scanner tab then enter suffixes: alternate scan actions

A keyboard-wedge barcode scanner cannot count scans, so its suffix cannot alternate tab then enter. Split the symbologies, or route the keys in software.

LumaSpec Vision10 min read Share on LinkedIn

On this page 9 sections
  1. 01The scanner has no scan counter
  2. 02The two routes that work
  3. 03What you need
  4. 04Worked example: lot label ends in Tab, station label ends in Enter
  5. 05Program the suffixes, then test in order
  6. 06When both labels share one symbology
  7. 07Checks before the station goes live
  8. 08Hardware for a new two-field station
  9. 09Questions

You want the first scan to end with a Tab and the second with an Enter: two fields on a form, two scans, no keyboard. A keyboard-wedge barcode scanner cannot do that on its own, because it has no idea which scan it is on. This guide gives you the two setups that do work — one symbology per field with a symbology-specific suffix, or host-side routing in your own program — plus the programming steps, a worked keystroke example, the out-of-order failure you must plan for, and the checks to run before the station goes live.

The scanner has no scan counter

A keyboard-wedge scanner is a keyboard to the host: it decodes the label, then types the data followed by the suffix it was programmed with. Which suffix that is comes from stored programming — a global suffix applied to every scan, a per-symbology suffix applied to one symbology, or, on readers with a data-format editor, rules keyed on symbology, data length or a leading-character match. None of those inputs is a scan counter.

So tab after the first scan, enter after the second is not expressible in the scanner alone. The scanner sees two decodes; unless the labels differ in something it can read — symbology, length, leading characters — it sends the same terminator both times. That leaves two workable routes: make the two labels different symbologies so the per-symbology suffixes differ, or move the field switching into the program that receives the keystrokes.

If you have not programmed a suffix before, prefix and suffix framing for barcode scanner input covers the mechanics, and making a scanner send a function key before the data shows how a single key gets attached to a scan.

The two routes that work

Route Needs Best when Main risk
Symbology split Labels you print, in two symbologies; scanner with per-symbology suffix programming Two fixed fields, scan order known Out-of-order scans swap the values
Host-side routing A program or HMI script that listens for scans Labels share one symbology, or order must be enforced You own the routing code

The symbology split needs no code and runs on any scanner that exposes per-symbology suffix programming. Host-side routing removes the order problem entirely because the program decides where each scan goes; the two barcode scans into separate HMI data entry fields walkthrough is that route in practice. The rest of this guide builds the symbology split, then shows the point where you would switch to the software route.

What you need

  • The scanner's programming manual or the vendor's setup utility. Per-symbology suffix programming is the feature this rides on; if the manual shows only one global suffix setting, the scanner cannot do the split and you are in the software route.
  • Two test labels: the first field's data printed in Code 128, the second field's in Code 39.
  • The form, with its Tab order checked: field 2 must follow field 1. The keyboard wedge readers and focus in your HMI guide explains how wedge input and focus interact.
  • A plain text editor for the keystroke test, before you touch the real form.

If the scanner is not connected yet, the USB barcode scanner as a keyboard wedge into your HMI walkthrough takes you from unboxing to first scan.

Worked example: lot label ends in Tab, station label ends in Enter

The inputs, and where each comes from:

  • The task: two fields on one form; scan 1 must terminate with Tab, scan 2 with Enter. That is the requirement this whole setup exists to meet.
  • Field 1 label: Code 128, data LOT-4512-A — 10 characters; Code 128 carries digits, uppercase letters and the hyphen natively.
  • Field 2 label: Code 39, data STN-07 — 6 characters; standard Code 39 carries digits, uppercase letters and the hyphen.
  • Terminators: Tab is ASCII 0x09, sent on the USB wire as HID keyboard usage 0x2B; Enter is the carriage return, ASCII 0x0D, HID usage 0x28. The host delivers them exactly like your keyboard's Tab and Enter.

The rule, in words: the scanner types the decoded characters and then the suffix programmed for that label's symbology, and the form's focus follows its Tab order.

keystrokes per scan = decoded characters + suffix characters

The arithmetic:

  • Scan 1: LOT-4512-A is 10 characters, the Tab suffix is 1, so the scanner sends 10 + 1 = 11 keystrokes. The 10 characters land in field 1; the Tab moves focus to field 2.
  • Scan 2: STN-07 is 6 characters, the Enter suffix is 1, so 6 + 1 = 7 keystrokes. The 6 characters land in field 2; the carriage return commits the form.
  • Whole transaction: 11 + 7 = 18 keystrokes, none typed by hand.

Decision: two different symbologies plus per-symbology suffix support, and the wedge route does the whole job. If both labels print in one symbology, this setup cannot be built — use the software route further down.

The out-of-order case is worth the same arithmetic. Reverse the order and the shapes stay identical: STN-07 (6 + 1 = 7 keystrokes) types into field 1 and tabs forward, then LOT-4512-A (10 + 1 = 11) fills field 2 and commits. The values swap rather than disappear, which is why the checks section puts input masks on both fields.

Program the suffixes, then test in order

  1. Print the two test labels and scan each into a plain text editor. You should see data only; nothing is programmed yet.
  2. In the programming manual or setup utility, find the suffix setting that belongs to each symbology — the per-symbology suffix option, not the global suffix. Setup is normally a matter of scanning programming barcodes or picking the value in the utility.
  3. Set the Code 128 suffix to Tab. If the tool wants the value as a number, Tab is ASCII 9 (0x09).
  4. Set the Code 39 suffix to Enter, the carriage return, ASCII 13 (0x0D). How HMI fields treat CR and LF pairs is its own subject; CR and LF characters in an HMI text field covers it.
  5. Turn the global suffix off, or set it to none. A global terminator stacked on the symbology suffixes fires two keys per scan.
  6. Rescan both labels into the text editor. The lot data should be followed by a tab gap, and the station data should end the line — the editor shows both terminators plainly.
  7. Scan into the real form: lot first, station second. Both fields fill and the form commits. Then reverse the order once, on purpose, and watch the values swap — that is the behavior your guards have to catch.

Suffix values are the same whatever the reader; the barcode scanner suffix setup for HMI text entry walkthrough shows the characters landing in an HMI text field, step by step.

When both labels share one symbology

The split needs two symbologies. Supplier-labeled goods, GS1 formats or a customer mandate often pin every label to one symbology — then no scanner setting can help, because the scans arrive indistinguishable. The fix moves to the host:

Decision rule: one symbology at the scanner means host routing at the host — there is no third option in between.

Checks before the station goes live

Decode settings:

  • Only Code 128 and Code 39 enabled; everything else disabled, so a stray label cannot decode into a field.
  • Code 39 options matched to the print: no check character unless one was printed, full ASCII off unless used.

Suffix configuration:

  • The text-editor test shows the tab gap after the lot data and the line break after the station data.
  • A configuration readback shows the global suffix set to none.

Form and people:

  • Tab order confirmed: field 2 follows field 1.
  • Input masks reject STN- data in the lot field and LOT- data in the station field.
  • One-line card at the station: Scan lot label, then station label.
  • The reversed-order rehearsal has been run once, and whoever supports the station knows the outcome is a swap, not a lockup.

Hardware for a new two-field station

If you are specifying hardware instead of reprogramming an existing scanner, start from the handheld code readers category. The capability list for this build is short: USB keyboard output, per-symbology suffix programming, and decode support for both label symbologies.

Code readers & vision sensorsHandheld code readers

Handheld 1D/2D scanners

137 models · from $159.00

The two wired USB readers below are where that category starts.

Handheld code readersHikrobot MV-IDH2000P/13NR/05RN/U Industial Wired Handheld Code ReaderMV-IDH2000P/13NR/05RN/U
Interface
USB
Connection
Wired
$179.00View part
Handheld code readersHikrobot MV-IDH5000P/13SR/04RN/U General-purpose wired industrial handheld code readerMV-IDH5000P/13SR/04RN/U
Interface
USB
Connection
Wired
$719.00View part

When the fields live on a PLC or the results go to a database rather than a form, cross-shop the Fast Ethernet models in the same category with the camera and code reader finder and let the host own the routing. To price a complete station, the configurator walks the reader-to-host choices step by step, and specification questions go through the contact page. More on getting scans into applications sits on the code reading topic page.

Questions

Can a barcode scanner count scans and switch suffixes on its own?

No. A wedge scanner picks its suffix from stored programming: a global suffix, a per-symbology suffix, or data-format rules keyed on symbology, data length or a prefix match. Nothing in that list is a scan counter, so tab on the first scan and enter on the second cannot be expressed in the scanner alone. Give the two labels different symbologies, or route the scans in your own program.

What values are the Tab and Enter suffixes?

Tab is ASCII 9, hexadecimal 0x09; Enter is the carriage return, ASCII 13, hexadecimal 0x0D. On the USB wire the keystrokes travel as HID keyboard usages 0x2B for Tab and 0x28 for Enter, but you never handle those directly: the operating system turns them into the same Tab and Enter your keyboard sends, so the ASCII values are what suffix setup screens and application filters see.

What happens if the operator scans the second label first?

The keystroke stream keeps its shape, so the values land swapped: the station code types into the lot field and tabs forward, then the lot code fills the station field and commits. Guard with input masks that reject the wrong format in each field, and enable only the two symbologies the station uses so a stray label cannot decode at all.

Can I do this without code when both labels are Code 128?

No. One symbology gives the scanner nothing to tell the scans apart, so one suffix applies to both. The fix moves to the host: a listener that routes by data pattern, since the lot and station formats differ, then sets focus or commits. A short prefix built into the labels serves the same purpose if you can reprint them.

Do serial or Ethernet scanners solve this differently?

Yes, because they never send keystrokes. Each scan arrives as a data message on the port, so there is no Tab order to manage: your program parses the message, decides which field or tag receives it, and appends whatever terminator the protocol needs. That removes the out-of-order swap problem entirely, at the cost of writing the small receive routine.