Data reversed
See original GitHub issueI use Modbus Slave
to simulate slave, but I get reverse data.
Slave Log
000070-Rx:00 00 00 00 00 06 01 03 00 00 00 0A
000071-Tx:00 00 00 00 00 17 01 03 14 01 09 01 83 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
000072-Rx:00 01 00 00 00 06 01 03 00 00 00 0A
000073-Tx:00 01 00 00 00 17 01 03 14 01 09 01 83 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
Master code
static void Fluent()
{
var client = new ModbusTcpClient();
client.Connect(IPEndPoint.Parse("127.0.0.1:502"));
var d1 = client.ReadHoldingRegisters<ushort>(1, 0, 10);
Console.WriteLine(string.Join(";", d1.ToArray().Select(BitConverter.GetBytes).Select(c => BitConverter.ToString(c)).ToArray()));
Console.WriteLine(string.Join(";", d1.ToArray()));
var d2 = client.ReadHoldingRegisters(1, 0, 10);
Console.WriteLine(BitConverter.ToString(d2.ToArray()));
Console.WriteLine(string.Join(";", d2.ToArray()));
client.Disconnect();
}
Master output
01-09;01-83;00-00;00-00;00-00;00-00;00-00;00-00;00-00;00-00
2305;33537;0;0;0;0;0;0;0;0
01-09-01-83-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00
1;9;1;131;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0
Slave send | Master output |
---|---|
265(0x0109) | 2305(0x0901) |
387(0x0183) | 33537(0x8301) |
I tested it in NModbus, it works correct. NModbus code
static void NModbus()
{
using var tcpClient = new TcpClient();
tcpClient.Connect(IPEndPoint.Parse("127.0.0.1:502"));
using var client = new ModbusFactory().CreateMaster(tcpClient);
var d = client.ReadHoldingRegisters(1, 0, 10);
Console.WriteLine(string.Join(";", d.Select(BitConverter.GetBytes).Select(c => BitConverter.ToString(c)).ToArray()));
Console.WriteLine(string.Join(";", d));
}
NModbus output
09-01;83-01;00-00;00-00;00-00;00-00;00-00;00-00;00-00;00-00
265;387;0;0;0;0;0;0;0;0
Issue Analytics
- State:
- Created 4 years ago
- Comments:5 (3 by maintainers)
Top Results From Across the Web
Flip Data in Excel | Reverse Order of Data in Column/Row
Sometimes, you may have a need to flip the data in Excel, i.e., to reverse the order of the data upside down in...
Read more >How to flip data in Excel columns and rows (vertically ...
In situations when you need to reverse the data order in a column arranged alphabetically or from smallest to largest, you can obviously...
Read more >Reverse Data in Excel
How to flip data upside down i.e. reverse data in Excel. An efficient method to make rows reverse order without using VBA or...
Read more >Reverse Data Management
Reverse transformations modify the source data rather than generate a new target data instance. Some examples of reverse transformations include updates through ...
Read more >3 Easy Ways to Flip Data in Excel (Reverse the ... - YouTube
In this video, I will show you how to flip the data in Excel (i.e.., reverse the order of the data in rows...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Sorry for my late reply. I have released a new version that allows to specify the data layout (big-endian vs little-endian).
Example:
When you specify this layout, all data will be reversed automatically.
I´ll close this issue for now as it should be resolved. If you have further issues, feel free to reopen it.
Thanks for your feedback. Unfortunately I don’t have much time right now, but I`ll try to fix it next week.