Interfacing 2D Barcode / QR Code Scanners to Pro-face GP4000 HMIs via RS-232C and D-Script
1. Data Acquisition Architecture on Pro-face HMIs
In industrial traceability workflows, operators scan barcode/2D DataMatrix tickets to retrieve recipes and dispatch production runs to PLCs. Pro-face GP4000 HMIs support barcode scanners via two methods: 1. USB Host (HID Keyboard Emulation): Emulates standard keystrokes, but requires active GUI focus on an input field; switching screens loses scans. 2. Serial RS-232C via Extended SIO Driver (Recommended): The scanner stream pipes directly into background FIFO receive buffers. D-Script parses string terminations (CR/LF) and loads data words directly into PLC memory independent of active display screens.
2. RS-232C Serial Cable Pinout (D-Sub 9 Pin)
| Pro-face COM1 Pin (Female D-Sub 9) | Signal | Barcode Scanner Pin (Male D-Sub 9) | Description |
|---|---|---|---|
| Pin 2 | RD (RXD) | Pin 2 (TXD) | Receives raw serial barcode character stream |
| Pin 3 | SD (TXD) | Pin 3 (RXD) | Transmits scanner control strings (e.g. software trigger) |
| Pin 5 | SG (GND) | Pin 5 (GND) | Common signal reference ground |
| Pin 7 & 8 | RTS / CTS | Loopback bridged together | Bypasses hardware handshaking for scanners lacking flow control |
3. Driver Configuration in GP-Pro EX
- In GP-Pro EX, navigate to Project Settings -> System Settings -> Device/PLC.
- Add a secondary device driver, setting Manufacturer to General Purpose Drivers and Series to Extended SIO Driver.
- Open Communication Settings: Set Baud Rate = 9600 bps (or match scanner baud), Data Length = 8 bit, Parity = None, Stop Bit = 1 bit, Flow Control = None.
- Configure the Delimiter character to CR (0x0D) or CR+LF (0x0D 0x0A) matching the scanner configuration.
4. D-Script Implementation for Direct PLC Data Transfer
// D-Script Trigger: Cyclic (100ms) or bit-triggered
// Check receive buffer ready flag from Extended SIO Driver
if ([s:EXT_SIO_RECV_STATUS] == 1)
{
// 1. Evaluate received byte length
[t:0000] = [s:EXT_SIO_RECV_LEN]
if ([t:0000] > 0)
{
// 2. Clear target PLC destination registers (e.g. D1000 to D1015)
_memzero([#INTERNAL]USR_D1000, 32)
// 3. Move ASCII string payload from Serial Buffer into PLC Data Register
_strncat([#INTERNAL]USR_D1000, [s:EXT_SIO_DATA], [t:0000])
// 4. Assert handshake trigger bit to alert PLC ladder logic (PLC Bit: M500)
[#PLC]M0500 = 1
// 5. Flush and acknowledge receive buffer
[s:EXT_SIO_RECV_CLEAR] = 1
}
}Barcode Scanner Suffix Configuration
Industrial scanners (Keyence, Zebra, Cognex) often default to transmitting raw string data without terminators. Requirement: Scan the programming barcode from the manufacturer manual to enable a trailing CR (Carriage Return) character, ensuring the Extended SIO driver accurately latches buffer frame ends.