473,696 Members | 1,458 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Communicating to a serial device using Dev-C++

9 New Member
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 8157
Banfa
9,065 Recognized Expert Moderator Expert
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
dwurmfeld
9 New Member
... 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

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

Similar topics

3
2726
by: Hema Malini Rajanthiran | last post by:
to whom may concern...im final year student doing a project using handphone to create wireless communication. im finding difficulties to get the codes to connect to serial port using c#(visual studio .net 2000)...kindly guide me plz... thank, r.hema malini --
6
2394
by: dev | last post by:
hi i want to know about interfacing or accessing a serial port using c-program please help me with an example thanks for whom who reply me soon
0
2491
by: mzaiady | last post by:
I need to know how to get the monitor, motherboard and other hardware information and serial number using C, i can do it with WMI in windows but it giveme just what installed and defalut, i need to contaact directly with hardware and get those information very soon
0
1057
by: rsr | last post by:
Hi friends, The serial device with whích I am trying to communicate replies in two formats.. ASCII and Binary. And I have created a VC++ project to read the ASCII data from the device, with some classes that revolves around 'ReadFile' command.. I really dont know how to read the data when the device outputs in binary form.. Does this ring any bell for any of u ppl?
1
3010
by: kameswara | last post by:
Hi folks , Can anyone help me out the problem regarding writing and reading data to/from a serial device like ttyS0 in linux . Writing is being done but unable to read from it . could u plea help me out with good stuff or brief explation what i need to do . Remember i need asynchronous read/write opeartion where i m using aio_read and aio_write.
0
1428
by: Shival | last post by:
Hi, I have a Device that will be used by dentist to take their paitient teaath pics. this Device is having a click button from which the device takes pics. The Device is configured to my OS using AMCAP device Driver. I tried capturing the Click event of the Device using WIA 2.0 but using Dim s As String Dim dev As WIA.Device = (New WIA.CommonDialog).ShowSelectDevice For i As Integer = 1 To dev.Events.Count
2
1402
by: rsr | last post by:
Hi friends, I have written a VC++ application that connects with a serial device via a COM port and I specify the port number(thru which the system has to connect) in an INI file or in an edit box. Now I want my application to recognise itself (rather than me giving the number), as to which port my serial device is connected. Is it possible to do this? thanks in advance RSR
4
4602
by: Eran.Yasso | last post by:
Hi all, I am trying to write application which runs on my PC that sends data to an application running on Windows mobile. The problem is that the tcp over activesync doesn't work. The device is not connected to ehternet. Can I send tcp traffic to device using active sync? I sas that the device's IPaddress is 192.168.55.101. I changed my PC IP address to 192.168.55.100 and sent ping but didn't get any ping reply.
3
5320
by: Mary Mah | last post by:
Hi, iam building a system which will send data from website to serial port using PHP, the problem that i want to send bits to the serial port not only data. i wrote a php code to do so but it still give me errors...any help please ?!? CODE: <?php require("php_serial.class.php"); $serial = new phpSerial(); $serial->deviceSet("COM1");
0
8656
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8592
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9141
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9005
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
6512
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5851
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4351
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4605
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
3
1989
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.