468,512 Members | 1,423 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 468,512 developers. It's quick & easy.

Communicating to a serial device using Dev-C++

I would like to play with an older GPS unit that has a serial interface. I am using XP and Dev-C++. I have some console based experience in C, but no windows experience to speak of. To remedy that, I would like to write a windows app that will simply monitor the output of the GPS, and send commands to the GPS interactively from a text box.

My questions:
Is Dev-C++ suitable to the task?
Is the "win32" library used, or is there a specific library to use to specify a com port?
In either case, is there a good reference (preferably free) for the proper library?

Thanks,
David
Mar 8 '08 #1
2 7709
Banfa
9,056 Expert Mod 8TB
Serial port access is part of the standard WIN32 API, you don't need any additional libraries and youcan findmost of what you need on MSDN.

Look up the functions

CloseHandle Closes an open object handle.
CreateFile Creates or opens a file, directory, physical disk, volume, console buffer, tape drive, communications resource, mailslot, or named pipe.
ReadFile Reads data from a file, starting at the position that is indicated by a file pointer. This function can operate synchronously and asynchronously.
WriteFile Writes data to a file at a position that a file pointer specifies. This function can operate synchronously and asynchronously.

And optionally
ReadFileEx Reads data from a file asynchronously.
ReadFileScatter Reads data from a file and stores it in an array of buffers.
WriteFileEx Writes data to a file. This function reports the completion status asynchronously by calling a specified completion routine when writing is completed or canceled and when the calling thread is in an alertable wait state.
WriteFileGather Retrieves data from an array of buffers, and then writes the data to a file.

from MSDN File Management functions, yes I know they are called file management functions and you want to use a serial port but in true MS fashion they are poorly named and in fact access any handle with a data stream type.

Additionally you will want to look up the specific com port functions available as Communication Functions.

And here is the overview URL Communications Resources
Mar 8 '08 #2
... MSDN File Management functions, yes I know they are called file management functions and you want to use a serial port but in true MS fashion they are poorly named and in fact access any handle with a data stream type.

Additionally you will want to look up the specific com port functions available as Communication Functions.

And here is the overview URL Communications Resources
Thanks, this is exactly the help I needed, I was not aware there were online Win32 API references. I have been in the embedded community for too long!

David
Mar 10 '08 #3

Post your reply

Sign in to post your reply or Sign up for a free account.

Similar topics

3 posts views Thread by Hema Malini Rajanthiran | last post: by
6 posts views Thread by dev | last post: by
2 posts views Thread by rsr | last post: by
4 posts views Thread by Eran.Yasso | last post: by
1 post views Thread by fmendoza | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.