Giới Thiệu · MODBUS RTU Serial RS232/RS485 and TCP/IP for Windows
MODBUS devices R/W datas access with [MBusDrv.dll] library.Exported functions (pascal declarations) : {* Standard read datas from MODBUS device *} function GetMBData(const SlaveAddr : byte; const ReadType : boolean; var Data : array[0..254] of byte) : integer; stdcall; SlaveAddr : byte (1..254) ReadType : boolean (false=Coils / true=Holding Registers) Data : array[0..254] of byte (device datas) Return integer (0=OK) {* Extended read datas from MODBUS device *} function GetMBDataEx(const SlaveAddr : word; const ReadType : word) : pointer; stdcall; SlaveAddr : word (1..254) ReadType : word (0=Coils / 1=Holding Registers) Return pointer of 255 byte (device datas or 0=Error) {* VBA (Microsoft Visual Basic) read datas from MODBUS device *} function GetMBDataVBA(const SlaveAddr : LongInt; const ReadType : LongInt) : pointer; stdcall; SlaveAddr : longint (1..254) ReadType : longint (0=Coils / 1=Holding Registers) Return pointer of 255 byte (device datas or 0=Error) {* Standard write data to MODBUS device *} function PutMBData(const SlaveAddr : byte; const WriteType : boolean; const DataAddr : byte; const Data : word) : integer; stdcall; SlaveAddr : byte (1..254) WriteType : boolean (false=Coil / true=Holding Register) DataAddr : byte (1..255) Data : word Return integer (status code >=0=OK) {* VBA (Microsoft Visual Basic) write data to MODBUS device *} function PutMBDataVBA(const SlaveAddr : longint; const WriteType : longint; const DataAddr : longint; const Data : longint) : longint; stdcall; SlaveAddr : longint (1..254) WriteType : longint (0=Coil / 1=Holding Register) DataAddr : longint (1..255) Data : longint Return longint (status code >=0=OK).