This tutorial explains how you can use a barcode reader with an RS232 interface with the hardware module type PD601 in VIGO6. Once you have set up the system, it can run without a PC. We expect that you know 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
- PD688 Display
- Ethernet cable for the IP connection
- A licensed VIGO5.9 editor
- VIGO6 editor
On Image 1 you can get an overview of how the system can be set:
Image 1: Overview of a sample system that uses a barcode reader with PD601.
None of the PROCES-DATA COPP modules for VIGO6 support RS232. On the other hand, PD601 supports RS232, but you program it with Process-Pascal in VIGO5.9. For that reason, you need two different software systems. In this sample system, we use VIGO5.9 to program the PD601 from a PC. Be sure to use the latest firmware version for PD601. You need to adjust the PD601 to be compatible with the VIGO6 project. Important details are node addresses as well as the number of masters that VIGO6 sees. The Process-Pascal code must program the PD601 RS232 port to make it work with the barcode reader.
In the VIGO6 system, you can use a PC with a COPP PC with display or a PD688. How you use a PD688 as a downloader for your project is beyond the scope of this tutorial.The PD688 can talk with a COPP gateway like PD610, which again talks with PD601 through light-link.
You can't power the barcode reader from RS232, and thus you need a special cable that also has a connection to an external power supply. You can see an example in Image 2.
Image 2: A DB9 RS232 cable with external power supply for the barcode reader.
In Image 3 below, we have made a prototype adapter for the DB9 connector.All nine pins are used, but it may not be needed in all cases.
Image 3: DB9 RS232 connector prototype where we have connected all the pins to PD601.
We made the adapter with help from the RS232 Pinout in Image 4:
Image 5: Pinout for PD601 from the official datasheet.
In the current sample system, we use a Datalogic Gryphon GD4130. It comes with a default RS232 setting that only uses the hardware handshake RTS. In that case, we only need the pins 2 RXD, 5 GND, and 7 RTS. Therefore, we have bolded them in the following table. The connection from PD601 to the barcode reader is 1:1 and is therefore straightforward:
See the manual here, where the front page is in Portuguese, but the content is in English:
There is a detailed explanation in the manual of how to set up the barcode reader in the chapter Configuration using barcodes. We followed, the suggestions on how to set up the barcode reader, and we chose the default RS232 setting without alterations. The setting values are as follow:
Baudrate = 9600
8 data bits
1 stop bit
Parity = none
Handshaking control = RTS
We prefer 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:
We configured the port from VIGO5.9 and Process-Pascal:
Representing PD601 in VIGO6
When you have set up the PD601 to match the RS232 protocol for the barcode reader, you have to represent the module in the VIGO6 system. For that purpose, we created a NON-COPP device. PD601 - GUID: PD_22880-0. PD601 is a NON-COPP device that represents the hardware module PD601. The module has several channels, but we only used Channel 0 - Service and Channel 1 - RS232Port. You can see the device in Image 6:
Image 7: A sample control component for a barcode reader.
There is a connection to the NON-COPP PD601. We located the input register in the PD601 and noted its type. We used the same type to create a variable in the control component that is applied in the control logic, having the name “InputBuffer_data”.
The timermethod has the name “Reading_rx” in the init function.
The Timermethod has an override:
One thing to note is that when the InputBuffer is read, the PD601 removes the read element from the buffer. The system therefore stores the read value is in a temporary local variable, that we use to assign the InputBuffer_data variable.
We can use the InputBuffer variable from the control component in a simple visualization. As an example, you can see Image 8, where we have scanned a barcode: