MODBUS to MSSQL: Write several MODBUS registers to separate columns
Download a Free Trial Version. It allows you to try all features! Plugins can be downloaded separately here
If you need to not only log the changes of the MODBUS item values in the MSSQL database but also analyze and process them after that, it will be more convenient to create a table where there will be a separate column for every item. This method can be applied if there are not many MODBUS values.
ITEM1 - will store the value of item 1;
ITEM2 - will store the value of item 2;
TIMESTAMP - will contain the date and time when the value was modified.
1. Create a new user in the database or give permissions to write and read data from the created table to an existing user.
2. Configure the queue with MODBUS requests, as described in "MODBUS polling."
3. Memorize names of response items (e.g., VALUE1, VALUE2). If you want, you may create the table above with identical column names.
4. Verify that the logger sends MODBUS requests and receives responses.
5. Select the data export plug-in (fig. 1)
Fig. 1 Selecting the data export plug-in
6. Configure the data export plug-in (fig. 2-3)
Fig. 2 Configuring the data export plug-in. General.
To set up a connection, you should create and configure the ODBC data source for connecting to your MSSQL database. Click the "Configure" button to do it. After you create the data source, click "Update" and select the data source from the list.
Fig. 3 Configuring the data export plug-in. Connection.
7. Binding (fig. 4) allows you to specify which data to which columns the program should add. You should specify the column name and "bind" it to the item from the program's main window (the parser item). You should also specify the data type of the column.
Fig. 4 Configuring the data export plug-in. Binding.
Click "OK" to save the changes.
9. Check the status bar to make sure the data is being successfully processed (fig. 5).
Fig. 5 A message about data being successfully written
Fig. 5 Data in an MS SQL 2008 database
MODBUS RTU, MODBUS ASCII, MODBUS/TCP
- MODBUS power meter data logging (easy method)
- Sunspec-compatible MODBUS power meters, inverters (easy method)
- MODBUS RTU/TCP polling: Configuring master station (MODBUS RTU, MODBUS TCP, requests, response items).
- MODBUS poll: How to make sure that the application sends requests and receives responses?
- MODBUS poll: How to view register values, not raw MODBUS packets?
- MODBUS polling: How to make sure that the application correctly interprets the responses received from the device?
- MODBUS polling: How to view MODBUS register values in a more easy-to-grasp form (graphs, indicators, etc.)?
- MODBUS: How to combine the data of two requests?
- MODBUS: What is the right way to poll multiple devices?
- Controlling PLC coil registers status using MODBUS TCP (MODBUS data parser, custom scripts, events generating, and handling).
- MODBUS to MSSQL: Write MODBUS registers to separate columns
- MODBUS to MySQL: Write MODBUS values to the MySQL database
- MODBUS to a database: Writing MODBUS RTU/TCP values to a database
- MODBUS to a database: Write data to two different tables.
- MODBUS to a database: Write data to two different databases making a complete copy.
- Sentron PAC 3200: MODBUS TCP Data Logging
- Write data to a MODBUS device
- SQL to MODBUS: Send data from a SQL database to MODBUS.
- MODBUS TCP ↔ MODBUS RTU real-time conversion.