Solved

RTS Signal in Serial Ports using Win32

Posted on 1998-11-11
4
764 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
MSDN Subscription - Azure and NFP's 3 85
Having Trouble with MS Access 2010 CommandBars 19 116
What .NET URL re-routing tool did I use? 2 92
Graph API & MS Apps 1 82
If you have ever found yourself doing a repetitive action with the mouse and keyboard, and if you have even a little programming experience, there is a good chance that you can use a text editor to whip together a sort of macro to automate the proce…
This article surveys and compares options for encoding and decoding base64 data.  It includes source code in C++ as well as examples of how to use standard Windows API functions for these tasks. We'll look at the algorithms — how encoding and decodi…
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…
Nobody understands Phishing better than an anti-spam company. That’s why we are providing Phishing Awareness Training to our customers. According to a report by Verizon, only 3% of targeted users report malicious emails to management. With compan…

734 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