Barcode Scanner (Serial)

This driver allows communication with a barcode scanner via RS-232C. The barcode scanner driver is distinct from other standard drivers, as it does not support reading and writing to database tags. This driver receives the characters sent from a barcode scanner and converts them to keyboard input. Because of this, from the Xpanel kernel’s point of view, the barcode scanner acts as a standard keyboard. To utilize data from the barcode scanner, a ‘keyboard input window’ object must be used on the graphic page.

Communication Setup: Barcode Scanner

Follow the manual provided by the barcode scanner vendor.

Ensure the following conditions are met during the barcode scanner setup:

  • ‘Enter’ (0Dh) or another special code must be added at the end of data transmission.

  • Prepare the communication parameters based on the vendor’s documentation (Baud rate, Parity, Stop Bit, Data Bits, Stop Bit). Make sure settings match between the scanner and Xpanel.

Communication Setup: Xpanel

Create a new device

To create a new device, select [Tool] → [I/O Devices] or click the icon in the main toolbar. The following picture shows the first step of creating a new device:

I/O Device: Assign a device name. This name will be used in the tag configuration window of the database, accompanied by the ‘Station Name’.

Select a device type

After selecting the [OK] button in the previous step, select the 'Barcode Scanner' as the device type. The ‘Serial Communication Configuration’ dialog box will appear as shown in the following picture. Select ‘Barcode Scanner’ as the device type.

Keep the following default settings for serial communication. Ensure that the scanner matches these settings.

Device Type: Barcode Scanner

Comm. Port: COM1

Baud Rate: 9,600 bps

Parity: None

Data Bits: 8 Bits

Stop Bit(s): 1 Bit

RTS/CST: OFF

Comm.Type: RS-232

Retry No: 3

Time Out: 30

See the Communication Configuration section for more information about the remaining parameters.

Create a station

Move to the [Station] tab of the ‘Serial Communication Configuration’ dialog box. In this dialog box, all connected PLC stations can be configured and registered to the Xpanel.

Each field can be configured with the following rules:           

Station Name: Give a name to the barcode scanner.

Station Type: Choose ‘BarCode’ (no other type can be selected).

Station No: Choose 0 for this field.

See the Communication Configuration section for more information about the remaining parameters.

‘Key Input Window’ Object: XpanelDesigner (Graphic Page)

The ‘Key Input Window' object displays any input characters (via a barcode scanner or keyboard) to the screen and executes the assigned command when the predefined terminating code is detected. To create a ‘Key Input Window’ object, select [Draw] → [Key Input Window] or click on the icon, then click an empty space on the page. A configuration window will appear as shown below:

Configure the 'Key Input Window' object as desired. For more information about each menu option, see the Key Input Window section.

The Xpanel will only register data from the barcode scanner when a 'Key Input Window' is open on the active page. Be sure to accommodate for this when designing your project.

Communication Cable Wiring

RS-232-C

The above picture shows only the RS-232-C port of Xpanel. This is the standard DB9 RS-232-C pin assignment.

Typically RD and SG pins are enough to communicate with a general barcode scanner. Refer to the manual of your barcode scanner for signal descriptions.