Home AMX User Forum NetLinx Studio
Options

few design/tech questions

Hi all

I am new to AMX , and I have few design/tech question.
I am apologizing about my basic knowledge, I have to learn all from mauals and this forum so please forgive me :)

1. how can I control an IP device with a propriety protocol? is there any IP modlue that I can use?

2. how can I make channels event (buttons push) independent for every page I create in TPD4?
I want the channels in each page to start from 1. is there any way to do it?
and what if I am using more than 4000 buttons in a TP? how can I create more than 4000 buttons in one TP?
I don't fully undestand how to use address port and address code in my program code...

3. if I have to programm a house with 10 controllers. can I create 1 system that holds all the cotrollers? or should I design the home with 10 different systems that talkes together with MVM ( I undestand there is a way to communicate from master to master)
I mean system have one master but more than one controller?

4. can someone please give a code example of a project? I don't have an example of a complex system, all basic modlues.

thanks very much for any info!

Ady.

Comments

  • Options
    vincenvincen Posts: 526
    adys wrote:
    1. how can I control an IP device with a propriety protocol? is there any IP modlue that I can use?

    IP control is nearly the same as RS-232 control. You need to get protocol of equipment you want to control, you setup IP connection to remote device and then you send/receive strings ;)
    adys wrote:
    2. how can I make channels event (buttons push) independent for every page I create in TPD4?
    I want the channels in each page to start from 1. is there any way to do it?
    and what if I am using more than 4000 buttons in a TP? how can I create more than 4000 buttons in one TP?

    You can start from channel 1 on each page if you use a different port for buttons on each page ;) and then you declare a new device for each port used on panel in your program, but it's not the best way to do in my idea. It's better I think myself to use one port on panel for each device controlled ;)
    adys wrote:
    3. if I have to programm a house with 10 controllers. can I create 1 system that holds all the cotrollers? or should I design the home with 10 different systems that talkes together with MVM ( I undestand there is a way to communicate from master to master)
    I mean system have one master but more than one controller?

    Through intermaster you have easy choice, either one program in one controller that controls everything but it means very large program with numerous modules and one point of failure, or one program in each controler that interacts through intermaster so if one controler fails you get only a part of system out of service but you need to be more strict on programmation as you'll need to handle more than one program ;)
    adys wrote:
    4. can someone please give a code example of a project? I don't have an example of a complex system, all basic modlues.

    You can find here some piece of codes made by people for control of equipment, it should help you ;)

    Vinc
  • Options
    Spire_JeffSpire_Jeff Posts: 1,917
    vincen wrote:
    You can start from channel 1 on each page if you use a different port for buttons on each page ;) and then you declare a new device for each port used on panel in your program, but it's not the best way to do in my idea. It's better I think myself to use one port on panel for each device controlled ;)

    You have to be careful tho, because you only have 100 ports allowed on a G4 touchpanel:
    G4 panels, which can have 4000 channels per port, 600 levels per port, and 100 ports.

    Altho, unless you are trying to display the status of every single light bulb, every security sensor, and all equipment status on an entire college campus, it seems you should be able to make everything work without a problem. I can say that I have never seen and I can only think of a couple situations that would require the number of buttons you are qorried about. (Think about the old days when programmers only had 1024 channels total on an entire panel and made it work... and each device had a limit of 256 channels. )

    Programming can solve most of your channel concerns with relative ease. By simply tracking the current page, you could use the same port and channels numbers on all pages. Then, when handling the button pushes (or feedback) you use Select...Active or Switch...Case logic to do the appropriate thing.

    I often find that a combination of multiple ports and Switch..Case or Select..Active logic is necessary in my jobs.

    Jeff

    P.S.
    The people of the forum might be better able to help if you give us an idea of what you are trying to accomplish as there are many ways to skin a cat and often the best way(s) depend(s) on the situation. If you are just trying to learn, I find it helps me to develop a hypothetical job with specific requirements.
  • Options
    adysadys Posts: 395
    Hi Vinc?n
    Thanks a lot for your answers! :)
    vincen wrote:
    IP control is nearly the same as RS-232 control. You need to get protocol of equipment you want to control, you setup IP connection to remote device and then you send/receive strings ;)

    I see, I will look for examples
    vincen wrote:
    You can start from channel 1 on each page if you use a different port for buttons on each page ;) and then you declare a new device for each port used on panel in your program, but it's not the best way to do in my idea. It's better I think myself to use one port on panel for each device controlled ;)

    thats what I don't fully undestand. how in my code I treat the button evens listening according to the address ports? I know how to listen to buttons events but no port is coming from the event beside chanel number...
    vincen wrote:
    Through intermaster you have easy choice, either one program in one controller that controls everything but it means very large program with numerous modules and one point of failure, or one program in each controler that interacts through intermaster so if one controler fails you get only a part of system out of service but you need to be more strict on programmation as you'll need to handle more than one program ;)

    yes I think the same, that mean I have to control devices from other masters?

    let me see if I undestand right:

    I will have ond controller in every system - no more than one controller?
    and to control devices taht connected to controller A from TP that connected to controller B I will have to send command to the from A to B, so A must know B.

    thats mean that A must know ALL the controllers that will send him commands to his devices?
    and how about channels? to get statuses of device changes (RS232 etc) ?
    vincen wrote:
    You can find here some piece of codes made by people for control of equipment, it should help you ;)

    you are right, just wanted to see a complex house approach and not small smples, I will happy if someone can direct me to a good sample at the forum.


    thanks again for all

    Ady.
  • Options
    adysadys Posts: 395
    Spire_Jeff wrote:
    You have to be careful tho, because you only have 100 ports allowed on a G4 touchpanel:



    Altho, unless you are trying to display the status of every single light bulb, every security sensor, and all equipment status on an entire college campus, it seems you should be able to make everything work without a problem. I can say that I have never seen and I can only think of a couple situations that would require the number of buttons you are qorried about. (Think about the old days when programmers only had 1024 channels total on an entire panel and made it work... and each device had a limit of 256 channels. )
    The house i am working on is HUGE and lots and lots of equimpment...
    150 devices on 15 Thoutpanels, media server, audio matrix etc etc...
    Many many rooms - a lot of screen and configuration.

    its a huge project.

    I agree 4000 is good enhough, but I want every page to start from 1 - its much much easyer to program this way.. I just don't get how to do it.
    Spire_Jeff wrote:
    Programming can solve most of your channel concerns with relative ease. By simply tracking the current page, you could use the same port and channels numbers on all pages. Then, when handling the button pushes (or feedback) you use Select...Active or Switch...Case logic to do the appropriate thing.

    I often find that a combination of multiple ports and Switch..Case or Select..Active logic is necessary in my jobs.

    Can you please expand a little on how to implement it?
    how to do it or just what I need to read ?


    thanks
  • Options
    GSLogicGSLogic Posts: 562
    The key is to use button arrays, when doing so you don't even think about the button numbers.
    They can be 189,190,191,192 and in the BUTTON_EVENT all you'll have to think about is 1,2,3,4.

    EXAMPLE:
    DEFINE_CONSTANT
      integer btMenu[] = { 189,190,191,192 };
    
    
    BUTTON_EVENT[dPanel,btMenu]					
    {
      PUSH:
      {
        stack_var integer nPNL integer nIDX;
        nPNL = get_last(dPanel);   //this gets which panel as pressed
        nIDX = get_last(btMenu);   //this gets which button was pressed 1-4
    	
        if(nIDX == 1)	
          //do something
        else if(nIDX == 2)
          //do something
      }
    }
    
  • Options
    adysadys Posts: 395
    GSLogic wrote:
    The key is to use button arrays, when doing so you don't even think about the button numbers.
    They can be 189,190,191,192 and in the BUTTON_EVENT all you'll have to think about is 1,2,3,4.

    EXAMPLE:
    DEFINE_CONSTANT
      integer btMenu[] = { 189,190,191,192 };
    
    
    BUTTON_EVENT[dPanel,btMenu]					
    {
      PUSH:
      {
        stack_var integer nPNL integer nIDX;
        nPNL = get_last(dPanel);   //this gets which panel as pressed
        nIDX = get_last(btMenu);   //this gets which button was pressed 1-4
    	
        if(nIDX == 1)	
          //do something
        else if(nIDX == 2)
          //do something
      }
    }
    



    thanks for you reply

    I still need to think about channel numbers is TP4Design...

    lets say I have 2 pages

    page 1 buttons with channels 1- 10
    page 2 buttons with channels 11-20

    now if I have to add a button to the first page he will have 21... not so comfortable for programming in the code later?
  • Options
    viningvining Posts: 4,368
    adys wrote:
    now if I have to add a button to the first page he will have 21... not so comfortable for programming in the code later?
    Your code won't care what page the buttons on. If both pages are on the same port all you'll see in code is a sequential or random listing of buttons in a SELECT_ACTIVE, SWITCH_CASE or possibly a bunch of "IF's" and what page you put what buttons doesn't realy matter from a codes eye view.
  • Options
    Jeff BJeff B Posts: 37
    Grouping buttons by page is one way. I group my buttons by device or function.

    VCR
    buttons 1-X on touch panel Port 1
    DVD
    buttons 1-X on touch panel Port 2

    dvVCR=5001:8:0
    dvDVD=5001:9:0

    dvTP_VCR=10001:1:0
    dvTP_DVD=10001:2:0


    BUTTON_EVENT[dvTP_VCR,0]
    {
    PUSH:
    {
    TO[BUTTON.INPUT]
    TO[dvVCR,BUTTON.INPUT.CHANNEL]
    }
    }


    BUTTON_EVENT[dvTP_DVD,0]
    {
    PUSH:
    {
    TO[BUTTON.INPUT]
    TO[dvDVD,BUTTON.INPUT.CHANNEL]
    }
    }


    In the above example

    BUTTON_EVENT[dvTP_VCR,0]=any button on this touch panel port.
    button number=IR channel number for the VCR.

    This is all the code that is required for an IR VCR and DVD.

    Don't lock yourself into one way.

    JB
  • Options
    Spire_JeffSpire_Jeff Posts: 1,917
    I just thought of a suggestion that I have heard before, but never really tried. Have you tried creating a project in Visual Architect and then looking at the code generated? You won't be able to add multiple processors, but you should be able to get an idea of how the devices are setup and how the touch panels are layed out. You could also use the other Design Xpress offerings, but I have never liked the code generated by those offerings.

    As for using 1-10 for page one and 11-20 for page two, you could always use 1-10 for page 1 and 101-110 for page 2. Or if that is too generous, 51-60. The processor doesn't care what channel numbers are on which page, you just have to use a system that you can keep clear in your head.

    Another suggestion would be to follow the SNAPI channels. (NetLinx Studio>Help>Standard NetLinx API Help) This should in theory make it easier to implement designs by other AMX programmers and new equipment. It also lets you simplify code for IR controlled devices:
    DEFINE_CONSTANT
    INTEGER nIR_BTNS[] = {1,2,3,4,5,6,8,10,11,12,13,14,15,16,17,18,19,44,45,46,47,48,49}
    
    BUTTON_EVENT[dvTP_ARRAY,nIR_BTNS]
    {
      PUSH:
        {
         SEND_COMMAND dvDEVICE,"'SP',BUTTON.INPUT.CHANNEL"
        }
      HOLD[3,REPEAT]:
        {
          SEND_COMMAND dvDEVICE,"'SP',BUTTON.INPUT.CHANNEL"
        }
    }
    

    To use this method, you have to use a different port for each device on the touch panel.

    Jeff
  • Options
    adysadys Posts: 395
    Thanks you all for the kind help :)

    I will check some of the ways that you wrote here and see what work best for me.


    thanks again !


    Ady

    p.s

    I don't have VisualArchitect, is it worth get it?
  • Options
    Spire_JeffSpire_Jeff Posts: 1,917
    adys wrote:
    I don't have VisualArchitect, is it worth get it?

    Well, since it is free, I would say that it is definately worth it. If the documentation that you can produce with it was the only use of the program, I would still consider it worth it. Because you are new to programming, the code that it generates could be very valuable as a learning tool. I just took a look at the code it is generating and I am VERY impressed. 100x better than the mess that Design Xpress use to create :)

    Jeff
Sign In or Register to comment.