Jonny007-MKD
2884b48093
Added length property for ModbusSend() Introduced OnModbusReceive() called by OnTcpReceive() and OnUdpReceive()
34 lines
No EOL
614 B
Text
34 lines
No EOL
614 B
Text
/*@!Encoding:1252*/
|
|
|
|
includes
|
|
{
|
|
#include "TcpCommon.cin"
|
|
#include "ModbusClientCommon.cin"
|
|
}
|
|
|
|
void ModbusConnectTo(char Remote_IP[], word Remote_Port)
|
|
{
|
|
TcpConnectTo("192.168.1.3", 502);
|
|
}
|
|
|
|
void ModbusSend(byte buffer[])
|
|
{
|
|
TcpSnd(buffer, elCount(buffer));
|
|
}
|
|
|
|
void ModbusSend(byte buffer[], word length)
|
|
{
|
|
TcpSnd(buffer, length);
|
|
}
|
|
|
|
void ModbusRecv()
|
|
{
|
|
TcpRecv();
|
|
}
|
|
|
|
void OnTcpReceive(dword socket, long result, dword address, dword port, byte buffer[], dword size)
|
|
{
|
|
OnModbusReceive(socket, result, address, port, buffer, size);
|
|
if (result == 0 && size != 0)
|
|
TcpRecv();
|
|
} |