Home AMX User Forum AMX Technical Discussion
Options

MODBUS Module

So I have this modbus actuator. All I need is only one parameter. But still have mo success. I use AMX Modbus module from amx.com
So that is how it's done:
i use Comm-module to establish connection. It goes well at this point.
Then I supposed to use DATA_EVENT and parse strings for READ_HOLD.
I guess it's pretty equal to have buffer for gate and look at it with my own eyes. And all that fancy module does is parcing the buffer for the command names, addresses and values. Am I right?
Pic related is my buffers of gates 1 and 2, and buffer from actuator itself.

Comments

  • Options
    ericmedleyericmedley Posts: 4,177
    If I'm understanding your question...

    Yes,

    The idea with all 'comm' modules is to act as an arbitor between the device and your program.

    So for example.

    The device might output something like:

    $00,$0A,$B0,$03,$00,$01,$0D,$0A for an 'on' status report. This will be on the real device (serial port or IP port or whatever)

    The module will send soemthing like:
    'POWER=ON' from the virtual device and your program will communicate with the virtual device. So, you'll have a data_event[virtual_device].

    The idea is that it makes your programming easier. For example if you ended up changing out the device for something simlar, the new module might still output the same command set so ou wouldn't need to make any changes in your program, just swap out the module. I'm oversimplifying, of course.

    I don't always use a module to control a device mself. If it's a pretty conmplicated protocol for something that is fairly unique, I'll just make an include file myself. That saves me having to write control code twice for the device. Similarly, for something very simple, I'll just go ahead and code it straight in. (Like simple IR controls)

    I will say the more I make/create/use modules over the years, the better my code has gotten in general. I think the simple act of making/using them kinda forces you to streamline your code in general.

    I'm now to the point that I create modules/includes for almost everything and my main.src file has no actual code in it.

    I hope I answered your question.
  • Options
    Yeah, I forgot to ask concrete question =)))) silly me
    So, I send 'Address?', 'Debug?' commands and I can see the response in the buffer. You can see it on the pic.
    So I need to get the value on holding register address 1.
    What should I do?

    currently I use
    send_command MODBUS_GATE1, "'ADD_POLL=1:3'"
    
    but as you can see on the pic, response does not contain the value
Sign In or Register to comment.