Sign in

Delta PLC provides Modbus communication library DMT, which can be used in C# ​​to communicate with Delta PLC over RS485 (Modbus).

First of all to use DMT with your application following functions should be imported from kernel32.dll and DMT.dll:

using System.Reflection;[DllImport("kernel32.dll", CharSet = CharSet.Auto)]static extern IntPtr LoadLibrary(string dllPath);[DllImport("kernel32.dll", CharSet = CharSet.Auto)]static extern bool FreeLibrary(IntPtr hDll);// Serial Communication[DllImport("DMT.dll", CharSet = CharSet.Auto)]static extern int OpenModbusSerial(int conn_num, int baud_rate, int data_len, char parity, int stop_bits, int modbus_mode);[DllImport("DMT.dll", CharSet = CharSet.Auto)]static extern void CloseSerial(int conn_num);// MODBUS Address Calculation[DllImport("DMT.dll", CharSet = CharSet.Auto)]static extern

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store