Redirecting COM port data to anoter COM port after transformation. Tutorial.
I need to capture scale data from COM1, transform it and redirect to COM2.
1. Delete all existing configurations: Main menu - Options – Manage Configurations – Delete All
2. Create a new configuration using the “Plus” button in the main window (fig. 1). This configuration will receive scale data from COM1.
3. Specify the COM1 settings. Set the communication parameters according to the scale settings.
4. Configure the ASCII data parser to extract tare, gross and weight values (fig. 3-5). The filter modules (Expressions and Data redirecting) are also required and will be used in the next steps.
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.
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).
5. Enable and configure the Expressions module. This module will build a new data packet that will be 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.
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.
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 just need to configure the log file (fig. 8).
8. Create a new configuration using the “Plus” button in the main window (fig. 1). This configuration will receive scale data from COM2. 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.
Ready-to-use configuration that you can restore from the "File" menu you can download here.