Barcode data logger. Capture a barcode data from a serial port. Advanced Serial Data Logger tutorial.

Task:

We are receiving barcodes (EAN-13) from a serial port. We have some barcode scanners connected, each one send data, when read. The data contains: its identification number (the first character) and barcode information (thirteen digits). When the Advanced Serial Data Logger receives the information from the serial port, he adds a date and time stamp. In a log file this information is registered correctly, but we should create other ASCII file with different structure in the CSV format.

Barcode data view

Fig.1. Barcode scanner data captured by the serial data logger software

Requirements:

  • Advanced Serial Data Logger (ASDL) Professional or a trial version;
  • ASCII data parser and query plug-in for the data logger;
  • DDE server plug-in for the data logger (optional);
  • Local database plug-in for Advanced Serial Data Logger.

It is assumed that:

You've configured communication parameters (baud rate, number of data bits, flow control etc) in the data logger and can receive any data without communication errors.

Solution:

The figure above shows that the data flow is very simple. Each record has a fixed size and a fixed position of each item. We need to recognize ending characters of an each data record. Please, enable display output for non-printable characters with a character code below than 0x20h. Please, set the following options.

Barcode data view setup

Fig.2. Data view setup

Then click the "OK" button and try to receive data from a port. You should receive the data like on the figure below.

Barcode scanner data with an ending character

Fig.3. Barcode scanner data logger. Data received.

This is another view of the received data. All non-printable characters were replaced with their code like #0D. Now, it is clear, that a data packet (in a green rectangle) ends with #0D (underlined by red).

Now, we are ready for configuring modules. First, please, select the "ASCII data parser and query" plug-in (fig.4a, pos.1) from a drop-down list. Then, enable a parsing option for data received (fig. 4a, pos. 2) and select necessary data export plug-ins. The DDE server (fig.4b, pos.3) will help us to check that the data packet is parsed and exported. The "Local database" plug-in will write data to an ASCII file with the CSV format.

Barcode scanner data logger. Plugins setup

Pic.4a. Barcode scanner data logger. The data parser plug-in.

Barcode scanner data logger. Data export plugins

Pic.4b. Barcode scanner data logger. Data export plug-ins.

Now, please, open a configuration window of the ASCII parser and query plug-in (click the "Setup" button near a drop-down box fig.4a, pos.1). The dialog window will appear on the desktop (fig.5).

Barcode scanner data logger. Parser configuration window

Fig.5. Barcode scanner data logger. The configuration window of the parser.

The configuration process will very simple if you've examined your data flow in the data logger window (fig.3). You should type in the same as in the data logger window in fields 1 and 2. Field #1 marks the beginning of the data block and the field #2 marks the end. In the example, our data block does not contain a start marker. You should type a value from the fig.3, which is underlined by red. The field #3 is empty, because our data packet doesn't contain characters, which should be ignored.

Ok. We are going to the next page. This is a very important part of the parser configuration. The parser uses this information to extract parser items (variables) from a data packet. Our data packet contains 2 data items, which should be placed to different variables. Later, these variables will be used in the data export and data filter plug-ins. In our case values from these variables will be placed to different columns of a target CSV file.

Barcode scanner data logger. Parser items

Fig.6. Barcode scanner data logger. Parser items.

You should add two new items by clicking the "Add item" button (fig.6, pos.7). Before adding an item the program will ask you about an item description. You can type any characters here, which will help you to remember a variable's content. We've added all variables with corresponding descriptions on the fig.6

Each parser item has few properties:

  1. Item name - this name will be bound to a column in the data export plug-in. It is a limited text description and cannot contain spaces and a few other characters;
  2. Parser's type - is a method, which the program will use for data extraction. Our parser has few methods from simple to most powerful. In our case, where data is placed in a fixed place, we can use the simple method - "fixed position". This method allows to extract any number of characters from any fixed position of the data packet;
  3. Data type - the data type. If you'll specify a data type other than the "STRING" data type, then the module will try to convert the string value to the specified data type. The module allows to configure several options that will be used at the conversion (see the "Data format" tab);
  4. Default value - this value will be used when data can't be extracted from a data packet (or can't be converted to the specified data type);
  5. Fixed position - is the position of the first variable's character in our data block. The minimum value is 1;
  6. Fixed length - is the number of characters, which will be transferred to a variable. The minimum value is 1.

The second item has same parameters, just the position and the length are different.

On the next page (fig.7) you can specify basic format options. Because we've specified the "String" data type for both parser variables, then first two options allow removing blank spaces from a value. Other options are not applicable in our case.

Barcode scanner data logger. Format of items

Fig.7. Barcode scanner data logger. Format options.

Please, click the "OK" button and close the configuration window and then click the "OK" button again in the options window.

Now, our parser is ready and we can test it. Connect your device and/or power it on and try to receive a data packet from a port. If the parser is configured properly, then the DDE server window will display our variables name and value (fig.8).

Barcode scanner data logger. DDE server window

Fig.8. Barcode scanner data logger. The DDE server window.

Now we should configure the Local database plug-in. This process is very simple. Please, open the configuration window of the Local database plug-in (fig.9) by selecting the module in the list and clicking the "Setup" button on the "Data export" tab.

Barcode scanner data logger. Selecting a database

Fig.9. Barcode scanner data logger. Selecting a database type.

You should:

  1. Select a database type at the field #1,
  2. In the field #2 specify a path, where new files will be created
  3. In the field #3 specify a file name prefix
  4. Configure parameters of your CSV file with the group of options #4. All options in this group are optional. You may use default values.

On the "Data formats" page you can specify a data format of your data. Because all our variables are with the "string" data type, then we don't need to change format options. On the "Columns order" page (fig.10) you can specify, how variables will be placed in a spreadsheet. Because we need 2 variables only, therefore, we need to create 2 items on this page by clicking the "Add item" button (fig.10, pos.5).

Barcode scanner data logger. Column order options

Fig.10. Barcode scanner data logger. Columns order options.

Before adding an item the program will ask you about an item description. You can type any characters here, which will help you to remember a variable's content.

Each data export item has following properties:

  1. Parser item name - it is a parser variable name, which we specified in the parser module. You may select a variable name from a drop-down box, which appears by clicking on a link of this property;
  2. Column order - it's a position of a variable in a spreadsheet. A minimum value is 1;
  3. Column length - it's a column width. This options are not required in our case, because we are using a delimited CSV file;
  4. Data type - the module will use this type for formatting a value.

Now, please, click the "OK" button and close the configuration window of the "Local database" plug-in. The click the "OK" button in the options window.

Ok. All settings had been configured and we are now ready for capturing barcodes.