Code Monkey home page Code Monkey logo

Comments (3)

RobertoRoos avatar RobertoRoos commented on July 18, 2024

I've pretty much figured this out now, mostly through lot's of trial-and-error.

So in a nutshell: the PDO input and output is packed in a way I can't deduce from the EL7041 documentation, but I can copy the information from the TwinCAT project.
When clicking on an entry, e.g. "Sync Error", there is the "address" field. For this entry the address "40.7". The .7 indicates bit number 7 is being used (the last bit, because counting starts at 0). The 40 indicates the byte number, although it starts at an offset. The lowest address value is 39, so I'm considering address 39 as byte 0, 40 as byte 1, etc. So we can follow this to determine the entire PDO entry.

ctypes.Structure bit fields are well suited to this. See https://docs.python.org/3/library/ctypes.html#bit-fields-in-structures-and-unions

A complete example can be found in my comment here: #135 (comment)

from pysoem.

bnjmnp avatar bnjmnp commented on July 18, 2024

Nice job, this is great example.
Can we close this issue?

from pysoem.

RobertoRoos avatar RobertoRoos commented on July 18, 2024

Yeah, we can close this. I'm assuming there is not a less tedious and manual approach to this that I don't know.

from pysoem.

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.