Solved

RTS Signal in Serial Ports using Win32

Posted on 1998-11-11
4
758 Views
Last Modified: 2013-12-03
I have an app. where I have to write some characters
to a serial port upon receipt of the RTS signal from
another computer. I am using the WriteFile() function
to write this file name to my serial port. I am assuming
handling of the RTS is automatically taken care of by
the API (maybe upon CreateFile()?)How do I detect the presence of an RTS signal and then use WriteFile() to write the characters. Thanks.
0
Comment
Question by:mparavas
  • 2
  • 2
4 Comments
 

Author Comment

by:mparavas
ID: 1415993
Edited text of question
0
 
LVL 3

Accepted Solution

by:
stefanr earned 100 total points
ID: 1415994
I am assuming that you are connected to the other computer by a "null-modem" cable, i.e. the RTS of the other computer is connected to the CTS of the computer where application is running (DTR and DSR is also cross-connected). Then when the other computer raises its RTS signal, the CTS signal becomes raised on your computer.
Use WaitCommEvent to check if the CTS have changed. Then use GetCommModemStatus to check the actual value of the CTS signal.
0
 

Author Comment

by:mparavas
ID: 1415995
Thanks for the information. Yes, I am using a NULL modem. Is it
true that when I use the Win32 API, RTS and CTS are always
there, since the assertion is taken care of by the API?
Exactly when/how are they asserted. Is it during CreateFile()? Thanks.
0
 
LVL 3

Expert Comment

by:stefanr
ID: 1415996
No, I don't believe that you can expect that. It seems that the state of the signals depends upon what the previous programs (if any) using the communication port had on them when closing. That previous state is restored when you call CreateFile. You should use GetCommState or BuildCommDCB, followed by SetCommState to set the baud rate, etc., and EscapeCommFunction to set the state of DTR and RTS. To retrieve the status of the signals you use GetCommModemStatus.
0

Featured Post

Why You Should Analyze Threat Actor TTPs

After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

Join & Write a Comment

This article shows how to make a Windows 7 gadget that accepts files dropped from the Windows Explorer.  It also illustrates how to give your gadget a non-rectangular shape and how to add some nifty visual effects to text displayed in a your gadget.…
zlib is a free compression library (a DLL) on which the popular gzip utility is built.  In this article, we'll see how to use the zlib functions to compress and decompress data in memory; that is, without needing to use a temporary file.  We'll be c…
It is a freely distributed piece of software for such tasks as photo retouching, image composition and image authoring. It works on many operating systems, in many languages.
This is Part 3 in a 3-part series on Experts Exchange to discuss error handling in VBA code written for Excel. Part 1 of this series discussed basic error handling code using VBA. http://www.experts-exchange.com/videos/1478/Excel-Error-Handlin…

757 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now