Comments (4)
Hi,
For read operation, address "40001" means a read holding registers at address 1 (https://en.wikipedia.org/wiki/Modbus#Coil.2C_discrete_input.2C_input_register.2C_holding_register_numbers_and_addresses). When convert to PDU data frame, it becomes function code of 3, and starting address as 0. So the StartingAddress shown in the request from Modbus module to your Modbus target is 0 (in PDU format).
Please do double check your configuration and the Modbus device user manual to see if there's holding registers available at address 1.
Could you capture the logs which containing the exception messages? And your module configuration details. Thanks!
from iot-edge-modbus.
Hi, thanks for the reply.
I've not done anything with Modbus before so apologies in advance. From what I understand, 40001 contains data, Uint32.
40001 | 40002 | 2 | R | 0x03 | SID | Well-known value....
I've used a tool, modpol.exe to request data starting at the same register and it returned data, 5 registers.
modpoll.exe -c 5 -r 40001 -m tcp 192.168.x.x
modpoll 3.6 - FieldTalk(tm) Modbus(R) Master Simulator
Copyright (c) 2002-2018 proconX Pty Ltd
Visit https://www.modbusdriver.com for Modbus libraries and tools.
Protocol configuration: MODBUS/TCP
Slave configuration...: address = 1, start reference = 40001, count = 5
Communication.........: 192.168.x.x, port 502, t/o 1.00 s, poll rate 1000 ms
Data type.............: 16-bit register, output (holding) register table
-- Polling slave... (Ctrl-C to stop)
[40001]: 21365
[40002]: 28243
[40003]: 1
[40004]: 65
[40005]: 18034
I changed the register to 40098, float, still have the same problem.
Below is the config of the modbus module, pretty much the same as the example except for the IP and the register.
{
"properties.desired": {
"PublishInterval": "60000",
"SlaveConfigs": {
"Slave01": {
"SlaveConnection": "192.168.x.x",
"HwId": "PowerMeter-0a:01:01:01:01:01",
"Operations": {
"Op01": {
"PollingInterval": "30000",
"UnitId": "1",
"StartAddress": "40001",
"Count": "2",
"DisplayName": "Voltage"
}
}
}
}
}
}
The saved properties according to the modbus module
Saving reported properties: {"PublishInterval":60000,"SlaveConfigs":{"Slave01":{"Operations":{"Op01":{"PollingInterval":30000,"UnitId":1,"StartAddress":"40001","Count":2,"DisplayName":"Voltage","CorrelationId":"DefaultCorrelationId"}},"SlaveConnection":"192.168.x.x","RetryCount":10,"RetryInterval":50,"TcpPort":502,"HwId":"PowerMeter-0a:01:01:01:01:01","BaudRate":null,"StopBits":null,"DataBits":null,"Parity":null}}}
And the exception
Modbus exception code: 2
The successful trace results from modpol.exe shows the starting register as 40000
And the unsuccessful trace results from modbus module shows the starting address as 0
Thanks again
from iot-edge-modbus.
Based on your master simulator tool "modpoll" document https://www.modbusdriver.com/modpoll.html , I think you misunderstand how to mapping "reference number" to Modbus module configuration "StartAddress".
When use "modpoll", with "-r 40000" only, which means to use default operation type of "-t 4 16-bit output (holding) register data type (default)".
The full compatible command line should be :
modpoll.exe -c 5 -r 40001 -t 4 -a 1 -m tcp 192.168.x.x
To map to the Modbus module configuration, "-a 1" maps to "UnitId": "1"; "-t 4" means to read from holding register, which is function code 3, so the StartAddress will start with digit 4; "-r 40001" means to read holding register from address 40001, and combining with the function code, the starting digit will be 4, so it maps to "StartAddress": "440001".
You should configure Modbus module like this for your test case:
"Op01": {
"PollingInterval": "30000",
"UnitId": "1",
"StartAddress": "440001",
"Count": "2",
"DisplayName": "Voltage"
}
from iot-edge-modbus.
Thanks, that sorted it. Appreciate your help!
from iot-edge-modbus.
Related Issues (20)
- No longer being maintained HOT 2
- Invoke method not working without internet HOT 2
- ‘Operation timeout expired’ error HOT 1
- Modbus TCP problem with Siemens PAC2200
- Update to new iotedge version HOT 2
- modbus tcp connection refused on Raspberry pi 3 HOT 3
- Data not being recieved in IoT Central HOT 3
- Please update RTU configuration in Readme.md HOT 2
- Windows Container Modbus module on Windows 10 1809 LTS supports RTU? HOT 1
- Only device that contains lots of registers, how to organize data? HOT 2
- Error building image HOT 2
- Support for arm64v8 HOT 3
- Add content properties to the message sent to the output HOT 4
- REAL type value is not correct in the output HOT 3
- Signalizing slave communication error HOT 1
- The While loop in the Start method freezes, when the module has more than 500 active operations HOT 2
- Cannot read data from slave HOT 2
- IoT Central Device template for iot-edge-modbus module HOT 1
- Module healthy but no data received from the device HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from iot-edge-modbus.