Home AMX User Forum NetLinx Studio

Axcess to netlinx

Previously in axcess programming if you had 6 (number doesn't matter could be any number) identical devices you could use a variable i.e selected_camera, in your code you could them use selected camera = 5 and in your push statement you have

send_string selected_camera,"$01,whatever"

where selected_camera transmitted out on port 5 or whatever port selected_camera =

How do you achieve this in netlinx,

any help greatly apprecited.

Comments

  • The easiest way that i know of is to put the 6 devices in a dev array.
    You then use the index to point to which device to send too.
    define_device
    
    (* RS232 *)
    
    dvCamera1				= 3:1:1			//  Axcent Slave Frame Port 2
    dvCamera2				= 4:1:1			//  Axcent Slave Frame Port 3
                       
    dvCamera3				= 5001:1:1		// NI Port #1
    dvCamera4				= 5001:2:1		//  NI Port #2
    dvCamera5				= 5001:3:1		//  NI Port #3
    dvCamera6				= 5001:4:1		//  NI Port #6
                                                  
    dvTp 						= 10001:1:1
    
    define_variable
    
    volatile dev cameras [] =
    {
    	dvCamera3,
    	dvCamera2,
    	dvCamera1,
    	dvCamera4,
    	dvCamera5,
    	dvCamera6
    }                    
    
    
    volatile integer selectcamera []
    {
    	21,22,23,24,25,26
    }
    
    
    define_event
    
    Button_event[dvtp,selectcameras]
    {
    	push:
    		{
    			stack_var integer k
    			k = get_last (selectcameras)
    			
    			send_string cameras[k], "'DO THIS COMMAND'"
    		}
    }
    
    


    The trick to remember here is everything is based upon what position in the array you put it.

    Hope this helps
  • alanhalanh Posts: 30
    Thanks

    Thanks

    Will give it a try.
Sign In or Register to comment.