View Single Post
  #9   Spotlight this post!  
Unread 21-01-2003, 12:49
Ryan Meador Ryan Meador is offline
Registered User
#0190
Team Role: Electrical
 
Join Date: Jan 2002
Rookie Year: 1999
Location: Worcester, NH
Posts: 68
Ryan Meador will become famous soon enough
I've used my serial port to communicate with my Stamp- and PIC-controlled minions many times. The code in C++ is very easy. It's treated as a file. Just open "COMX" as the file and set a few permissions (where X is the port number)... its all in the MSDN serial communication sample program.

hPort = CreateFile ("COM4", GENERIC_READ | GENERIC_WRITE, 0, NULL, OPEN_EXISTING, 0, NULL);

Then you'll want to look up the DCB structure to set all the cool baud rate, parity, and stop bit options. The COMMTIMEOUTS struct might help you out too. I've got a program that uses my serial port to send data (via my very own cobbled-together RS-232 radio transmitter) to one of my PIC robots. PM me and I'll send you the code.
__________________
-Ryan

"You're not a real programmer until you end all your sentences with semicolons;"