Home AMX User Forum AMX Technical Discussion

Send_string 0,

Can any one explain the use of SEND_STRING 0, ?xxxxx?
What the situation to use this?????

Comments

  • Binu wrote:
    Can any one explain the use of SEND_STRING 0, ?xxxxx?
    What the situation to use this?????

    Usage of this is mostly for debugging.
    a SEND_STRING 0,"'Hello World',13,10" will output the 'Hello World' to programming port, so you can view it with RS232 Terminal or Telnet.

    To see that SEND_STRING 0,".." you have to enable message output by terminal command:
    MSG ON<enter> -> turns on master runtime messages and the SEND_STRING 0 thing
    MSG ON 2<enter> -> no master runtime messages but SEND_STRING 0

    Hope this helps,
  • DHawthorneDHawthorne Posts: 4,584
    This is an extemely handy debugging tool, and I use it extensively. Often, I'll link it to a virtual device channel, so I can turn it on and off at will. I will often go as far as to create a Telnet interface to make it easier to check on a remote system that will report what the system is doing. I will generally echo whatever I send to or recieve from a serial port to this as well (again, tied to a channel or variable to turn it off when I'm not debugging), so I can see if devices are doing as expected. Here's a little snippet from a Telent session using send_string 0 on a system attached to an InFocus projector:
    send command 33001, "'debug=1'"
    >(0000119560) Received projector command: DEBUG=1
    (0000129791) Sending to projector: (PWR?)
    (0000129926) Received from projector: (PWR?)
    (0000129933) Received from projector: (0-1,1)
    (0000129934) Power Data: 1)
    (0000134791) Sending to projector: (ARZ?)
    (0000134933) Received from projector: (ARZ?)
    (0000134940) Received from projector: (0-2,0)
    (0000134942) Aspect Data: 0)
    (0000137794) Sending to projector: (LMP?)
    (0000137931) Received from projector: (LMP?)
    (0000137938) Received from projector: (0-32766,94)
    (0000137940) Lamp Data: 94)
    As you can see, I can tell what commands I have sent to the projector, how the module actually sent it, and what the response was. If you interperse your main code with little notifications that identify what actions are taking place (like "Boardroom panel requested projector One to Computer Two input"), it can be very helpful figuring out what went wrong if anything does ... especially if you are logging on to the system remotely and can't actualy see what is happening.
  • GSLogicGSLogic Posts: 562
    I like to create a function that I send all my debug info to which also includes the __LINE__ info, this can be very useful if you start using a lot of debugs.
    DEFINE_FUNCTION fnDEBUG(CHAR MSG[], INTEGER nLINE)
    {
      SEND_STRING 0, "'DEBUG MSG: ', MSG, ' -- LINE:', ITOA(nLINE)"; 
    }
    
    
    
    fnDEBUG("ITOA(nCMD)", __LINE__);
    
Sign In or Register to comment.