Skip to content

Server Simulator Can't Distinguish Holding / Input Registers #1228

Answered by janiversen
erezblm asked this question in Help
Discussion options

You must be logged in to vote

The simulator does allow you to use the 4 blocks defined in the modbus specification:

demo_config = {
    "setup": {
        "co size": 100,
        "di size": 150,
        "hr size": 200,
        "ir size": 250,
        "shared blocks": True,

And self.offset[func_code] is used to get the real address. If you use "shared blocks" all functions can read the same register. With different blocks only functions of the same type read the same register.

see datastore/simulator.py line 261++:

       else:
            offset[1] = 0
            offset[5] = 0
            offset[15] = 0
            total_size = size_co
            offset[2] = total_size
            total_size += size_di
            …

Replies: 2 comments 13 replies

Comment options

You must be logged in to vote
11 replies
@janiversen
Comment options

@erezblm
Comment options

@janiversen
Comment options

@erezblm
Comment options

@janiversen
Comment options

Comment options

You must be logged in to vote
2 replies
@erezblm
Comment options

@janiversen
Comment options

Answer selected by erezblm
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
2 participants