Hi,
Still trying to get more details, before moving towards a solution...
I assume you have the IP:port address for the TCP connection and details of the registers you want to get data from. You would create a small server program (LDServer could probably do that), send a request and get the message back. Both would be a relatively short sequency of bytes. Something like what is described on this https://www.simplymodbus.ca/FC04.htm
The main difficulty looks like calculating the CRC as Scout mentioned - there is an algorithm for this, but a bit of work, probably doable in SB, but not trivial (e.g. https://ctlsys.com/support/how_to_comput...essage_crc).
Don't discount doing this in C# using a Modbus Nuget package either.
We can help with either, probably using C# is easier (a bit higher level - not handling bytes big/little endian, hand calculating CRC etc).
EDIT
The Modbus system does look pretty simple with many implementations in C# available (reinvingting can be fun, but mostly only if you are doing it for fun, otherwise I recommend just using what's already there), using NModbus4 for example something like:
If you really wanted the data back in SB, then easy to write a small extension for this - again we can help.
EDIT 2
Looks like CRC is only required for the serial RTU mode
Still trying to get more details, before moving towards a solution...
I assume you have the IP:port address for the TCP connection and details of the registers you want to get data from. You would create a small server program (LDServer could probably do that), send a request and get the message back. Both would be a relatively short sequency of bytes. Something like what is described on this https://www.simplymodbus.ca/FC04.htm
The main difficulty looks like calculating the CRC as Scout mentioned - there is an algorithm for this, but a bit of work, probably doable in SB, but not trivial (e.g. https://ctlsys.com/support/how_to_comput...essage_crc).
Don't discount doing this in C# using a Modbus Nuget package either.
We can help with either, probably using C# is easier (a bit higher level - not handling bytes big/little endian, hand calculating CRC etc).
EDIT
The Modbus system does look pretty simple with many implementations in C# available (reinvingting can be fun, but mostly only if you are doing it for fun, otherwise I recommend just using what's already there), using NModbus4 for example something like:
Code:
public static void ModbusTcpMasterReadInputs()
{
using (TcpClient client = new TcpClient("127.0.0.1", 502))
{
ModbusIpMaster master = ModbusIpMaster.CreateIp(client);
// read five input values
ushort startAddress = 100;
ushort numInputs = 5;
bool[] inputs = master.ReadInputs(startAddress, numInputs);
for (int i = 0; i < numInputs; i++)
{
Console.WriteLine($"Input {(startAddress + i)}={(inputs[i] ? 1 : 0)}");
}
}
// output:
// Input 100=0
// Input 101=0
// Input 102=0
// Input 103=0
// Input 104=0
}
If you really wanted the data back in SB, then easy to write a small extension for this - again we can help.
EDIT 2
Looks like CRC is only required for the serial RTU mode