Modbus RTU Unit Identifier 128 and above always sending 63!
NGame1 opened this issue · 5 comments
NGame1 commented
Hi everyone,
I'm working with EasyModbus TCP on my .NET 5 project that running on Armbian.
A strange issue that I found is that when you specify a Unit Identifier above 128 (128 itself or greater) in the serial port the sent data will be like this.
63,6,0,0,0,1,86,27
witch means unit identifier is 63.
My code is:
var client = new ModbusClient("COM4") { Baudrate = 19200, StopBits = StopBits.One, Parity = Parity.None };
while (true)
{
try
{
client.UnitIdentifier = 128;
client.Connect();
client.WriteSingleRegister(0, 1);
//Console.WriteLine(client.sendData[0]);
Thread.Sleep(100);
}
catch (Exception)
{
}
}
Padanian commented
128 and above require 8 bit data.
Try add databits = 8
Da: AliNGame ***@***.***>
Inviato: giovedì 20 maggio 2021 12:54
A: rossmann-engineering/EasyModbusTCP.NET ***@***.***>
Cc: Subscribed ***@***.***>
Oggetto: [rossmann-engineering/EasyModbusTCP.NET] Modbus RTU Unit Identifier 128 and above always sending 63! (#61)
Hi everyone,
I'm working with EasyModbus TCP on my .NET 5 project that running on Armbian.
A strange issue that I found is that when you specify a Unit Identifier above 128 (128 itself or greater) in the serial port the sent data will be like this.
63,6,0,0,0,1,86,27
witch means unit identifier is 63.
My code is:
var client = new ModbusClient("COM4") { Baudrate = 19200, StopBits = StopBits.One, Parity = Parity.None };
while (true)
{
try
{
client.UnitIdentifier = 128;
client.Connect();
client.WriteSingleRegister(0, 1);
//Console.WriteLine(client.sendData[0]);
Thread.Sleep(100);
}
catch (Exception)
{
}
}
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub <#61> , or unsubscribe <https://github.com/notifications/unsubscribe-auth/AB3I2BG7NPFIITSQCET3HRDTOTS3RANCNFSM45GXIQEQ> . <https://github.com/notifications/beacon/AB3I2BACPHKUZGNPB7FGTLLTOTS3RA5CNFSM45GXIQE2YY3PNVWWK3TUL52HS4DFUVEXG43VMWVGG33NNVSW45C7NFSM4NLRU3DA.gif>
[ { ***@***.***": "http://schema.org", ***@***.***": "EmailMessage", "potentialAction": { ***@***.***": "ViewAction", "target": "#61", "url": "#61", "name": "View Issue" }, "description": "View this Issue on GitHub", "publisher": { ***@***.***": "Organization", "name": "GitHub", "url": "https://github.com" } } ]
NGame1 commented
You mean client.DataBits = 8?
Databits property is not present in ModbusClient.
Padanian commented
You can change the databits property in the COM4 serialport properties.
Da: AliNGame ***@***.***>
Inviato: giovedì 20 maggio 2021 13:44
A: rossmann-engineering/EasyModbusTCP.NET ***@***.***>
Cc: Alessandro Mandelli ***@***.***>; Comment ***@***.***>
Oggetto: Re: [rossmann-engineering/EasyModbusTCP.NET] Modbus RTU Unit Identifier 128 and above always sending 63! (#61)
You mean client.DataBits = 8?
Databits property is not present in ModbusClient.
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub <#61 (comment)> , or unsubscribe <https://github.com/notifications/unsubscribe-auth/AB3I2BG4PQK2HHZDJUJ7TWLTOTYW3ANCNFSM45GXIQEQ> . <https://github.com/notifications/beacon/AB3I2BDMRBCR7G43MZUI3HTTOTYW3A5CNFSM45GXIQE2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOGJO7J6Q.gif>
[ { ***@***.***": "http://schema.org", ***@***.***": "EmailMessage", "potentialAction": { ***@***.***": "ViewAction", "target": "#61 (comment)", "url": "#61 (comment)", "name": "View Issue" }, "description": "View this Issue on GitHub", "publisher": { ***@***.***": "Organization", "name": "GitHub", "url": "https://github.com" } } ]
Padanian commented
Did it work?
NGame1 commented
Did it work?
I'm not at work until Saturday.
I should test it on Saturday. Also, I have to find a way to set data bits to 8 on Armbian too. That's my final destination and need to work there.
Anyhow, thanks for your quick replies.