LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

RS232 RTS control

Hi people,
   I already posted something like this, but not specific, so here I am again! Smiley Sad

   I have 2 PC (1 ps and 1 Fieldpoint, no matter this...), and I make them communicate via 2 modems, base band.

   When I want to send (VISA write) some characters to the other PC, I have to set RTS signal ON (to make a request to send to the modem). Modem answer with a CTS signal, and then I write characters. This works, and the other PC correctly receive data.

    The problem is when I reset RTS (RTS = 0), to deactivate the carrier signal.  Because carrier can't stand on communication line. If carrier is always present, the other PC can't initiate a communication!

    When I put RTS = 0, the second PC receives "framing errors", and print faulty characters.  Why so? Is there another way to do what I'm aiming to do?

    Help will be really appreciated!

graziano
0 Kudos
Message 1 of 5
(4,333 Views)

You can find useful information about Serial port Handshaking modes in this Knowledgebase online. It discusses the use of RTS/CTS and DTR/DSR lines for different purposes.

Also, there is a whole set of documents you can look up for reference:

http://digital.ni.com/public.nsf/websearch/8EC833DA692DFBA286256BA100020214?OpenDocument

http://digital.ni.com/public.nsf/websearch/5C28120783A651FC8625693B00558EA8?OpenDocument

http://digital.ni.com/public.nsf/websearch/1ECEFAA7AD52994986256966005356EA?OpenDocument

http://digital.ni.com/public.nsf/websearch/022A3C75A1F36DFF86256E6200705996?OpenDocument

Hope this helps,

AlessioD

.
0 Kudos
Message 2 of 5
(4,309 Views)
Hi AlessioD,
   thank you for helping me, but all the documents are known to me.  I already toggle RTS line, and wait for CTS signal, as specified by the protocol, but I receive some problems at the end of the transmission.....

    As I said, when I switch off RTS, my modem suppress carrier signal (it is configured to perform like this).  But:
   1) whenm I set RTS=0 some nasty bytes are sent to the other modem (I think because of the carrier queue....)
   2) the carrier is suppressed before all data bytes are sent, so message is truncate.  This because (I suppose) the data transfer between software and RS232 buffer is fast, while from RS232 buffer to modem, it takes a while (9600 bauds).  In this way, whn I perform a VISA write, and after that a RTS=0 command, RTS=0 is actually executed before the serial buffer has sent all bytes "received form software". 

   I would expect a smart rs232 controller to wait to empty data buffer before suppressing carrier, but it is not the case! Sorry, I didn't explained that my modem is configured to suppress carrier when RTS=0.

   If I put a WAIT instruction after VISA write, it works:
     VISA write x bytes ----->   wait 200 ms ----> Property node:RTS=0.

  But it is quite uncomfortable to me to use these delays, also because I cannot set a fixed delay (because the data sent are of variable length).

   I think a solution would be to be able to read in serial port output buffer, to check if it is empty, before setting RTS=0, and carrier suppressed, but I don't know how to do it (I suppose there'll be some simple VI.....).

   Anyway, thanks!

graziano
0 Kudos
Message 3 of 5
(4,303 Views)

Hi Graziano,

 

If you use modem, I think you should not use the handshake signals in your program. These signals are for the handshake between the Uart (in your PC) and the modem.

I think you would be better of if you use a software handshake.

If you are transmitting ascii data you use Xon-Xoff as a handshake.

Another possibility is to use a transfer program like Kermit or make a simple protocol yourself in LV.

0 Kudos
Message 4 of 5
(4,275 Views)
Hi KC, and thanks!
 
    I need hardware handshake signals, because I need to switch off carrier signal in my modem, to let the other modem transmit.  RTS signal switch on carrier signal, so I can send data; to receive data, I have to reset RTS, so local modem doesn't generate the carrier.  At this point, the remote modem is allowed to switch on carrier signal, an send bytes to local modem.

   I hope it's quite clear.....

    Have a nice day!

graziano
0 Kudos
Message 5 of 5
(4,265 Views)