Home AMX User Forum NetLinx Studio
Options

RS232 Control

I recently took the AMX Programmer I class. I have a test system consisting of an NI-3000 and Modero 12 Touchpanel. I'm trying to control a Polycom VS4000 through RS-232 control and it's not responding. The only thing I'm trying to do is send the "button up" command to get the menu cursor to move up. Here is what I have.

BUTTON_EVENT [TPANEL,14] //MENU UP BUTTON
{
PUSH:
{
PULSE [RELAY,2]
SEND_STRING VS4000, "'button up',$0A"
}
}

I have VS4000 defined as 5001:2:1. I'm pulsing the relay just to make sure the button event is actually doing something. I can hear the relay and I can see the TX LED on port 2 light up. The only thing I can think of is the baud rate is not set correctly,

My question is do you have to set the baud rate of the port in the your program or can you do that in Netlinx Studio.

I added this in the DEFINE START:

SEND_COMMAND VS4000, 'SET BAUD 9600,N,8,1 485 DISABLE'

However there is still no response from the Polycom.

Comments

  • Options
    Move the SET BAUD command to the ONLINE event of the Polycom
    DATA_EVENT[Polycom]
    {
    ONLINE:
    {
    SEND_COMMAND DATA.DEVICE,"'SET BAUD...
    }
    }
  • Options
    Joe HebertJoe Hebert Posts: 2,159
    Hi undrtkr,

    I believe the command should be:

    SEND_STRING VS4000, "'button up',$0D,$0A"

    It?s recommended to put your baud rate setup under ONLINE in the DATA_EVENT instead of STARTUP like this:

    DATA_EVENT[VS4000]
    {
    ONLINE:
    {
    SEND_COMMAND VS4000, 'SET BAUD 9600,N,8,1 485 DISABLE'
    }
    }

    If adding the CR before the LF doesn?t do the trick then I would try swapping RX and TX (pins 2 and 3) and see if that gets you going.

    Hope this helps.

    Cheers,
    Joe
  • Options
    undrtkr,

    If you don't have it already, you may want to download the VS4000 integrator's guide from the Polycom web site. I tried to attach it to this post, but it is too big and gives a fatal error when I try to post it.

    I also have a couple of suggestions. First, you may want to try communicating with the 4000 using Hyperterm from your PC.

    That gives you a chance to see what kind of information is returned from the system.

    From looking at the integrator guide, it also appears that you need to configure the Polycom to use the serial port. Make sure that all of the settings match what you use with the NI-3000 and Hyperterm. It is important that both flow-control settings match.

    My biggest problem with RS-232 devices is generally the cable. The NI to Polycom cable needs to be a straight-through cable. You can get by with pins 2,3, and 5 connected if you have the flow-control set to None.

    Like someone else suggested, you probably need to send a CR and LF at the end of the command.

    And last, the Polycom 4000 does have a module available from AMX that would keep you from having to do everything from scratch.

    Danny
  • Options
    Originally posted by Danny Campbell
    undrtkr,

    If you don't have it already, you may want to download the VS4000 integrator's guide from the Polycom web site. I tried to attach it to this post, but it is too big and gives a fatal error when I try to post it.

    I also have a couple of suggestions. First, you may want to try communicating with the 4000 using Hyperterm from your PC.

    That gives you a chance to see what kind of information is returned from the system.

    From looking at the integrator guide, it also appears that you need to configure the Polycom to use the serial port. Make sure that all of the settings match what you use with the NI-3000 and Hyperterm. It is important that both flow-control settings match.

    My biggest problem with RS-232 devices is generally the cable. The NI to Polycom cable needs to be a straight-through cable. You can get by with pins 2,3, and 5 connected if you have the flow-control set to None.

    Like someone else suggested, you probably need to send a CR and LF at the end of the command.

    And last, the Polycom 4000 does have a module available from AMX that would keep you from having to do everything from scratch.
    Danny

    I know that the Polycom and cables work because I can control it just fine on our ******** test processor. It's interesting about sending both CR and LF because with ******** I only need to include the LF.

    I'm not at work now so I'll have to try the suggestions Monday. I'll let you know then if it works.

    To Danny, I know that AMX has a module for VS4000 and I've downloaded that but I want to try and control through string commands first so that I can understand that before I tackle the Module .

    Thank you guys for your quick response and I'll let you know if your suggestions work.
  • Options
    i use this command all the time

    SEND_STRING dvVTC,"'button up',$0D"

    maybe the upper case thats messing it up......
  • Options
    Joe HebertJoe Hebert Posts: 2,159
    So we have a vote for just LF and a vote for CR LF and another vote for just CR. :) The reason I suggested both CR LF is because that's what the AMX code block shows.

    undrtkr - It still could be a cable issue. I don't know if the Dark Side serial ports are considered DTE or DCE but if it's opposite of AMX then the existing cable that you are using now would have to be crossed.

    The saga continues...

    Joe
  • Options
    I can't think of a single product (Polycom or otherwise) that responded to a linefeed ONLY. Carriage return only, yes.

    What code were you using on Cre stron to get Polycom commands working over 232? (Or were you using one of their modules?)

    - Chip
  • Options
    Thank you for your help

    I was able to get the string commands to work. I set the baud rate using an online data event and put a CR LF at the end of the string command. Now it's time to tackle the module.
  • Options
    Confusing

    According to Netlinx Studio 2.2 Help:

    SEND_STRING
    This keyword sends a string to a NetLinx device/port. The syntax is:

    SEND_STRING DEV, '<string>'

    I really didn?t understand why you use SEND_STRING DEV, "'string',something..."

    What should I use instead of something that is not written in the software help ???

    Well, it?s 03:45 am and I am still trying to control some equipaments through RS232, but untill now, nothing...
  • Options
    Joe HebertJoe Hebert Posts: 2,159
    Hi andregabriel,

    The syntax you posted as: SEND_STRING DEV, '<string>'
    is correct.

    I?m not quite sure what you mean by the ?something? or what you use instead but I?ll try to answer your question with an example of how to use the command.

    The command is SEND_STRING
    You substitute DEV with the device you want to send the string to.
    You substitute '<string>' with the actual string you want to send.

    Here?s some sample code:
    DEFINE_DEVICE
    
    dvRS232	= 5001:1:0    //first RS-232 port
    dvTP	= 10001:1:0  //a touch panel
    
    DEFINE_VARIABLE
    
    CHAR cString[10]
    
    DEFINE_EVENT
    
    BUTTON_EVENT [dvTP,1]
    {
       PUSH:
       {	
          //this will send [b]hello[/b] out the serial port
          SEND_STRING dvRS232, 'hello'
          
          cString = ' there'  //assigning ' there' to the variable cString
          
          //this will send [b] there[/b] out the serial port
          SEND_STRING dvRS232, cString
          
          //this will send [b]hello there[/b] out the serial port
          SEND_STRING dvRS232, "'hello',cString"
          
       }
    }
    

    Does this help at all?

    Cheers,
    Joe
  • Options
    Yes, it helps.

    Now I understood: when you want to send two strings in the same command you should use:

    SEND_STRING device, "'STRING1','STRING2'"

    Thank you for your post.

    But I?m still having problems. I will start a new thread to discuss it. I will put my code inside it.

    SIncerely,
    Andr
  • Options
    polycom

    Hi andre,

    Are you shure you are using the right commands?
    I never did a vc4000 but i did a 512 and the command for let's say button up is: SEND_STRING device,"'bu up',$0D,$0A"
    be shure that the instruction is lower case.
    With a 512 it's also possible to ask al the commands trought hyperterminal with ? or help.

    Good luck
Sign In or Register to comment.