Home AMX User Forum AMX General Discussion

Global Cache AMX Module Issues

I am doing a job right now with a Global Cache GC-100-12 and AMX. However I am on the verge of hanging myself from the clients AV rack.

I am unable to issue RS232 commands to it (on either serial port). I have read the documentation of both the Module and the GC API but still have gotten nowhere. I understand the ports, address, etc but still nothing is happening. I am believing that the module is not able to communicate with the current firmware of the GC.

I was wondering if anyone has not used the module and used TCP to communicate with the GC. I am not looking for Bidirectional RS232 just oneway.

If anyone has done it with TCP via an AMX master could you please share how you implemented it.

EDIT: Forgot to mention that when I use the iTest utility by GC I have no problems at all sending commands.

Comments

  • champchamp Posts: 261
    I have controlled devices through them them but didn't use modules.
    Set the baud rate in the GC web page then open TCP port 4999 from your program and send commands, that is all you need to do.

    To debug the unit short pins 2 and 3 on the RS232 side of the GC then use PuTTy to telnet into the unit on port 4999 and type anything, if you see an echo of what you type then the GC is working fine.
    I've had a few dud ones, replace them quick and don't waste time on them.
  • Hi Champ,

    Thanks for that. I have one quick question. How do you open a TCP connection in Netlinx. I have never ventured that far yet (still a serial fan :) ).
  • champchamp Posts: 261
    TCP is easier than you'd think.
    Here's some basic code, the big difference is you can't send strings until a connection is made so I use a stack. The example stack only holds a single command to keep it simple for this example.
    PROGRAM_NAME='Example IP'
    DEFINE_DEVICE
    dvIP = 0:2:0
    dvTP = 10001:1:0
    
    DEFINE_CONSTANT
    INCLUDE 'SNAPI'
    
    DEFINE_VARIABLE
    CHAR strIpAddress[16] = '10.0.1.100';
    INTEGER nIpPort = 23;
    INTEGER nIpConneted = 0; // 0 = disconnected, 1 = connected.
    CHAR strIpStack[50];
    
    DEFINE_FUNCTION PopStack(){
    	IF(LENGTH_STRING(strIpStack))
    		SEND_STRING dvIP, strIpStack
    	strIpStack = '';
    }
    
    DEFINE_FUNCTION PushStack(CHAR sCmd[]){
    	strIpStack = sCmd;
    }
    
    DEFINE_FUNCTION ConnectIP(){
    	IP_CLIENT_OPEN(dvIp.PORT, strIpAddress, nIpPort, IP_TCP); // this is the main connection command
    }
    
    DEFINE_FUNCTION SendCommand(CHAR sCmd[]){
    	IF(nIpConneted)
    		SEND_STRING dvIP, sCmd
    	ELSE {
    		PushStack(sCmd);
    		ConnectIP();
    	}
    }
    
    DEFINE_EVENT
    BUTTON_EVENT[dvTP, 1]{
    	PUSH: SendCommand("'PON',$0D");
    }
    
    DATA_EVENT[dvIP] {
    	STRING: {
    	}
      ONLINE :{
    		nIpConneted = 1;
    		PopStack();
    	}
      OFFLINE:{
    		nIpConneted = 0;
    		ConnectIp();		
    	}
      ONERROR : {
    		nIpConneted = 0;
      }
    }
    
  • Thanks Champ. I got it working. TCP is really easy as I just learnt :)
Sign In or Register to comment.