Placeholder

Search

How to use NG-Trace with the Modbus driver

Valid for Modbus 2 library version 2.7.676, NG-Trace library version 2.7.607 and NG-Trace version 2.3.026.
(former versions support only the 'basic' Modbus trace and only Modbus/TCP Master)

There are 2 versions of the Modbus 2 Trace buffer.
 1. The 'basic' trace which shows onyl the parameters of each requests and errors.
    The keyword for the Trace Buffer Fbox is 'Modbus'.
 2. The 'Raw Data' trace which shows all bytes of each Modbus requests and responses (Error are not yet included).
    The keyword of the Trace Buffer Fbox is 'MosbusRaw'.

We assume that you have correctly installed NG-Trace and the FBox library according to the instructions on the NG-Trace Download page.
You have already created your Modbus application and therefore, you have an Fupla file with the 'Master Link RS' or 'Master Link IP Fbox placed.

  1. Open the Fupla file with the Modbus Master Link xx Fbox. Before this FBox, place an FBox 'Trace Buffer' from the NG-Trace family.
     - For the 'basic' trace, give the Fbox the name 'Modbus'.
     - For the 'Raw Data' trace, give the Fbox the name 'ModbusRaw'.
    On the FBox enter a free register (one single free register).
    You can also place 2 Fboxes, with 2 different registers  to have both trace buffers.

    The Level option in the NG-Trace Buffer Fbox can be found at the end of this page (do not select a too high level if don’t want the buffer to be quickly filled with unnecessary messages).

  2. In the Device folder, create a new file with the type 'NG-Trace 2 Settings'.
    Important: Uncheck the option 'Linked/Build'.
    The NG-Trace tool will open.
    When prompted, select 'Connect to standard buffer'.
    You can create 2 NG-Trace file if you have placed 2 Trace Buffer Fboxes

  3. Click 'Edit Buffer' and enter the register of the Fbox as 'Start Register'. Save and Close the window.

  4. Build, load and run your program as usual in the PG5 Project Manager. During build, you should get these 2 messages:
    - NG-Trace Buffer for Modbus created.
    - NG-Trace Buffer for Modbus 2 Driver found
    Only if you get these 2 messages, the trace buffer will work.

  5. Go online with the PG5 Project Manager.

  6. On the main window of the NG-Trace, press the Connect button. The display of the trace will start.


The named columns appear and the events are recorded. If the option is checked, the PC Date and Time is added.

Example of a 'Basic' trace. 

Example of a 'Raw Data' trace.

Read the Help file for more explanation about the use of NG-Trace.


Signification of the levels which can be configured in the FBox 'NG-Trace Buffer' for the 'basic' trace.

Message

Level 0 Level 1 Level 2 Level 6 Level 8
Version   X X X X
Internal Info   X X X X
Timeout Errors   X X X X
TCP Open/Close     X X X
TCP Connections     X X X
Tx/Rx Requests         X
Rejected requests       X X