Connecting a USB Barcode Reader
You can connect a USB barcode reader
to the display unit and input data into variables or objects.
This section describes the setup procedure and how to use a USB barcode
reader.
Available USB Barcode Readers
You can use an HID class USB barcode reader.
Only one USB barcode reader can be connected at any time.
Supported keyboard layouts are English keyboard 101 and Japanese keyboard
106.
Data Input Destination
You can set up the following destinations for data entered from a USB
barcode reader.
Select the destination with the USB barcode reader's [Save Data in]
property.
Destination |
Comments |
Object |
You can use the USB barcode reader to enter data in the following
objects:
- Object that can display a keypad
- Web Browser parts
|
Variable |
You can input data to an internal STRING variable. |
When The Data Input Destination Is Object
Settings
- In the Project Explorer window, go to [System
Architecture] and click [Accessories].
- On the toolbar, click [USB Barcode Reader].
- In the Property window, from the [Save Data
in] property select [Objects].
- In the [Key Code] property select the keyboard
layout.
You can suppress the display of a keypad during input by disabling
the object's [Use Keypad] property. By referencing a property in the
[Use Keypad] property, you can design a function that shows or hides
the keypad in the middle of an operation.
Data Input with USB Barcode Reader
- Before reading in data with a USB barcode reader,
touch the object to change to its input state so that it can act as
the destination of the input data.
If data is read before the input state is set, data will not be input
anywhere.
- Read data with the USB barcode reader.
Read data is not complete until a control character ('CR' or 'CR'+'LF')
is read. The read data is immediately input to the object.
If there is a character that cannot be input, the input
of that character is skipped.
If more data is read than the object's input range,
no data is input. In this case, the buzzer sounds and the
object color is changed.
If you input any characters on the keypad and then read
the data with the USB barcode reader, the read data will be
input following the characters displayed on the keypad.
- When data input is complete, the object's input
state is terminated. When the keypad is displayed and data input is
completed, the keypad will automatically close.
When The Data Input Destination Is Variable
Settings
- In the Project Explorer window, go to [System
Architecture] and click [Accessories].
- On the toolbar, click [USB Barcode Reader].
- In the Property window, from the [Save Data
in] property select [Variable].
- In the [Scanned String] property, set an internal
STRING variable to act as the destination of input data.
You cannot set an external variable in the [Scanned String] property.
- If you want to count how many characters are
in the read data, set an internal integer variable in the [Scanned
String (bytes)] property.
You cannot set an external variable in the [Scanned String (bytes)]
property.
- In the [Key Code] property select the keyboard
layout.
Data Input with USB Barcode Reader
- Read the data with a USB barcode reader.
Read data is not complete until a control character ('CR' or 'CR'+'LF')
is read.
- The read data is input to the STRING variable
set in the [Scanned String] property. Additionally, the number of
characters in the read data is stored in the integer variable set
in the [Scanned String (bytes)] property.
- When data input is complete, the value of the
following Target source property is set ON.
(Target Name).Preferences.InputCompletedFromUSBBarcodeReader
After the value of the source property is set ON, manually turn it
back to OFF so you can confirm completion of the next input. The value
in this property does NOT turn back OFF automatically.
If the number of characters in the read data exceeds the number
of bytes that can be input to the [Scanned Strings] STRING variable,
the excess characters are dropped.
Read Data |
Number of bytes that can be input to the STRING variable |
Value of [Scanned String (bytes)] integer variable*1 |
Characters input to the STRING variable |
Comments |
ABC |
5 |
3 |
ABC |
|
ABCDEFG |
5 |
7 |
ABCDE |
Characters that exceed the input range are not input. |
AB(0x00)CDEF |
6 |
6 |
ABCDEF |
'NULL(0x00)' is skipped.
'NULL(0x00)' is not supported. |
*1 When setting up the bar code reader, use a variable to specify
the number of bytes to read.
Supported Characters
The following characters are supported when reading data with a USB
barcode reader.
If there are unsupported characters in the read data, those characters
are skipped and not read.
- Alphanumeric Characters
- Space (Blank)
- Special Characters
Special Characters |
! |
) |
; |
] |
" |
* |
< |
^ |
# |
+ |
= |
_ |
$ |
, |
> |
` (grave accent) |
% |
- |
? |
{ |
& |
. |
@ |
| |
' (apostrophe) |
/ |
[ |
} |
( |
: |
\ |
~ |
- Control Characters
- 'CR'
The 'CR' control character indicates complete of data input.
Notes on Using USB Barcode Reader
When Using SP5000 Series Open
Box (Windows 10 IoT Enterprise Model), IPC Series, or PC/AT
- When the data input destination is set to a variable,
disable IME with the system keyboard before reading data with a USB
barcode reader. Data input cannot be completed with IME enabled.
- Do not use a USB barcode reader to read TAB control
characters when the data input destination is set to object. If you
read the TAB control character, you will not be able to complete data
input. If you accidentally read the TAB control character, manually
touch the object. It will return to the same state as before any data
was input.
- Even if a USB barcode reader is not configured, if
an object is set to its input state and data is read using a USB barcode
reader, the read data will be input to the object.