Comments (7)
And only the first coil value is correct, the others always appears as false.
from micropython-modbus.
And only the first coil value is correct, the others always appears as false.
That's correct @javiercp64 for default definitions example because the len is 1
("len": 1
) for the value 1
("val": 1
), so others bits that are not set, are 0
(False
) by default.
If you change the definitions to set others bit values you will receive True
if you set as 1
. See example below with new definitions - look at "val"
:
register_definitions = { "COILS": { "EXAMPLE_COIL": { "register": 123, "len": 3, "val": [1, 0, 1] } },
Output:
>>> host.read_coils(slave_addr=10, starting_addr=123, coil_qty=3)
[True, False, True, False, False, False, False, False]
>>>
However, the write multiple COILS has a bug, as reported on the PR #10, in this section, item 2
.
from micropython-modbus.
As detected by @brainelectronics on the thread #10 (comment) is correct to return always multiple of 8 bits. So is correct when coil_qty=1
returning the 8 bits/elements. But the bug still exists, once that coil_qty=20
is returning just first 8 bits.
host.read_coils(slave_addr=10, starting_addr=123, coil_qty=1)
[True, False, False, False, False, False, False, False] # CORRECT: "coil_qty=1" and showed 8 bits (multiple of 8).
host.read_coils(slave_addr=10, starting_addr=123, coil_qty=20)
[True, False, False, False, False, False, False, False] # NOT CORRECT: "coil_qty=20" showing only first 8 bits.
from micropython-modbus.
@brainelectronics
Check Implementation to follow requirement of returning multiple coils as requested, see http://www.simplymodbus.ca/FC01.htm
from micropython-modbus.
develop...ShaunL36:micropython-modbus:develop
from micropython-modbus.
related to #25
from micropython-modbus.
from micropython-modbus.
Related Issues (20)
- Update documentation for mip usage
- Add issue template file HOT 1
- Add testing framework for ModbusRTU
- Initial Response on Write Single Reg/Coil HOT 1
- Single Coil Write and Holding Register Write Initial Response Error HOT 11
- Invalid CRC on reading multiple COILS HOT 13
- Instructions for install on boards without network capabilities HOT 3
- Trying to implement TCP client on RPi Pico with ETH HAT HOT 9
- Is Circuitpython supported? HOT 1
- Cannot run example code (RTU Slave) HOT 8
- Implementing GPIO pins in TCP client mode on Pico HOT 3
- W600 and ESP8266 MemoryError HOT 10
- Cite this repository HOT 6
- Raspberry Pico Modbus TCP IO Device HOT 3
- Add contribution guideline
- Problem with RS485 direction control HOT 12
- Value limits accepted by Slave on the Holding Register (HREGS) HOT 5
- Compatibility with W5500 or ENC28J60 - SPI to Ethernet Modules HOT 1
- Can't install using upip - ESP8266 HOT 1
- Control Pin problem (remained to HIGH after several time of communication) HOT 5
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 micropython-modbus.