473,883 Members | 1,528 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Serial Port Access in XP

Hi,

I am trying to access Serial Port in XP. I am using Dev-C++ IDE that
uses Mingw as a compiler. I just want to know how I can open up serial
port on COM1 and write some data. I have searched quite a bit over the
web and could not find anything useful. I don't want to use Visual C++
or Cygwin, linux, etc. If any of you guys have some little tid bit of
code that would be great to look at.

Aug 31 '06
38 9681
Keith Thompson wrote:
My goals are to keep this newsgroup as useful as possible for those of
us who want to discuss the C programming language, and to help people
who ask questions here get the best possible answers.
Being that it seems about half of the posts I see on comp lang c are
posts saying that the OP is off topic, I don't see how useful it
actually is. I just think it's a way a couple people have of making
themselves feel big.
Neither goal is served by having detailed discussions of Windows XP in
this newsgroup. There are newsgroups that are dedicated to Windows
programming, and they're full of experts on that subject.
Well gosh golly gee darn it - looks like I ruined your precious ol
newsgroup by providing an answer instead of telling somebody how he is
OT. I'm so terribly sorry.
I did not call anybody's knowledge into question, except to say that
I'm not qualified to judge the solution that was posted. For all I
know, it may be the best possible solution to the OP's problem. But
nobody is perfect. For example, I make mistakes now and then, which
is why I wouldn't feel comfortable posting technical advice in a forum
where there are no experts who can catch my mistakes.
You implied I didn't know what I was talking about by saying he should
look elsewhere for the correct answer. Don't try to act innocent.
I did not criticize the OP; I gave him my best advice on how to find a
solution to his problem.
I already gave him his solution, actually. You just told him to F off
from your precious newgroup.
We have seen time and again people posting off-topic advice in this
newsgroup, and it frequently goes wrong. Sometimes the advice
contains serious errors that somebody here, just by chance, happens to
be able to correct. The solution is simple: redirect the question to
a forum full of experts on the topic. At times, I've done so *and*
offered to answer the question in the more appropriate newsgroup.

Pay attention to this newsgroup for a while, and you'll see that I'm
right.
I do pay attention to this newsgroup - and like I said, way too many
posts here are "google it" or "post in xyz group" or "what part of
'comp.lang.c' do you not understand?" or other nonsense like that.
And I'll also point out that, unlike you, I did not feel the need to
be personally insulting while making these points.
Actually - I'm pretty sure you're the one that implied that I don't
know what I'm talking about.
Grow up.
I'm pretty sure that's the advice I gave you already. Is this one of
those games little kids play when they repeat what everybody else says
just to be annoying? I encourage you to re-read my advice.

This is my last post in this thread that is not on the topic of
accessing the serial port from within C. I, unlike the rest of you, am
actually interested in helping people. I use newsgroups to seek help
with my problems - and when I see people having problems that I know
the solution to, I offer my help. I would encourage you all to do the
same, instead of this trivial and pitiful bickering yall are resorting
to. If anybody has more questions about serial programming from within
Windows - feel free to ask me - just a couple weeks ago I had to get
overlapped serial communication working in a Windows program. (I used
GTK+ + mingw + windows API) It isn't as bad as some articles make it
out to be, but the overlapped aspect of it can be a bit tricky as it
requires a multi threaded application.

-Mike

Sep 1 '06 #21
jacob navia wrote:
After a quick reading of that link I found it quite OK, there were no
aparent mistakes, at least it is a start that can suffice for the
OP to get started. This is quite a normal procedure here, I have seen
a lot of UNIX advise that goes unnoticed without any remarks.

In the FAQ there are examples for DOS (yes still there). That was a time
when people here were less cold maybe. Or maybe they were all a little
bit younger who knows :-)

I find nl******@gmail. com was right to share his knowledge with the OP.
Hi Jacob - I used that page as a starting point for getting serial
comms working. You can pretty much just copy and paste the code and
have a working application. It is a fantastic guide, IMHO. It doesn't
cover overlapped communication - but that is an order of magnitude more
complicated and beyond what most people need.

I'm glad you agree that it is appropriate to share knowledge, even when
the topic is not 100% on topic.

-Mike

Sep 1 '06 #22
nl******@gmail. com said:
Keith Thompson wrote:
>My goals are to keep this newsgroup as useful as possible for those of
us who want to discuss the C programming language, and to help people
who ask questions here get the best possible answers.

Being that it seems about half of the posts I see on comp lang c are
posts saying that the OP is off topic, I don't see how useful it
actually is.
That's not an ideal situation, but it sure beats the situation we'd have if
we didn't remind people of the topic of this newsgroup - i.e. thousands of
off-topic posts each week, until eventually the C experts get fed up of
trying to find topical material among the dross and stop using the group,
thus depriving Usenet of a considerable amount of C expertise.
I just think it's a way a couple people have of making
themselves feel big.
It isn't. Just because you don't understand the reasons for people's
behaviour, that doesn't mean that their behaviour is selfish or malign. It
could just be that they have excellent reasons for saying what they say -
and that is the case here.
You implied I didn't know what I was talking about by saying he should
look elsewhere for the correct answer.
No, he didn't. For all he knows, you might be the principal designer of
Windows XP - or you might be the janitor at Stumpy's Fruit Emporium. You
may be an expert, or just a convincing-sounding nutcase. He has no way of
knowing which. So his proper action is to refer the OP to a newsgroup
frequented by /many/ Windows experts.
Don't try to act innocent.
Stop trying to impute guilt where there is none. If you have the best
interests of the OP at heart, you, too, will want him to use a newsgroup
where he can be sure of high-quality advice that is peer-reviewed by
acknowledged experts in the field.

<snip>

--
Richard Heathfield
"Usenet is a strange place" - dmr 29/7/1999
http://www.cpax.org.uk
email: rjh at above domain (but drop the www, obviously)
Sep 1 '06 #23
In article <VI************ ********@bt.com >,
Richard Heathfield <in*****@invali d.invalidwrote:
a whole bunch of his usual BS.

God, is this guy an idiot!

Sep 1 '06 #24
nl******@gmail. com wrote:

Being that it seems about half of the posts I see on comp lang c are
posts saying that the OP is off topic
Only to unobservant nitwits.

Brian
Sep 1 '06 #25
nl******@gmail. com wrote:
<snipped vitriol>
This is my last post in this thread that is not on the topic of
Could you rather perhaps attempt to make this your last post
in this newsgroup instead?
accessing the serial port from within C. I, unlike the rest of you, am
actually interested in helping people. I use newsgroups to seek help
with my problems - and when I see people having problems that I know
the solution to, I offer my help.
As do we all; we frequently offer to answer a question
in the appropriate newsgroup. Keith himself sometimes
says "This is offtopic here but ontopic in
comp.unix.progr ammer where I can answer it".

Further down I see a thread where Richard Heathfield
says that the question would be /more/ suited to
comp.programmin g rather than here, but attempts to answer
it anyway.

The difference between you and them is that they
would rather a question be answered by a group of
experts in a field.
I would encourage you all to do the
same, instead of this trivial and pitiful bickering yall are resorting
to.
So you feel that it's fine for me to re-post my explanation
of "how to change a cambelt" from alt....autos to here because
it just might help someone who asked about an oilchange?
If anybody has more questions about serial programming from within
Windows - feel free to ask me - just a couple weeks ago I had to get
overlapped serial communication working in a Windows program. (I used
GTK+ + mingw + windows API) It isn't as bad as some articles make it
You're a little too full of yourself; and this is
coming from someone who has done various serial
protocols (not just "serial port programming") on
8-bit, 16-bit, 32-bit and 64-bit hardware.
out to be, but the overlapped aspect of it can be a bit tricky as it
requires a multi threaded application.
I see that this is your first non-trivial program
and/or your first "serial port programming" program[1].

Well Done!

[1] All the multi-threaded serial-port programs
I've seen were "firsts". After the first one the
smart programmer generally learns the error of
their ways and writes it properly the next time.

--
goose
Have I offended you? Send flames to root@localhost
real email: lelanthran at gmail dot com
website : www.lelanthran.com
Sep 1 '06 #26
jacob navia wrote:
<snipped>
I find nl******@gmail. com was right to share his knowledge with the OP.
Of course he was, just not here, thats all.

I'd like to politely advise against ratifying responses that
are this far off-topic. As one of the regs here, you already
know why posters are redirected to appropriate groups[1].

Hell, I remember when you first came here[2] and
got dejected at the responses (IIRC, you could not
understand why no one was more supportive of your
project), but you still stayed at least fairly on-topic.

[1] And as much as I visit here, I still do stupid
things (see post above where I got chastised for
asking poster not to top-post without saying
what top-posting was) that I really should not be
doing.
[2] 3 years ago? 4?

--
goose
Have I offended you? Send flames to root@localhost
real email: lelanthran at gmail dot com
website : www.lelanthran.com
Sep 1 '06 #27
nl******@gmail. com wrote:
>
Keith Thompson wrote:
Unfortunately, few of us here are able to
evaluate whether your advice
is valid, or whether there's a better solution.
The OP should post to
a newsgroup that deals with Windows XP. Quite possibly he'd get the
same advice, but the Windows experts would be able to discuss it
further.
>
I see - so not only do you feel a need to criticize the OP - but you
also feel a need to call into question the knowledge of those that try
to help the OP.
There is a need to call into question the knowledge
of those that try to help the OP.
Everybody who posts on topic here, gets corrected once in while.
Why should somebody posting off topic, be assumed to be correct?
Could you be any less helpful? I mean honestly. What
goal are you trying to accomplish with the above quoted post?
He was alerting the OP, that the chances of getting
a wrong answer without correction,
are much smaller on a newsgroup where his question is on topic.

--
pete
Sep 1 '06 #28
Kenny McCormack wrote:
In article <VI************ ********@bt.com >,
Richard Heathfield <in*****@invali d.invalidwrote:
a whole bunch of his usual BS.

God,
Yes?
is this guy an idiot!
No. Next question?

--
goose
Have I offended you? Send flames to root@localhost
real email: lelanthran at gmail dot com
website : www.lelanthran.com
Sep 1 '06 #29

goose wrote:
nl******@gmail. com wrote:
<snipped vitriol>
This is my last post in this thread that is not on the topic of

Could you rather perhaps attempt to make this your last post
in this newsgroup instead?
Sorry, just failed that request.
accessing the serial port from within C. I, unlike the rest of you, am
actually interested in helping people. I use newsgroups to seek help
with my problems - and when I see people having problems that I know
the solution to, I offer my help.

As do we all; we frequently offer to answer a question
in the appropriate newsgroup. Keith himself sometimes
says "This is offtopic here but ontopic in
comp.unix.progr ammer where I can answer it".
Hmm - in my experience with Keith - he gave a nearly identical response
to that in this thread.
Further down I see a thread where Richard Heathfield
says that the question would be /more/ suited to
comp.programmin g rather than here, but attempts to answer
it anyway.
Richard seems to me to be one of the few regulars interested in helping
people.
The difference between you and them is that they
would rather a question be answered by a group of
experts in a field.
I don't feel a need to ask a group of people when one person has
already given me a good answer. But hey - that's just me.
So you feel that it's fine for me to re-post my explanation
of "how to change a cambelt" from alt....autos to here because
it just might help someone who asked about an oilchange?
If somebody asks about it, why not?
You're a little too full of yourself; and this is
coming from someone who has done various serial
protocols (not just "serial port programming") on
8-bit, 16-bit, 32-bit and 64-bit hardware.
Hmm, I've only done it so far on 8b and 32b microcontroller s (and my
32b XP system). My code would work on a 64b system. Never had a need to
use a 16b chip as none have ever met my needs. I don't see how I'm full
of myself though - I know what I think is a very good and easy answer
to his problem, and I'm offering to help if he needs help. I know my
answer works because I'm currently using it.
out to be, but the overlapped aspect of it can be a bit tricky as it
requires a multi threaded application.

I see that this is your first non-trivial program
Not at all. But it was the first where I had to get a GUI running
within windows that could access the serial port.
and/or your first "serial port programming" program[1].

Well Done!

[1] All the multi-threaded serial-port programs
I've seen were "firsts". After the first one the
smart programmer generally learns the error of
their ways and writes it properly the next time.
Huh? Is it possible to have overlapped serial comms without
multi-threading? You do know what I mean by overlapped, yes? The MSDN
article made it seem that it wasn't. Also, for my application, I can't
possibly imagine how I could do it without multi-threading, unless
there is some way for some sort of interrupt to be generated whenever a
new byte is received over the serial port. I followed the way the MSDN
article said to do it - I figure the people there probabaly have more
experience and more expertise than myself in the matter.

Seriously - if you know of a way to accomplish overlapped serial
communication - I would love to hear about it. If you feel it is off
topic for this newsgroup than please e-mail it to me, or move the topic
to a new newsgroup. Actually, come to think of it - I suppose it
probabaly is possible to do without threads I believe - by just sending
whatever you want sent using overlapped comms and then not waiting for
it to complete, and constantly checking for a new byte. Is that the
method you are referring to? I suppose that would work ok, though I
prefer the threaded method.

-Mike

Sep 2 '06 #30

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
13217
by: willie | last post by:
Hi, I'm writing a program which requires the use of three serial ports and one parallel port. My application has a scanning devices on each port, which I can access fine with pyserial. However, I'm unsure of how exactly I should be designing the program, I thought I could use threading to start class: class scanner(Thread): def __init__(self,port):
1
1416
by: Otac0n | last post by:
Is there an standards-compliant way to access the serial port? I need this to potentially work on DOS 6/7 and *nix. Your help would be appreciated.
1
2027
by: Finn Ellermann | last post by:
How can I can Iget in to Com Port in C# and Pocket PC 2002/2003 can some one help me ? using Visuel C# .NET development system. Regards Finn finn@ellermann-fam.dk
0
2142
by: asam.reddy | last post by:
Hi, I am trying to read serial port using the MSComm control in VS.NET2003(referred from the VS6.0). I have the code already in VB6 which I am coding to C#.NET. After setting all the required settings of the COM1 Port Dim buffer As Variant Dim arr() As Byte
13
4842
by: Al the programmer | last post by:
I need to access the serial ports on my webserver from an asp.net page. I have no problem accessing the serial ports from a windows form application, but the code doesn't work in asp.net. I have been told it is not possible to access the serial ports from asp.net. The application is used to control custom hardware. The hardware is connected to a PC through serial ports. Our customer wants to control the hardware from a remote...
0
1049
by: hemant kamble | last post by:
Hi, I am Hemant working on one software which written in QBASIC in that Serial port is access as output mode and write some instruction which dump in printer. So How I can access the serial port in XP that should not change the printer command in VB. Thanks
0
9932
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
9777
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
10728
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...
0
10405
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9558
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
5782
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...
1
4602
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
4200
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
3227
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.