

You may execute a SQL statement like the following and insert a new row to the table. The "MODBUS" plugin in another configuration handles an event, and execute the "write" request.ġ2.The "Script Execute" plugin redirects SQL data to different data sources and devices using events.The "OPC parser" plugin prepares data for the "Script Execute" plugin.The SQL interface reads data from a database table.Now, the application works in the following way: V2 := GetVariable('VALUE2') // Float value StrTargetDataSource := GetVariable('DATA_SOURCE') ĭevice := GetVariable('DEVICE_ID') // MODBUS device IDĪddr := GetVariable('OFFSET') // MODBUS memory offset Script execute - this plugin executes a script and sends values from the database table to the necessary data source (an IP address or an RS232 port), a device, and an address. This plugin does not have any settings.ĩ. When the SQL interface reads data, it appears in the main window.Ĩ. Specify the name of your database table, the polling interval, and the "DATE_TIME_STAMP" field name. Configure connection with your database ( page #100).ħ. Create a new configuration with the SQL interface by clicking the "Green Plus" button in the main window.Ħ.
#Modbus server database update
NEW.DATE_TIME_STAMP := COALESCE(NEW.DATE_TIME_STAMP, NOW()) ĬREATE TRIGGER MODBUS_DATA_WRITE_BI BEFORE INSERT ON "MODBUS_DATA_WRITE"įOR EACH ROW EXECUTE PROCEDURE MODBUS_DATA_WRITE_BI_TRIGGER() ĬREATE TRIGGER MODBUS_DATA_WRITE_BU BEFORE UPDATE ON "MODBUS_DATA_WRITE"ĥ. "DATE_TIME_STAMP" timestamp DEFAULT NULL,ĬREATE OR REPLACE FUNCTION MODBUS_DATA_WRITE_BI_TRIGGER() The logger will use this column to read updates from the table.īelow you can find some table-creating scripts that we recommend to use. The "DATE_TIME_STAMP" column specifies the time when the value is changed last time. The table will contain one row for each register. Add only one response item to each request with the "VALUE" name.Ĥ. For example, one request writes "int" values, another one "float" values.ģ.5. Note: You should add a separate request with a different event ID for each data type.

You may use other identifiers but should change them in the next steps too. Then specify the event identifier like "WRITE-INT," "WRITE-FLOAT," "WRITE-UINT16". The plugin will receive it from a database.ģ.4.

6 (Write single register) - if you need to write a value that allocated one MODBUS register in the PLC memory.Click "Action - Add request" and add new requests to write data (fig. Select the "MODBUS TCP" or "MODBUS RTU" plugin from lists. Go to the "Modules - Query Parser Filter" page. If you've already configured the connection, then go to step #2.Ģ. If your device uses MODBUS RTU, look here.

This example shows the connection settings for MODBUS TCP. You usually need to select the "TCP/IP" interface type for MODBUS TCP and "RS232" for MODBUS RTU. Create a new configuration from the main window using the "Green Plus" button.
#Modbus server database trial
Data Logger Suite Enterprise or a trial version.My goal is to write data from my database to PLC using MODBUS.
