← Strings and Text

Scanner Bytes to Text

medium

Turns the bytes a barcode scanner sends into a STRING without its carriage return.

What it teaches

Serial and network devices often deliver text as an array of SINTs, one character each, plus a count. A STRING tag starts with its LEN, so copying the bytes into the tag itself turns the first four characters into the length. The bytes belong in DATA, the characters after LEN from Display New Text, and writing DATA never changes LEN, so the length is yours to set: a count of 2 makes 'HI', whatever bytes follow. Then drop the final $r as the reply's was dropped in Strip the Terminator; a code without one, such as 'XYZ', is kept whole.

Parameters

TagDirectionTypeDefaultDescription
In_CountInputDINT4How many bytes arrived, 0 to 40
Ref_BufferInOutSINT[40]—The bytes as the scanner sent them, one character each
Ref_CodeInOutSTRING—The code as text

Required behavior