Home AMX User Forum NetLinx Studio

Adding modules

HI
I've a newbie question

When I'm adding module,ie: matrix module, do I have to copy something in files to paste in my master or when I compile project all doing by itself but I have to adjust TP pointing before?

Comments

  • ericmedleyericmedley Posts: 4,177
    Denis wrote: »
    HI
    I've a newbie question

    When I'm adding module,ie: matrix module, do I have to copy something in files to paste in my master or when I compile project all doing by itself but I have to adjust TP pointing before?

    Well, generally speaking it depends upon how the module is set up. The simplest way would be to add an DEFINE_MODULE statment in your main code. However, the programs differ depending upon who wrote them. There might be more than one module file associated with whatever you're doing, there might be a module and include files, etc...

    The best thing to do is look at the example project file that comes with most modules. It will have all the needed DEFINE_MODULE lines and variable declarations you'll need to run their stuff.
  • DenisDenis Posts: 163
    ouain....

    In the matrix module kit, there is a main file and UI files, it's thoses file as I spoke in my first post
  • ericmedleyericmedley Posts: 4,177
    Denis wrote: »
    ouain....

    In the matrix module kit, there is a main file and UI files, it's thoses file as I spoke in my first post

    Most modules are broken into to two items. 1) the comm or communications module and 2) the UI or User INterface.

    The idea is that the .comm module is responsible for communications to and from the real device and a virtual device created in the program.

    the idea in example:

    device sends '@PWR:1' which means it's power is on.

    the virtual device in your program will send a string

    'POWER=1'

    You watch the virtual device and when it sends the string you deal with it.

    Now if you send a command to the virtual device it will translate your command to the devices way of speaking.

    So, you send ' vdv_Black_Box,' Source=3'

    and the .comm module will interpret your command to the device's language.

    it might be '$00,$03,$0A,$00' or something. depends upon the device.

    Now, you can stop here and make your own user interface. However, quite often the module creator will make an interface for you.

    I almost never use the UI myself. But it is there to be used. The idea is that you load their touch panel file on your TP and all the buttons and text windows and whatnot are already numbered and ready to go. The UI will contain the other side of the equation: how the UI talks to the .comm module.

    That's the theory of it.

    hope that helps.
  • DHawthorneDHawthorne Posts: 4,584
    The "main" file provided with the module is an example program and contains everything needed to install the module. What I generally do is open it up alongside my own main program, then cut and paste the pertinent data. At that point, you can make whatever changes are necessary to resolve conflicts and leave out portions you don't need (like a UI you have reason to implement yourself). If there is a lot of stuff in the example, like functions and event code, I'll turn it into an INCLUDE instead ... but I don't like doing it that way and hate the kinds of modules that require it. It just makes it too difficult to see at a glance what devices and constants and variable names are in use. One thing that stick in my craw about AMX made modules is that they use very generic variable names (like TP_BUTTONS) that could easily conflict with other modules or your main code. So I like to have everything in one spot to edit rather than scattered through many files.
  • DenisDenis Posts: 163
    Tanks a lot !
Sign In or Register to comment.