Home AMX User Forum NetLinx Studio
Options

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

  • Options
    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
  • Options
    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
  • Options
    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
  • Options
    Master to master mode

    Thanks for the help, only one other question
    How do you configure the masters for master to master mode?
  • Options
    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
  • Options
    Thanks

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