Solved

RTS Signal in Serial Ports using Win32

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

Creating Instructional Tutorials  

For Any Use & On Any Platform

Contextual Guidance at the moment of need helps your employees/users adopt software o& achieve even the most complex tasks instantly. Boost knowledge retention, software adoption & employee engagement with easy solution.

Question has a verified solution.

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

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…
As more and more people are shifting to the latest .Net frameworks, the windows presentation framework is gaining importance by the day. Many people are now turning to WPF controls to provide a rich user experience. I have been using WPF controls fo…
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…
Add bar graphs to Access queries using Unicode block characters. Graphs appear on every record in the color you want. Give life to numbers. Hopes this gives you ideas on visualizing your data in new ways ~ Create a calculated field in a query: …

635 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