Home AMX User Forum AMXForums Archive Threads Tips and Tricks

Inter-Processor Communication

wirespeedwirespeed Junior MemberPosts: 9
What's the best way for one processor to call a function running on another processor?

The only thing I found in the manuals was Master-to-Master communications which allows one processor to talk with the devices connected to another processor. That's not really what I'm looking for.

Thanks

Comments

  • wirespeed wrote:
    What's the best way for one processor to call a function running on another processor?

    The only thing I found in the manuals was Master-to-Master communications which allows one processor to talk with the devices connected to another processor. That's not really what I'm looking for.

    Thanks

    Unless an AMX engineer jumps in and says different, this is not possible. Both Master will need to contain the desired function. You can easily pass data between Master if need be.

    BTW, this thread was designed for Tips and Tricks on things you can do, not programming questions.
  • wirespeedwirespeed Junior Member Posts: 9
    B_Clements wrote:
    You can easily pass data between Master if need be.

    Can you explain how to do that?
  • Spire_JeffSpire_Jeff Formerly Caffeinated Programmer Posts: 1,917
    I vaguely recall something about converting variables to binary or XML if you need to pass large structures, but to this point I really haven't had a need to pass this much data between masters. Most of my Master to Master communication to this point has been done by simply using the full address. Example:

    Processor 1 (system 1) has the following:

    DEFINE_DEVICE
    dvHVAC = 5001:1:0
    vdvHVAC = 33001:1:0

    dvTP = 10001:1:0
    dvTP_SECURITY_SHACK = 128:1:2

    dvSECURITY = 5001:1:2
    vdvSECURITY = 33101:1:0

    DEFINE_MODULE 'Viewstat422_Comm' modHVAC(dvHVAC, vdvHVAC)
    DEFINE_MODULE 'Security_panel_Comm' modHVAC(dvSECURITY, vdvSECURITY)


    Processor 2 (system 2) has the following:
    dvSECURITY = 5001:1:0

    vdvHVAC = 33001:1:1

    dvTP_SECURITY_SHACK = 128:1:0


    This example has me running both modules from processor 1, but allows me to have an axlink TP and the security panel connected to processor 2.

    You could also use the above idea to create a virtual device on each processor to parse incoming commands that active calls or functions on the local processor.

    Hope this helps,
    Jeff
  • Chip MoodyChip Moody Junior Member Posts: 727
    wirespeed wrote:
    Can you explain how to do that?

    Check out tech note 532. Basically, you define a virtual device to be shared between two (or more) systems. If you have systems numbered 1 and 2, for example, you would declare MTMVDV = 33001:1:0 on system 1, and MTMVDV = 33001:1:1 on system >2<. (Any system number beyond 2 also uses the 33001:1:1 declaration)

    Set up a COMMAND: data event handler for that device on each system, and ANY commands you send to that device (SEND_COMMAND MTMVDV,'Hi From System X') on any system will show up in the event handler for BOTH. (So you'll probably want/need to put some kind of ID in the command to indicate which system the message is for)

    - Chip
  • alexanboalexanbo Junior Member Posts: 282
    Since it's a virtual device I usually use Command to indicate an incoming message and String to send an outgoing message.
  • Chip MoodyChip Moody Junior Member Posts: 727
    alexanbo wrote:
    Since it's a virtual device I usually use Command to indicate an incoming message and String to send an outgoing message.

    That's the right idea when you're writing a module, but if you're talking about getting messages between masters, whatever you're sending out (string or command) is what you're going to get in a DATA_EVENT. There's no module code involved here to process the data...

    - Chip
Sign In or Register to comment.