Solved

RTS Signal in Serial Ports using Win32

Posted on 1998-11-11
4
759 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article shows a few slightly more advanced techniques for Windows 7 gadget programming, including how to save and restore user settings for your gadget and how to populate the "details" panel that is displayed in the Windows 7 gadget gallery.  …
This article shows how to make a Windows 7 gadget that extends its U/I with a flyout panel -- a window that pops out next to the gadget.  The example gadget shows several additional techniques:  How to automatically resize a gadget or flyout panel t…
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…
Edureka is one of the fastest growing and most effective online learning sites.  We are here to help you succeed.

911 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

21 Experts available now in Live!

Get 1:1 Help Now