Closed harounshehata closed 6 years ago
Hi Shehata,
"432768" should be the right address to use. I don't understand this line "But unfortunately when I use these desired properties, I get an Exception Code 2". Were you not using desired properties when reading from Mbpoll? What exact combination of device, mode of Modbus module are you using with the two cases? One thing I would suggest checking is to compare the settings you use for successful and failed cases. Exception code 2 means you are trying to access invalid data, which could be an out of range register address, or invalid UnitId. See this. Also, attach your log would help us to identify the root cause.
Thanks, Stephen
Hey Stephen,
Sorry for my delayed answer. My phrasing was wrong I only used desired properties.
My Modbus Slave (the one with the IP 10.26.1.158) is a Beckhoff device and I use a TwinCat 3 library for my Modbus (GVL.mb_Output_Registers: https://infosys.beckhoff.com/english.php?content=../content/1033/tf6250_tc3_modbus_tcp/9007199447487499.html&id=).
In the case where it succeeds I am using a Programm called Modbus Poll, with this configuration to read the registers.
I think the desired properties should be these (except for the count part I reduced it to 1):
{
"properties.desired": {
"PublishInterval": "2000",
"SlaveConfigs": {
"Slave01": {
"SlaveConnection": "10.26.1.158",
"HwId": "1",
"Operations": {
"Op01": {
"PollingInterval": "2000",
"UnitId": "1",
"StartAddress": "432768",
"Count": "1",
"DisplayName": "Werte"
}
}
}
}
}
}
but unfortunately it does not work and I have no Idea why because all the configuration seems to be the same.
The only logs that I have are the onces provided by the docker images, which only return the error code.
I hope you can help me with such little information.
Thanks, Shehata
Have you tried using address 432769? Looks like ModbusPoll is zero based with the address, and the Modbus module is using one based address. So 432768 in our module actually maps to 32767 in ModbusPoll or 7FFF in Beckhoff's PLC data area. I am guessing address 7FFF is not designed to be access by outside. You can check more details on how Modbus address space are defined here.
Hey Stephen,
You are a genius thanks for your help, it is working now and I can access all my registers.
Kind Regards, Shehata
I am very happy to be helpful. Closing this issue.
Hello,
I am trying to read holding registers from Beckhoff plc the register address start from 32768 and when I use ModbusPoll I can access the values. But unfortunately when I use these desired properties, I get an Exception Code 2 and I cannot find a documentation of the exceptions { "properties.desired":{
"PublishInterval":"2000", "SlaveConfigs":{
"Slave01": { "SlaveConnection": "10.26.1.158", "HwId": "PowerMeter-0a:01:01:01:01:01", "Operations": { "Op01": { "PollingInterval": "2000", "UnitId": "1", "StartAddress": "432768", "Count": "1", "DisplayName": "Werte" } } } } } } According to the Wiki page to access the holding register I have to use the prefix 4. I also tried it with the StartAddress :"32768".
I hope you can help me with my issue. KR Shehata