Barcode reader RS232 with PD601 via VIGO5.9

All files required to perform this tutorial, including the tutorial itself, are included in one single compressed file for you to download:

Introduction

This tutorial explains how to use a barcode reader with a RS232 interface with the hardware module type PD601 in VIGO6. Once the system has been configured, it can run without a PC in operation. Assumingly the reader knows how to use VIGO5.9 as well as VIGO6.

You will need:

  • Barcode reader with RS232 interface
  • Power supply for your DIN-rail
  • PD601 + BM011
  • DB9 RS232 cable + power supply for barcode reader
  • Adapter from DB9 to the terminals on BM011
  • PD610 + BM020
  • PD661 + BM012
  • PD3950
  • PD688 Display
  • Ethernet cable for the IP connection
  • A licensed VIGO5.9 editor
  • VIGO6 editor

System architecture

On Image 1 an overview of how the system can be set up is illustrated:

Image 1: Overview of a sample system using a barcode reader with PD601.

None of the PROCES-DATA COPP modules working with VIGO6 support RS232. You can program PD601 with Process-Pascal in VIGO5.9, and the module supports RS232. For that reason, two different software systems are needed. In this sample system, VIGO5.9 is used to program the PD601 from a PC. Be sure to use the latest firmware version for PD601. The PD601 should be configured to be compatible with the VIGO6 project. Important details are node addresses as well as number of masters seen from VIGO. The Process-Pascal code must automatically configure the PD601 RS232 port to make it work with the barcode reader.

In the VIGO6 system, a PC equipped with a COPP PC or a PD688 Display can be used. How to use a PD688 as a downloader for your project is beyond the scope of this tutorial. The PD688 can communicate with a COPP gateway like PD610, which again communicates with PD601 through light-link.

Getting started

The barcode reader cannot be powered from RS232, and thus a special cable that allows connection to an external power supply is required. Refer to Image 2.

Image 2: A DB9 RS232 cable with external power supply connected for the barcode reader

In the Image 3 below, a prototype adapter for the DB9 connecter has been made. As illustrated, all nine pins are used, which however may not be necessary in all applications.

Datalink Barcode reader RS232 with PD601_files_image003

Image 3: DB9 RS232 connector prototype with its entire pins connected to PD601.

The adapter was made by using the RS232 Pinout in Image 4:

Image 4: Pinout for DB9 RS232 connector

 

PD601 has the following pinout:

Image 5: Pinout for PD601 from the official datasheet

In the current sample system, a Datalogic Gryphon GD4130[1] has been used. It comes with a default RS232 setting, which only uses the hardware handshake RTS. In that case, only the pins 2 RXD, 5 GND and 7 RTS are needed, as marked in bold in the following table. The connection from PD601 to the barcode reader is 1:1 and is therefore straightforward:

[1] See the manual here, in which the front page is in Portuguese, but the contents is in English:

https://www.bztech.com.br/arquivos/manual-datalogic-gd4130.pdf

There is a detailed explanation in the manual of how to set up the barcode reader in the chapter Configuration using barcodes. The suggestions of how to set up the barcode reader were followed, and the default RS232 setting without alterations was chosen. The setting values are as follow:

Baudrate = 9600

8 data bits

1 stop bit

Parity = none

Handshaking control = RTS

It is recommendable to use the same settings for the RS232 port of the PD601. For complete information about the RS232 port on PD601, refer to detailed information on our website:

https://www.proces-data.com/product/pd-601-dpi-with-rs-232-interface/

The port was configured by means of VIGO5.9 and Process-Pascal:

The InputBuffer must be initialized. DataModeIn has been chosen, since the OutputBuffer is not used.

The modules PD661 Simple P-NET Interface and PD3950 USB to P-NET Interface can be used for download of program to PD601, as well as to get an overview of the various channels and their registers.

Representing PD601 in VIGO6

When the PD601 has been set up to match the RS232 protocol intended for the barcode reader, the module has to be represented in the VIGO6 system. For that purpose, a NON COPP device has been created. PD601 - GUID: PD_22880-0. PD601 is a NON COPP device that represents the hardware module PD601. The module has several channels, but only Channel 0 - Service and Channel 1 - RS232Port have been implemented at the time of concluding this documentation. The device is illustrated in Image 6:

Datalink Barcode reader RS232 with PD601_files_image007

Image 6: PD601 NON COPP device in VIGO6

A control component for your barcode scanner can be created. In this sample project, a simple system as illustrated in Image 7 was made:

Image 7: A sample control component for a barcode reader.

There is a connection to the NON COPP PD601. In the PD601, the input register was located and its type noted. The same type was used to create a variable in the control component, which is applied in the control logic, having the name “InputBuffer_data”.

The timermethod is called “Reading_rx” in the init function.

The Timermethod includes an override that looks like:

One thing to note is that when the InputBuffer is read, the PD601 removes the read element from the buffer. The read value is therefore stored in a temporary local variable used to assign the InputBuffer_data variable.

The InputBuffer variable from the control component can be used in a simple visualization. As an example, a visualization is illustrated in Image 8, in which a barcode has been scanned:

Image 8: A sample visualization using the data from the InputBuffer.