Skip to content

Clarification on Handling Hexadecimal PLC Addresses (e.g., M12, M8E) #8

@kjk2148

Description

@kjk2148

​Hello PyXGT developers,

​First of all, thank you for creating and maintaining this very useful library. It has been a great tool for communicating with LS PLCs.
​I am writing to seek clarification on the correct way to format device addresses, specifically for M-devices. After some testing, I've come to a conclusion that I would like to confirm with you.
​It appears that the numerical part of an M-device address, as shown in PLC programming software like XG5000, is always hexadecimal. To use it with the PyXGT library, this hexadecimal value must be converted to its decimal equivalent.
​Here are my observations:
​To read the PLC address M12, I must use the string "M18" in PyXGT, because 12_{16} = 18_{10}.
​To read the PLC address M8E, I must use the string "M142", because 8E_{16} = 142_{10}.
​Similarly, to read the PLC address M142, I must use the string "M322", because 142_{16} = 322_{10}.
​My questions are:
​Is my understanding correct? Is the library designed to always expect the decimal representation of the PLC's hexadecimal address for M-type (and possibly L-type) devices?
​If this is the intended behavior, would you consider adding a note about this to the README or documentation? This conversion requirement is not immediately obvious and could be a common source of confusion for new users who expect to use the addresses exactly as they appear in the PLC software.
​This behavior seems to be a direct implementation of the PLC's communication protocol, which uses decimal offsets, rather than a flaw in the library. However, a small clarification in the documentation would be incredibly helpful for the community.
​Thank you for your time and for your great work on this project.

​Best regards.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions