RSS Forums RSS
Please support our C++ advertiser: Programming Forums
Views: 420 | Replies: 3 | Thread Tools  Display Modes
Reply
Join Date: Oct 2008
Posts: 1
Reputation: hugoboss911 is an unknown quantity at this point 
Rep Power: 0
Solved Threads: 0
hugoboss911 hugoboss911 is offline Offline
Newbie Poster

Write from CPP program to serial port

  #1  
Oct 22nd, 2008
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.
Last edited by hugoboss911 : Oct 22nd, 2008 at 7:26 am.
AddThis Social Bookmark Button
Reply With Quote  
Join Date: Aug 2005
Location: near St Louis, Missouri, USA
Posts: 11,861
Reputation: Ancient Dragon has much to be proud of Ancient Dragon has much to be proud of Ancient Dragon has much to be proud of Ancient Dragon has much to be proud of Ancient Dragon has much to be proud of Ancient Dragon has much to be proud of Ancient Dragon has much to be proud of Ancient Dragon has much to be proud of Ancient Dragon has much to be proud of Ancient Dragon has much to be proud of 
Rep Power: 40
Solved Threads: 1012
Moderator
Featured Poster
Ancient Dragon's Avatar
Ancient Dragon Ancient Dragon is offline Offline
Most Valuable Poster

Re: Write from CPP program to serial port

  #2  
Oct 22nd, 2008
you need to use the win32 api communications functions
<<Hire Programmer>> << Hobby Site>>
Signature links for sale. PM me for details
Reply With Quote  
Join Date: Dec 2005
Posts: 4,215
Reputation: Salem has much to be proud of Salem has much to be proud of Salem has much to be proud of Salem has much to be proud of Salem has much to be proud of Salem has much to be proud of Salem has much to be proud of Salem has much to be proud of Salem has much to be proud of Salem has much to be proud of 
Rep Power: 26
Solved Threads: 493
Colleague
Salem's Avatar
Salem Salem is offline Offline
Industrious Poster

Re: Write from CPP program to serial port

  #3  
Oct 22nd, 2008
> 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.
If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
Reply With Quote  
Join Date: Apr 2008
Posts: 452
Reputation: Freaky_Chris has a spectacular aura about Freaky_Chris has a spectacular aura about Freaky_Chris has a spectacular aura about 
Rep Power: 3
Solved Threads: 64
Freaky_Chris's Avatar
Freaky_Chris Freaky_Chris is offline Offline
Posting Pro in Training

Re: Write from CPP program to serial port

  #4  
Oct 22nd, 2008
Originally Posted by Salem View Post
> 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
Reply With Quote  
Reply

Only community members can participate in forum threads. You must register or log in to contribute.



Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)

 

Thread Tools Display Modes
Forums | Blogs | Tutorials | Code Snippets | Whitepapers | RSS Feeds | Advertising
All times are GMT -4. The time now is 9:26 pm.
Newsletter Archive - Sitemap - Privacy Statement - Acceptable Use Policy - Contact Us
Forum system based on vBulletin Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC