How can a barcode scanner be connected?
General
In this example, a portable barcode scanner with a serial RS232 interface is connected to the LAN2 of the variTRON500 via the EX-6030 module.

Module EX-6030
The EX-6030 are Plug-and-Play high-speed Ethernet-to-Serial modules. They provide a 9-pin serial connection for serial devices (e.g. modem, plotter, scanner, etc.). The RS-232 connection is integrated into the system via the supplied software or can be addressed directly via a TCP/IP controller.
A web browser can be used to connect to the EX-6030 via the default IP 192.168.1.254 and settings can be made as shown in the image. In order to establish a connection with the module, the TCP/IP interface on the PC/laptop must be changed from DHCP to a fixed IP address. Instructions can be found at here.
Once you have established a connection to the module, the socket port of serial I/O must be set to 100 TCP Server. With Update, the change is saved and the module rebooted.

Web Cockpit
The LAN2 is now adjusted in the Web Cockpit.
The Method is changed from Automatic to Manual. The IP address and subnet mask are then changed to match the settings of the EX-6030 module.

CODESYS
In order to connect the barcode scanner to CODESYS, the Net Base Services and SysMem libraries are required. These can be added via Add Library.

The following example can be imported into your own project with Project → Import….
After importing, the folder :No1: Scanner appears on the left in the device view. An instance of the FB_Scanner can now be created in the :No2: program header in your own program and then called in the :No3: program section.
The IP address and the socket port number of the EX-6030 can now be transferred to the FB instance. This has already been set here on EX-6030.

Graphic view of the FB_Scanner with inputs and outputs:

If you still want to use the visualisation in the demo, a freely available ProcessImage 1 to 10 can be replaced by ProcessImage00. (Only for Visu-Template. ProcessImage00 can of course be opened in other ways.)

If the project is transferred to the system and the corresponding process screen is opened, the result is displayed for each valid scan and the value behind Number of Scan is increased by one.

If the barcode scanner does not communicate with CODESYS, you should first press the Reset and Connect buttons in the process screen example. Disconnecting from the power supply could also solve the problem.
Testing the barcode with CODE-128
If you would like to create individual barcodes, this is possible on the following homepage: https://barcode.tec-it.com/en/Code128 Here, for example, a barcode of type CODE-128 can be created.
