Board index » cppbuilder » RS232 project

RS232 project


2004-02-05 06:25:32 PM
cppbuilder25
Hi!
I try to figure out how to use C++ Builder for 1 month but still I have no
idea on how do to an interfacing on rs232. On my project, I suppose to feed
for example 5V to the RS232. The GUI I must create must be able to capture
the 5V and if I cut off the 5V supply, the GUI should detect it and shutdown
the PC safely. My questions are:-
1. Which pin on the RS232 should I feed the 5V?
2. How do I write the GUI program to detect the 5V?
3. How can I see the 5V drop?
I hope someone can help me on this. I'm desperately need some guide.
Examples of program will be gladly aprreciated. I have the regular PC to PC
rs232 interfacing GUI but I don't know how to modify it. Thanks!!
 
 

Re:RS232 project

"Wilson Entalai" < XXXX@XXXXX.COM >wrote:
Quote
I try to figure out how to use C++ Builder for 1 month but still I have no
idea
Only? It took much longer to me.....
Quote

1. Which pin on the RS232 should I feed the 5V?
2. How do I write the GUI program to detect the 5V?
3. How can I see the 5V drop?

Well, having said that the RS232 is not a voltage meterer, there are several
control lines you might use, such as DTE-DCE, RTS-??? etc.
They are on pin 4-5 and 6-20 on the 25 pin connector. These lines can be
checked once you have opened your port as port status flags (in some
structure, can't remember which one)
Search for COMSTAT and/or DCB in the SDK Help (best type COMSTAT on your
source put the cursor on in and hit F1. Important: help must be closed when
you do it ). Then follow the links to the other pages of comport related
help pages.
That allows you to interact with the comport, to write a GUI to display the
result is another, broader topic. The simplest would be to add a timer to
your form and to use the OnTimer event to check the port's status. More
powerfull is a separate thread for the port,
 

Re:RS232 project

First of all, the rs232 specification decides that the valid voltage
are -12V and +12V. But many motherboards allow 0V for -12V and +5V for +12V
but not all (specialy the old ones) !!!
The 0V 5V compliance is only a recommandation.
Maybe you will have to use small integrated circuits like MAX 232 or MAX
3314 (they are able to convert the voltage without the 12V reference) to
make the voltage compatible with the standards.
To access directly the pin state is forbidden in Windows 2k/XP. You may use
some api like OpenFile wich can open a port.
Florent.
"Wilson Entalai" < XXXX@XXXXX.COM >a écrit dans le message de
Quote
Hi!
I try to figure out how to use C++ Builder for 1 month but still I have no
idea on how do to an interfacing on rs232. On my project, I suppose to
feed
for example 5V to the RS232. The GUI I must create must be able to capture
the 5V and if I cut off the 5V supply, the GUI should detect it and
shutdown
the PC safely. My questions are:-

1. Which pin on the RS232 should I feed the 5V?
2. How do I write the GUI program to detect the 5V?
3. How can I see the 5V drop?

I hope someone can help me on this. I'm desperately need some guide.
Examples of program will be gladly aprreciated. I have the regular PC to
PC
rs232 interfacing GUI but I don't know how to modify it. Thanks!!


 

{smallsort}