Please support our C++ advertiser: Programming Forums
![]() |
•
•
Join Date: Oct 2008
Posts: 1
Reputation:
Rep Power: 0
Solved Threads: 0
Hi all,
im doing a uni project and ive run into a little trouble
im writing a program in cpp (has to be cpp because of other constraints)
this program will get values from a file and depending on the values, send a high or low signal to the corresponding output pin on a serial port
i have done some research, but i cant get a solid answer on how to write from a program to a specific pin on a serial port
all i know is that i have to specify the com port (com1 or com2 etc) and the pin
any help on this would be MUCH appreciated
thanks
EDIT: im using windows xp pro, if that helps.
im doing a uni project and ive run into a little trouble
im writing a program in cpp (has to be cpp because of other constraints)
this program will get values from a file and depending on the values, send a high or low signal to the corresponding output pin on a serial port
i have done some research, but i cant get a solid answer on how to write from a program to a specific pin on a serial port
all i know is that i have to specify the com port (com1 or com2 etc) and the pin
any help on this would be MUCH appreciated
thanks
EDIT: im using windows xp pro, if that helps.
Last edited by hugoboss911 : Oct 22nd, 2008 at 7:26 am.
•
•
Join Date: Aug 2005
Location: near St Louis, Missouri, USA
Posts: 11,861
Reputation:
Rep Power: 40
Solved Threads: 1012
you need to use the win32 api communications functions
> EDIT: im using windows xp pro, if that helps.
But which compiler?
Not some fossil like TurboC by any chance?
> send a high or low signal to the corresponding output pin on a serial port
Er, you do know what a serial port looks like right?
Or even how a serial port works?
http://www.lammertbies.nl/comm/cable/RS-232.html
The only output pins which have a level associated with them are CTS and RTS.
But which compiler?
Not some fossil like TurboC by any chance?
> send a high or low signal to the corresponding output pin on a serial port
Er, you do know what a serial port looks like right?
Or even how a serial port works?
http://www.lammertbies.nl/comm/cable/RS-232.html
The only output pins which have a level associated with them are CTS and RTS.
If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
•
•
•
•
> EDIT: im using windows xp pro, if that helps.
But which compiler?
Not some fossil like TurboC by any chance?
> send a high or low signal to the corresponding output pin on a serial port
Er, you do know what a serial port looks like right?
Or even how a serial port works?
http://www.lammertbies.nl/comm/cable/RS-232.html
The only output pins which have a level associated with them are CTS and RTS.
Why are you providing this information. I can't imagine someone trying to work with serial ports if they don't know the first thing about them.
Thats about as bad as if i was to set out writing a driver program in assembly for a microcontroller to interact with a keyboard. And then not looking at how the keyboard transmitts and recievers data.
That was a fun project btw, i also did it using shift registers aswell as assembly. I'm a bit of an electornics geek too

Chris
Knowledge is power -- But experience is everything
![]() |
Similar Threads
Other Threads in the C++ Forum
- Serial port communication using C++ (C++)
- Error (in program for serial comm in DevCpp) (C++)
- need help convert c++ to vb6 serial port (Visual Basic 4 / 5 / 6)
- The COM Ports are not communicating properly.. (C++)
Other Threads in the C++ Forum
- Previous Thread: How many terms to find p of Pi?
- Next Thread: Reading in new line character from a file.
•
•
•
•
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)






Linear Mode