Giter VIP home page Giter VIP logo

Comments (7)

javiercp64 avatar javiercp64 commented on June 30, 2024

And only the first coil value is correct, the others always appears as false.

from micropython-modbus.

beyonlo avatar beyonlo commented on June 30, 2024

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.

beyonlo avatar beyonlo commented on June 30, 2024

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 avatar brainelectronics commented on June 30, 2024

@brainelectronics
Check Implementation to follow requirement of returning multiple coils as requested, see http://www.simplymodbus.ca/FC01.htm

from micropython-modbus.

brainelectronics avatar brainelectronics commented on June 30, 2024

develop...ShaunL36:micropython-modbus:develop

from micropython-modbus.

brainelectronics avatar brainelectronics commented on June 30, 2024

related to #25

from micropython-modbus.

brainelectronics avatar brainelectronics commented on June 30, 2024

220d3b9

from micropython-modbus.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.