Git Product home page Git Product logo

exo-sense-py-modbus's People

Contributors

giampiero7 avatar

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

exo-sense-py-modbus's Issues

modbus rtu slave

Hi, where can I found an example of the implementation of the Modbus slave?

For the function: def get_request(self, unit_addr_list, timeout=None)

Thanks

modbus little endian

Hi,

Your library works perfectly! But I have a device that uses the "little endian byteorder".

How to add :

if lsb_first:
        formatcode = "<" # Little-endian
    else:
        formatcode = ">" # Big-endian

I think I'd have to add a constant for decoding

def read_holding_registers(starting_address: int, quantity: int) -> bytes:
    """
    Create Modbus Protocol Data Unit for reading holding registers.

    :param      starting_address:  The starting address
    :type       starting_address:  int
    :param      quantity:          Quantity of coils
    :type       quantity:          int

    :returns:   Packed Modbus message
    :rtype:     bytes
    """
    if not (1 <= quantity <= 125):
        raise ValueError('Invalid number of holding registers')

    return struct.pack('>BHH',
                       Const.READ_HOLDING_REGISTERS,
                       starting_address,
                       quantity)

I'd like to do it but I'm not sure of my abilities !

Thank you

TypeError in socket.bind

Hello!
First, many thanks for tweaking original pycom lib, and share on github.

I'm using the library successfully with WiPy devices as Modbus TCP server, but there's some problem I can't find under another ESP32 board (olimex ESP32-POE) with micropython v1.11.
The exact same code works without problems under WiPy, but on micropython throws this error:

Traceback (most recent call last):
  File "main.py", line 47, in <module>
  File "modbus.py", line 44, in bind
  File "/lib/uModBus/tcp.py", line 144, in bind
TypeError: function takes 2 positional arguments but 1 were given

I've added a print over line 144:
self._sock.bind((socket.getaddrinfo(local_ip, local_port))[0][-1])
In order to see if local_ip and local_port have correct values and also checked socket.getaddrifo() returns the same tuple both with WiPy and Micropython.

At the moment I'm trying, but I'm not obtaining good results. Perhaps newer usocket library breaks something?

Best regards

rtu_ slave

Hi, I do some changes in the modbus.py, probably not implemented it correctly.
Can we communicate by email?
Where can I define Modbus slave address?

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.