Home AMX User Forum AMX Technical Discussion

is it possible to control the rec. pin on a serial port?

I have this sensor that constantly sends serial data (a short string every 50ms) as long as its receive pin is floating or held high. If the pin is held low it stops sensing (and stops sending data). Right now I have to leave that pin disconnected for the sensor to work.

I want to be able to turn this sensor on and off. Is there a way to get down to that low of a level and toggle that pin?

Comments

  • cwpartridgecwpartridge Posts: 120
    Tie it's receive pin to one side of an extra relay, and the other side of the relay to the gnd of the sensor. When you want to mute it, turn on the relay...and turn off the relay to unmute. You may need to put an series resistor in between the relay and gnd so that you are actually pulling down to ground through a resistor and not making a hard connection to gnd.
  • ericmedleyericmedley Posts: 4,177
    travis wrote: »
    I have this sensor that constantly sends serial data (a short string every 50ms) as long as its receive pin is floating or held high. If the pin is held low it stops sensing (and stops sending data). Right now I have to leave that pin disconnected for the sensor to work.

    I want to be able to turn this sensor on and off. Is there a way to get down to that low of a level and toggle that pin?

    Is this just the CTS or RTS line? If so, perhaps you could just turn that on in the program and connect that pin to the receive.
  • travistravis Posts: 180
    ericmedley wrote: »
    Is this just the CTS or RTS line? If so, perhaps you could just turn that on in the program and connect that pin to the receive.


    So it's possible to control the CTS or RTS pin through the program? Where can I look up how to do it?
  • ericmedleyericmedley Posts: 4,177
    travis wrote: »
    So it's possible to control the CTS or RTS pin through the program? Where can I look up how to do it?

    from the Software History listing for the NXC-Com2


    "'HSON'"
    Enable RTS (ready-to-send) and CTS (clear-to-send) hardware handshaking.

    Syntax:
    SEND_COMMAND <DEV>,"'HSON'"

    Example:
    SEND_COMMAND RS232_1,"'HSON'"
    Enables hardware handshaking on the RS232_1 device.


    "'CTSPSH'"
    Enable Pushes, Releases, and Status information to be reported via channel 255
    using the CTS hardware handshake input. This command turns On (enables) channel
    tracking of the handshaking pins. If Clear To Send (CTS) is set high, then
    channel 255 is On.

    Syntax:
    SEND_COMMAND <DEV>,"'CTSPSH'"

    Example:
    SEND_COMMAND RS232_1,"'CTSPSH'"
    Sets the RS232_1 port to detect changes on the CTS input.

    If you go into NS and go to one of the serial devices for the proper codes you'll need.
  • travistravis Posts: 180
    I just found this:
    "27,20,0"
    Set the RTS hardware handshake's output to high (> 3V).

    Syntax:
    SEND_COMMAND <DEV>,"27,20,0"

    Example:
    SEND_COMMAND RS232_1,"27,20,0"
    Sets the RTS hardware handshake's output to high on the RS232_1 device.

    "27,20,1"
    Set the RTS hardware handshake's output to low/inactive (< 3V).

    Syntax:
    SEND_COMMAND <DEV>,"27,20,1"

    Example:
    SEND_COMMAND RS232_1,"27,20,1"
    Sets the RTS hardware handshake's output to low on the RS232_1 device.

    Now if I can just find a pin tool...
  • travistravis Posts: 180
    Can't figure out why Pin 7(RTS) doesn't go low. Halp!

    DEFINE_DEVICE
    dvSensor = 5001:1:0 
    
    DEFINE_EVENT
    DATA_EVENT [ dvSensor] { 
    	ONLINE: {
    		SEND_COMMAND dvSensor, 'SET BAUD 9600,N,8,1,485 DISABLE'
    		SEND_COMMAND dvSensor, "'HSON'"
    		SEND_COMMAND dvSensor, "27,20,1"
    	}
    
    "27,20,1"
    Set the RTS hardware handshake's output to low/inactive (< 3V).

    Syntax:
    SEND_COMMAND <DEV>,"27,20,1"
  • travistravis Posts: 180
    Am I misunderstanding this documentation? I run the above code, walk over to my NI-700, but a multimeter on pin 7 of Serial Port 1.

    It says 9.3 Volts.

    I even put some code in the mainline to toggle it back and forth

    SEND_COMMAND dvSensor, "27,20,0"
    SEND_COMMAND dvSensor, "27,20,1"
    (with some waits in between)


    but that pin always stays at 9.30V
  • Chip MoodyChip Moody Posts: 727
    If you're going to manually toggle the HWHS pins, I believe you need to use HSOFF - otherwise the OS tries to assert/deassert the pins for you...

    - Chip
  • travistravis Posts: 180
    Chip Moody wrote: »
    If you're going to manually toggle the HWHS pins, I believe you need to use HSOFF - otherwise the OS tries to assert/deassert the pins for you...

    - Chip

    Thanks for responding. I guess that makes sense if you look at it a certain way.

    Do you think I need to do anything the Software Handshaking params XON/XOFF ?

    (still not workinh)
  • travistravis Posts: 180
    YOU NEED TO USE SEND_STRING, NOT SEND_COMMAND


    GAAAAAAAA
  • Chip MoodyChip Moody Posts: 727
    Sounds like you found the answer, at least. :)

    - Chip
  • travistravis Posts: 180
    Yes, eventually...
    Thanks for your help

    By the way, I'm pretty sure the documentation also has the strings backwards.

    27,20,1 is High
    27,20,0 is Low
Sign In or Register to comment.