Home AMX User Forum NetLinx Studio

Two NI 700, One TP

I have a system with two NI 700's and one TP. These are connected over IP. On a button push I need to be able to to send strings to the 232 port's of both the masters, like power on of plasma's, make a route on a switch, control a xap etc. Any idea's on how to do this.

Comments

  • Jeff BJeff B Posts: 37
    I would use a dev array.
    DEFINE_DEVICE
    
    dvDEVICE_1	=	5001:1:1	// Serial device on system 1
    dvDEVICE_2	=	5001:1:2	// Serial device on system 2
    
    dvTP		=	10001:1:0	// Touch panel on system with the program
    
    
    DEFINE_VARIABLE
    
    // this is the dev array
    DEV dvDEVICE[]={dvDEVICE_1,dvDEVICE_2}
    
    
    DEFINE_EVENT
    
    BUTTON_EVENT[dvTP,1]
        {
        PUSH:
    	{
            // This will send the string to both serial ports
    	SEND_STRING dvDEVICE, "'STRING TO SEND TO BOTH'"
    	}
        }
    
    

    JB
  • AMXJeffAMXJeff Posts: 450
    You also have to remember to set the masters up in master to master mode. It is obvious with Jeff's code below, but wanted to make sure you knew that...
    Jeff B wrote:
    I would use a dev array.
    DEFINE_DEVICE
    
    dvDEVICE_1	=	5001:1:1	// Serial device on system 1
    dvDEVICE_2	=	5001:1:2	// Serial device on system 2
    
    dvTP		=	10001:1:0	// Touch panel on system with the program
    
    
    DEFINE_VARIABLE
    
    // this is the dev array
    DEV dvDEVICE[]={dvDEVICE_1,dvDEVICE_2}
    
    
    DEFINE_EVENT
    
    BUTTON_EVENT[dvTP,1]
        {
        PUSH:
    	{
            // This will send the string to both serial ports
    	SEND_STRING dvDEVICE, "'STRING TO SEND TO BOTH'"
    	}
        }
    
    

    JB
  • Jeff BJeff B Posts: 37
    This code would allow for sending a serial string to each device individually.
    DEFINE_DEVICE
    
    dvDEVICE_1	=	5001:1:1	// Serial device on system 1
    dvDEVICE_2	=	5001:1:2	// Serial device on system 2
    
    dvTP		=	10001:1:0	// Touch panel on system with the program
    
    
    DEFINE_VARIABLE
    
    
    DEV dvDEVICE[]={dvDEVICE_1,dvDEVICE_2}
    
    INTEGER nBUTTON_ARRAY[]={2,3}
    
    DEFINE_EVENT
    
    BUTTON_EVENT[dvTP,nBUTTON_ARRAY]
        {
        PUSH:
    	{
            STACK_VAR INTEGER nBtnIdx
    	// select system to send serial string too
            nBtnIdx = GET_LAST(nBUTTON_ARRAY)
    
    	// Send to serial device on selected system only
    	SEND_STRING dvDEVICE[nBtnIdx], "'STRING TO SEND'"
    	}
        }
    
    
    

    JB
  • Master to master mode

    Thanks for the help, only one other question
    How do you configure the masters for master to master mode?
  • Jeff BJeff B Posts: 37
    To set master to master mode:

    Give each master a unique IP and system number. See tech note #348

    In the URL list for one master, add the IP for the other master. See tech note #401

    Done.

    JB
  • Thanks

    Thanks for the help.
Sign In or Register to comment.