473,386 Members | 1,706 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

Serial Port interfacing

Hi all

I am having a problem reading from a serial port, first of all I have now resorted to using the MSComm ActiveX control on my Windows Forms to provide me with the interface to my serial port. is there no other way to do this - it has to be simple or well explained because I'm still new to the .NET world and c#. I did stumble across an article on the MSDN site where I downloaded a file NetSerialComm.exe - I think it was from one of the msdn magazines? But anyway I don't know what the heck is going on here! there are so many classes, I don't know which ones to instantiate or if I'm supposed to write my own classes derived from these?! I would just like something simple that would give me the capabilities of reading and writing to a comport. I know that for reading a port is alot harder than writing to one because you're not really in control, you basically have to do it on an Event basis - but I don't know how to construct me form/class to raise an event when data is coming through the port

Plainly put, that is why I resorted to the MSComm.ocx. But now when I set my Card reader up and I plug it in and I swipe my transponder card the OnComm event of the Active X control executes 3 times and I get 3 sections of the number thats on the card! - where as in Hyperterminal I get 1 long string. I have no Idea why the event would be raised 3 times? any suggestions?

I would like to break away from the MSComm control purely because I want a .NET component, but this product I want to make will be sold so I am screwed by open source liscence agreements!lo

Please can someone give me some help or point me in a direction where I can find this sort of stuff explained in plain english:

Thanks
Kevin
Nov 16 '05 #1
7 3022
TransPort from www.componentscience.net, it's a commercial serial
communications library. I saw them at a conference last year, and they had
a card reader set up for their demo. They use regex for data matching, so
you can set up a packet for the data coming from your card and it will come
in at once instead of spreading over a few events. When I was talking with
them, they seemed very knowledgeable and willing to help, so they can
probably offer some guidance (probably more if you buy their product<g>)
BTW, the reason why you're getting multiple events is that's how the data
is coming in and being fed by the port driver. It's usually in 8 byte
chunks (give or take depending on how fast the app can process data and how
fast the port drivers can handle the data).

--
Floyd Burger

"Kevin" <an*******@discussions.microsoft.com> wrote in message
news:88**********************************@microsof t.com...
Hi all,

I am having a problem reading from a serial port, first of all I have now resorted to using the MSComm ActiveX control on my Windows Forms to provide
me with the interface to my serial port. is there no other way to do this -
it has to be simple or well explained because I'm still new to the .NET
world and c#. I did stumble across an article on the MSDN site where I
downloaded a file NetSerialComm.exe - I think it was from one of the msdn
magazines? But anyway I don't know what the heck is going on here! there are
so many classes, I don't know which ones to instantiate or if I'm supposed
to write my own classes derived from these?! I would just like something
simple that would give me the capabilities of reading and writing to a
comport. I know that for reading a port is alot harder than writing to one
because you're not really in control, you basically have to do it on an
Event basis - but I don't know how to construct me form/class to raise an
event when data is coming through the port.
Plainly put, that is why I resorted to the MSComm.ocx. But now when I set my Card reader up and I plug it in and I swipe my transponder card the
OnComm event of the Active X control executes 3 times and I get 3 sections
of the number thats on the card! - where as in Hyperterminal I get 1 long
string. I have no Idea why the event would be raised 3 times? any
suggestions?
I would like to break away from the MSComm control purely because I want a ..NET component, but this product I want to make will be sold so I am screwed
by open source liscence agreements!lol
Please can someone give me some help or point me in a direction where I can find this sort of stuff explained in plain english:)
Thanks
Kevin

Nov 16 '05 #2
On Mon, 3 May 2004 23:43:08 -0600, "Floyd Burger" <fl***@adelphia.not>
wrote:
TransPort from www.componentscience.net, it's a commercial serial
communications library. I saw them at a conference last year, and they had
a card reader set up for their demo. They use regex for data matching, so
you can set up a packet for the data coming from your card and it will come
in at once instead of spreading over a few events. When I was talking with
them, they seemed very knowledgeable and willing to help, so they can
probably offer some guidance (probably more if you buy their product<g>)
BTW, the reason why you're getting multiple events is that's how the data
is coming in and being fed by the port driver. It's usually in 8 byte
chunks (give or take depending on how fast the app can process data and how
fast the port drivers can handle the data).


I use the BaseComm class provided by GotDotNet. I heard a rumour that
this will be similar to the class that MS is supposed to be providing
in the future. Using the line term class is very similay to using
MSComm

To date, I've had it running in several industrial environments and I
have not yet had a drama.

Nov 16 '05 #3
The Real Andy wrote:
I use the BaseComm class provided by GotDotNet. I heard a rumour that
this will be similar to the class that MS is supposed to be providing
in the future. Using the line term class is very similay to using
MSComm


Searching on GotDotNet (and Google) didn't turn up any hits for that...
can you provide a link? Thanks.
Nov 16 '05 #4
http://www.gotdotnet.com/community/u...=serial%20port

--
Floyd Burger

"Kevin P. Fleming" <kp*******@backtobasicsmgmt.com> wrote in message
news:uj**************@TK2MSFTNGP11.phx.gbl...
The Real Andy wrote:
I use the BaseComm class provided by GotDotNet. I heard a rumour that
this will be similar to the class that MS is supposed to be providing
in the future. Using the line term class is very similay to using
MSComm


Searching on GotDotNet (and Google) didn't turn up any hits for that...
can you provide a link? Thanks.

Nov 16 '05 #5
I've used the library from GotDotNet
http://www.gotdotnet.com/Community/U...7-73e09c4d5890
for my applications.

With the exception of few bugs and some error handling the library seems to
work fine.

Alex Moskalyuk
_________________________________
http://www.techinterviews.com

"Kevin" <an*******@discussions.microsoft.com> wrote in message
news:88**********************************@microsof t.com...
Hi all,

I am having a problem reading from a serial port, first of all I have now resorted to using the MSComm ActiveX control on my Windows Forms to provide
me with the interface to my serial port. is there no other way to do this -
it has to be simple or well explained because I'm still new to the .NET
world and c#. I did stumble across an article on the MSDN site where I
downloaded a file NetSerialComm.exe - I think it was from one of the msdn
magazines? But anyway I don't know what the heck is going on here! there are
so many classes, I don't know which ones to instantiate or if I'm supposed
to write my own classes derived from these?! I would just like something
simple that would give me the capabilities of reading and writing to a
comport. I know that for reading a port is alot harder than writing to one
because you're not really in control, you basically have to do it on an
Event basis - but I don't know how to construct me form/class to raise an
event when data is coming through the port.
Plainly put, that is why I resorted to the MSComm.ocx. But now when I set my Card reader up and I plug it in and I swipe my transponder card the
OnComm event of the Active X control executes 3 times and I get 3 sections
of the number thats on the card! - where as in Hyperterminal I get 1 long
string. I have no Idea why the event would be raised 3 times? any
suggestions?
I would like to break away from the MSComm control purely because I want a ..NET component, but this product I want to make will be sold so I am screwed
by open source liscence agreements!lol
Please can someone give me some help or point me in a direction where I can find this sort of stuff explained in plain english:)
Thanks
Kevin

Nov 16 '05 #6
Hi Alex

How do I actually use these classes in my application? I somehow think I need to create my own classes that derive from these, but what do I need to do, and which ones do I derive from!

Thanks for any help, and thanks to all you other guys for all your inpu

Kevi

----- Alex Moskalyuk wrote: ----

I've used the library from GotDotNe
http://www.gotdotnet.com/Community/U...a7-73e09c4d589
for my applications

With the exception of few bugs and some error handling the library seems t
work fine

Alex Moskalyu
________________________________
http://www.techinterviews.co

"Kevin" <an*******@discussions.microsoft.com> wrote in messag
news:88**********************************@microsof t.com..
Hi all
I am having a problem reading from a serial port, first of all I have no resorted to using the MSComm ActiveX control on my Windows Forms to provid
me with the interface to my serial port. is there no other way to do this
it has to be simple or well explained because I'm still new to the .NE
world and c#. I did stumble across an article on the MSDN site where
downloaded a file NetSerialComm.exe - I think it was from one of the msd
magazines? But anyway I don't know what the heck is going on here! there ar
so many classes, I don't know which ones to instantiate or if I'm suppose
to write my own classes derived from these?! I would just like somethin
simple that would give me the capabilities of reading and writing to
comport. I know that for reading a port is alot harder than writing to on
because you're not really in control, you basically have to do it on a
Event basis - but I don't know how to construct me form/class to raise a
event when data is coming through the port Plainly put, that is why I resorted to the MSComm.ocx. But now when I se my Card reader up and I plug it in and I swipe my transponder card th
OnComm event of the Active X control executes 3 times and I get 3 section
of the number thats on the card! - where as in Hyperterminal I get 1 lon
string. I have no Idea why the event would be raised 3 times? an
suggestions I would like to break away from the MSComm control purely because I want ..NET component, but this product I want to make will be sold so I am screwe
by open source liscence agreements!lo Please can someone give me some help or point me in a direction where can find this sort of stuff explained in plain english: Thank

Kevi


Nov 16 '05 #7
On Tue, 04 May 2004 08:37:08 -0700, "Kevin P. Fleming"
<kp*******@backtobasicsmgmt.com> wrote:
The Real Andy wrote:
I use the BaseComm class provided by GotDotNet. I heard a rumour that
this will be similar to the class that MS is supposed to be providing
in the future. Using the line term class is very similay to using
MSComm


Searching on GotDotNet (and Google) didn't turn up any hits for that...
can you provide a link? Thanks.


http://msdn.microsoft.com/msdnmag/is...m/default.aspx

Have a good read through the examples, they are quite comprehensive.
The VB implementation uses the LineTerm class, which is probably the
easist.
Nov 16 '05 #8

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

Similar topics

8
by: Daniel Åberg | last post by:
I can't find how I can, in c#, open a serial port and read and write to it. Anyone that knows if there is any namespace with methods or code example.
3
by: rusttree | last post by:
Many moons ago, I took a class in embedded control at school. The course focused on a micro-controller mounted on a small electric car that was programmed using simple C code. The...
3
by: Kevin | last post by:
Hi All I got some good responses from some of you guys regarding me serial port interfacing problem that I posted a little while back. However your help leaded me to this link belo ...
0
by: Tom | last post by:
I am new to hardware programming. I need to write a program for reading data from Card Reader which connects to the PC windows 2000/XP OS through Interfacing The Serial / RS-232 Port / USB /...
1
by: raza | last post by:
i have to access the serial port for controlling hardware, i have found the php_ser.dll for serial communication. but this dll is for windows only. i need to do the same job on linux plateform.i need...
6
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
5
by: karthi84 | last post by:
hi friends, my friend recently has imported a hp pc which has no serial port in it. he has an external modem which is to be interfaced to it. i heard about a serial to usb cable. can any one...
0
by: Ajay Nayak | last post by:
I want to know how to access serial port data in a file using c & c++ with respect to window98 ,win2000 & win xp OS ? Ajay
0
by: ashish.sadanandan | last post by:
Hi, I'm not sure whether this is the right newsgroup to post this question in, if it isn't please accept my apologies (and I'd really appreciate it if you could point me to the correct one). I'm...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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,...
0
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,...

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.