Home AMX User Forum AMX General Discussion

Module or 232 implementation?

Hi Folks,

New to AMX programming, but not new to programming in general. Anyway, I'm starting coding on a system that controls a pair of Key Digital 4x1 switchers. I'm using the AMX module, and so far it's worked pretty well ... with one exception. I can't figure out a way to do error checking on whether the KD is connected to or online on the port. I've put some test variables in code, and the DATA_EVENT online: gets triggered upon startup, even if if there is nothing connected to the port. The offline: never gets triggered, whether it starts out disconnecter or if I actually powerdown or unplug the switcher from the port.

I'm new to 232, so am I just not thinking about this correctly? If I send-command to a port that has nothing attached to it, I get no RX response, so no data event to check. I'm thinking about this the same way I'd check any database call for a bad return code in a business application.

If I'm failing to explain this clearly or to the right level of detail, please let me know. Thanks in advance for your help!

Dan

Comments

  • RS-232 Implementation

    I took a quick look at the owners manual for the 4X1 HDMI switch.
    The only feedback I see is a query for status which prints the IO status.
    This feedback comes from sending the ascii "s" query. This print is almost certainly ascii characters.

    When the serial port comes online send the string "P1" to the switcher. This will assure that the switcher is on. Insert a WAIT then send the string "s". This will send back the IO status. You can then decide what you would like to do with the incoming string under the STRING: event handler of the DATA_EVENT. You can parse it or simply look to see if you received data to know you are connected.
  • Joe HebertJoe Hebert Posts: 2,159
    DanRessler wrote:
    I've put some test variables in code, and the DATA_EVENT online: gets triggered upon startup, even if if there is nothing connected to the port. The offline: never gets triggered, whether it starts out disconnecter or if I actually powerdown or unplug the switcher from the port.
    The ONLINE event for an RS-232 port only indicates that the RS-232 port is ONLINE and available for use. It has nothing to do with any external device connections. You will have to write code to query the external device (if that device responds to queries) to determine if the external device is connected. I don?t believe you will ever see an OFFLINE event for an RS-232 port.
    DanRessler wrote:
    If I send-command to a port that has nothing attached to it, I get no RX response, so no data event to check.
    SEND_COMMAND is used to configure the RS-232 port (baud rate, flow control, etc.) If you want to send data out the RS-232 port to your external device you will need to use SEND_STRING.

    HTH
  • Thanks, guys. I was using send_command with the NetLinx module for the KDS4. The query to the switcher works in that it tells me when it has nothing connected to it. What I'm trying to do is to see if the switcher itself is online. If I understand your suggestions, is the best way to do that to check the data_event to see if I have any responses? I will eventually have twin switchers managing three or four inputs each. In that case, I would have to check to see if I got two responses (from the data.text after the online: event) to know that both switchers are online?

    If that's the way, then I should be able to set up an initialization check to make sure I have everything. Then I can check through the switchers to make sure that they have everything. Sorry if this is circular ... long day!

    Dan
  • DanRessler wrote:
    In that case, I would have to check to see if I got two responses (from the data.text after the online: event) to know that both switchers are online?
    Dan

    ... or, I could set up a buffer for both and check each individual buffer.
  • Joe HebertJoe Hebert Posts: 2,159
    DanRessler wrote:
    If I understand your suggestions, is the best way to do that to check the data_event to see if I have any responses?... I would have to check to see if I got two responses (from the data.text after the online: event) to know that both switchers are online?
    That would be one way to do it. (as Kaptain Kaos wrote, you would read DATA.TEXT in the STRING: handler of the DATA_EVENT for the RS-232 port) The ONLINE event for an RS-232 port will only fire once at startup.
    DanRessler wrote:
    ... or, I could set up a buffer for both and check each individual buffer.
    That would be the other way to do it.

    Have fun.
  • Thanks, guys! I really appreciate the help ... although it still feels like I should be able to say "Hey Port, is anything connected to you?"! :)
  • Spire_JeffSpire_Jeff Posts: 1,917
    Just a little bit of a heads up. If you are using a duet module from AMX for the device, you will have to do things a little different. The duet module seems to intercept string events from the device and you will never see any string events on the actual netlinx device. The good news is that most (if not all) duet modules have a channel setup to provide feedback that indicates communication with the attached device (basically exactly what you want). You can also enable PASSBACK in most duet modules that will give you the data being received from the device as commands in the virtual device.

    Jeff
  • Joe HebertJoe Hebert Posts: 2,159
    Spire_Jeff wrote:
    The duet module seems to intercept string events from the device and you will never see any string events on the actual netlinx device.
    Ouch. Do you know if you can view strings to/from via Notifications when using DUET modules? Just curious.
  • Spire_JeffSpire_Jeff Posts: 1,917
    I believe you can see them in diagnostics. If you have PASSBACK enabled tho, you can definately see them info on the virtual device.

    Jeff
  • Guys - I've been remiss. Should have let you know that I got this working through a combination of the suggestions you both made. Many thanks. Now, as to the Pansonic panels, well, they can be plain old stubborn ...

    Dan
Sign In or Register to comment.