Home AMX User Forum NetLinx Studio

How can I feedback the RS-232 response to TouchPanel?

I want to feedback the RS-232 response from the devices (Projector for example). Where should I read the RS-232 response message?

Sample code would help a lot. Thanks

Comments

  • I suggest that you look in the code that I sent you yesterday.
  • adysadys Posts: 395
    DATA_EVENT[dvMLPreAmp] // your rs232 device
    {

    ONLINE:
    {
    SEND_COMMAND dvMLPreAmp,'SET BAUD 38400,E,8,1' // according to your device
    }

    STRING:
    {
    char cLCD_DATA[64];

    cLCD_DATA= DATA.TEXT

    // do what ever you like with the text...


    }
    }
  • You can monitor the response strings from a device using Netlinx Studio. Enable diagnostics and enable notifications. While these are turned on you'll be able to see strings being returned (except if the device returns a $00, then the rest of the string after the 'null' won't show).

    Also, a useful tool is to use commands like SEND_STRING 0, " (*stuff to send to screen here*) ". Outputs from this command will show up in the diagnostics tab. I use it a lot when parsing response strings to make sure I'm getting the expected result.

    EXAMPLES:

    SEND_STRING 0,"'Command Received O.K.;'"
    SEND_STRING 0,"'sRESPONSE_QEUE = ',sRESPONSE"
    SEND_STRING 0,"'SPACKETTYPE =',sPACKET_TYPE"

    DEFINE_EVENT
    DATA_EVENT [dvDEVICE]//RESPONSE STRINGS RECEIVED FROM DEVICE
      {
       STRING:
    	 {
    		stack_var char cur_cmd[18]
    		sRESPONSE_QEUE="sRESPONSE_QEUE,data.text"
    		send_string 0,"'From data event in module for dvDEVICE: sRESPONSE QEUE =', sRESPONSE_QEUE,'  DATA.TEXT = ', data.text"
    	 }
      }
    
    


    --John
  • In re-reading your question, it looks like you're trying to send the device response to the touchpanel. If you're trying to send to the touchpanel, then you'll need to create a button in the touchpanel with an address port and address code. Then you could use a SEND_COMMAND to send the string to the button you created on the touchpanel.

    ex.
    SEND_COMMAND dvTP,"'@TXT',1,'STRING = ', sRESPONSE_STRING"

    --John
  • Or use ^TXT

    Or you can use the ^TXT command (G4 command)

    SEND_COMMAND dvTP, "'^TXT-1,0,RESPONSE STRING = ',sRESPONSE_STRING"

    --John
  • flcusatflcusat Posts: 309
    Not trying to hijack the thread but how could you use the feedback string to condition a particular sequence in a macro? For example send the power command plus the input command if the device is off but only the input if it is on.
  • HedbergHedberg Posts: 671
    something like:
    button_event[dvTP,nSelectInputx]
    {
      push:
      {
        IF(!nPwrStat)
        {
          send_command dvDevice,"'turn it on',13" //if it's not on, turn it on
          nPwrStat = 1 //you can control this parameter with queries and responses if the device supports it
          nWarmed = 0
          wait 300  // wait until the device is ready to handle an input change -- maybe 30 sec for a projector
            {
              nWarmed = 1
            }
        }
        wait_until nWarmed
        {
          send_command dvDevice,"'Select Desired Input',13"
        }
      }
    }
    


    I've not tested the above, but it should give you the idea.
  • flcusatflcusat Posts: 309
    Thanks for the input.
Sign In or Register to comment.