Delta PLC Read/Write internal relay M in C#
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 int DevToAddrW ( string seri...