Home AMX User Forum AMX Design Tools

AMX Master to Master communication and event handling

Is anyone familer with using Master-to-Master communication with two AMX systems? AMX's TechNotes give a good start point, but get vague pretty quickly.

Mine is an NXF cardframe talking with an NI-3100 across a small private network. I have set them each up with different system numbers: NXF is System 1 and the NI-3100 is System 2. I have a virtual devices set up on both: each with itself on 33010:1:0 and the other on 33010:1:x (x is the other's system number).

As for the actual communication, I can SEND_COMMAND to 33010:1:0 on one, and it will broadcast to be picked up on the other. My question is how to handle the receipt - do I use the STRING handler in a DATA_EVENT on the receiver? Or should it be handled in a different way?

Thanks,
Will Huhn
Computer Engineer
Booz | Allen | Hamilton

Comments

  • a_riot42a_riot42 Posts: 1,624
    Are you trying to send data from one master to the other? Shouldn't you be communicating to the actual device instead? I don't know what you are trying to do but whenever I have had m2m setups and I have had to send commands to a device that was connected to one master from another, that device was just defined on the second master and I sent commands to it and the masters figured it out on their own, no extra code handlers were required. So if I was sending a command from master 2 to a device on master 1, I would have that master 1 device defined in master 2 code eg dvDevice = 5001:1:1, and then send the command to it. You don't need to send the command to the other master and then handle and forward it on to the connected device, but perhaps I am misinterpreting what you are trying to do. If you are actually trying to send data back and forth then yes you will need a virtual to communicate and a data_event with string or command handlers to capture these things on the other master.
    Paul
  • Actually I am trying to do exactly what you are describing. Thanks for the information - I wasn't sure if it was possible to do things that way, and I am glad that it is actually that easy!

    Thanks again
  • a_riot42a_riot42 Posts: 1,624
    Yes it is that easy and works reliably from my experience. AMX help files need to better illustrate this. One caveat that I have found though, and newer firmware may have cured this, is that commands from one master to another works, but feedback going back to the originating master didn't work for me if I used certain virtual addresses. I can't recall what virtual address I used but if you end up setting it up and successfully controlling but not getting feedback this might be an issue.
    Paul
  • Joe HebertJoe Hebert Posts: 2,159
    a_riot42 wrote:
    feedback going back to the originating master didn't work for me if I used certain virtual addresses.
    As long as you stay within the Netlinx virtual address range, the address itself shouldn?t make a difference. However, the port, channel, and level can make a difference.

    By default a virtual device has only 1 port, 255 channels, and 8 levels. If you want to use something higher than those numbers then you need to call the SET_VIRTUAL_x_COUNT() functions.

    Is it possible you were using a port, channel, or level that?s greater than the default values?
    As for the actual communication, I can SEND_COMMAND to 33010:1:0 on one, and it will broadcast to be picked up on the other. My question is how to handle the receipt - do I use the STRING handler in a DATA_EVENT on the receiver? Or should it be handled in a different way?
    If you do a SEND_COMMAND to a device (virtual or real) then the message gets handled in the COMMAND handler of the DATA_EVENT of said device. If you do a SEND_STRING to a device (virtual or real) then the message gets handled in the STRING handler of the DATA_EVENT of said device. If said device is defined in multiple systems then all will receive the COMMAND or STRING.

    If you want to set up a two way conversation without stepping on toes one of the standard methods is to have one side SEND_COMMANDs to the other side and the other SEND_STRINGs to the first side. So you would have something like this:
    System 1 vdv		System 2 vdv
    Tranmit SEND_COMMANDs	Receive SEND_COMMANDs
    Receive SEND_STRINGs	Transmit SEND_STRINGs
    

    Welcome to the forum.
  • a_riot42a_riot42 Posts: 1,624
    Joe Hebert wrote: »
    Is it possible you were using a port, channel, or level that?s greater than the default values?

    All that was ok, as I confirmed that is it was a m2m issue by attaching the device to the second master and feedback worked fine. Attached to the first master I got none. IIRC I believe the issue was related to the virtual number and I had accidentally used a virtual device number in the 31000-32000 range rather than the above 32,768 as the docs say to use. The only side effect was the feedback in m2m. This was years ago so perhaps new firmware has changed this.
    Paul
Sign In or Register to comment.