bg

Redirect COM port data to another COM port after transformation

Download a Free Trial Version.It allows you to try all features! Data logger plugins can be downloaded separately.

Task

I need to capture scale data from COM1, transform it, and redirect it to COM2.

How to

1. Delete all existing configurations: Main menu → Options → Manage Configurations → Delete All

2. Create a new configuration using the "Green Plus" button in the main window (fig. 1). This configuration will receive scale data from COM1 (incoming data).

Main window. Plus button
Fig.1. "Green Plus" button

3. Specify the COM1 settings. Set the communication parameters according to the scale settings.

COM port settings
Fig.2. COM port settings

4. Configure the ASCII data parser to extract tare, gross, and weight values (fig. 3-5). The parser works with incoming data. Therefore, you should select the "Parsing and exporting for received data" option on fig. 3.

The filter modules (Expressions and Data redirecting) are also required and will be used in the next steps. Please pay your attention to the plugins order in the list. The "Expressions" plugin should be above the "Data Redirecting" plugin. Use "Up/Down" buttons to place filter plugins in the necessary order.

Module selection
Fig.3. Module selection

We assume that you have configured your scale to add the CR character at the end of a data packet. If you use some other character, you need to specify its code in the "Data packets end with" field.

Parser settings
Fig.4. Parser settings

We have added three parser items for each weight value. We assume that you have configured the scale to send data values as 0.0;0.0;0.0 (three values in a row delimited by a semicolon).

Parser items
Fig.5. Parser items

5. Enable and configure the Expressions module. This module will build a new data packet redirected to COM2 (fig. 6). In this example, we have changed the order of items in a data packet and added the new prefix "New data packet: ". CHR(13) at the end of the expression means that the CR character will be added to the end of the new data packet.

Building a new data packet
Fig.6. Building a new data packet

6. Enable and configure the Data redirecting module. This module will redirect the prepared data packet to COM2 (fig. 7). Please note that the parser item name should match the name that you defined in the Expressions module.

Redirecting data
Fig.7. Redirecting data

7. Configure data export to Excel. We assume that you have configured the scale to send data values as 0.0;0.0;0.0 (three values in a row delimited by a semicolon). The data format is compatible with the CSV format that can be easily opened in Excel. Here you need to configure the log file (fig. 8).

Log files
Fig.8. Log files

8. Create a new configuration using the "Plus" button in the main window (fig. 1). This configuration will receive scale data from COM2 (for transformed outgoing data). Specify the necessary COM port settings. All other settings you should be left unchanged.

Now you can test your configuration. Try to receive data from your scale. If your settings are correct, you will see outgoing data in the COM2 window (fig. 9). You can see the corresponding message at the bottom of the main window.

Redirected data
Fig.9. Redirected data

Ready-to-use configuration that you can restore from the "File" menu you can download here.

Related articles: Redirect COM port data to another COM port after transformation

Copyright © 1999 - 2024, AGG Software.
All rights reserved. Terms of use | Privacy policy