Serial Port interfacing -Part 2

G

Guest

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

http://www.gotdotnet.com/Community/...ampleGuid=9dde5cf3-4842-4d4b-baa7-73e09c4d589

Now my questions is - forgive me because I am still new at c# - that how do I use these clases? I think I need to build my own classes that inherit from these? But which classes must I build ie which ones must I inherit from? Do I have to implement every method that has the abstract keyword?, and what about the other methods defnined as protected, what do I do with those? And lastly, how do i set up an event so that when data arrives on the Com port an event is raised and provides me with the string that was sent down the line? Thats basically ALL I want to do, is receive a text string that is sent via the com port

Thanks for any hel
Kevin
 
N

Nicholas Paldino [.NET/C# MVP]

Kevin,

You will want to use the SerialPort class, which provides the
implementation of the SerialComm class.

Hope this helps.


--
- Nicholas Paldino [.NET/C# MVP]
- (e-mail address removed)

Kevin said:
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 below
http://www.gotdotnet.com/Community/...mpleGuid=9dde5cf3-4842-4d4b-baa7-73e09c4d5890

Now my questions is - forgive me because I am still new at c# - that how
do I use these clases? I think I need to build my own classes that inherit
from these? But which classes must I build ie which ones must I inherit
from? Do I have to implement every method that has the abstract keyword?,
and what about the other methods defnined as protected, what do I do with
those? And lastly, how do i set up an event so that when data arrives on the
Com port an event is raised and provides me with the string that was sent
down the line? Thats basically ALL I want to do, is receive a text string
that is sent via the com port.
 
A

Alex Moskalyuk

Open up his Terminal application that he provided in that solution. The
Terminal is the sample app that initializes the SerialPort object.

Experiment with adding your own project to the solution and then
initializing the same class. You need to re-implement (which might include
just writing empty methods) base class event handlers.

For the event, OnRecvI is your friend, although I could never get it to work
without going into multi-threading, so I just stuck with a timer picking up
the data every 100 ms or so.


--
Alex Moskalyuk
_____________________________
http://www.techinterviews.com

Kevin said:
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 below
http://www.gotdotnet.com/Community/...mpleGuid=9dde5cf3-4842-4d4b-baa7-73e09c4d5890

Now my questions is - forgive me because I am still new at c# - that how
do I use these clases? I think I need to build my own classes that inherit
from these? But which classes must I build ie which ones must I inherit
from? Do I have to implement every method that has the abstract keyword?,
and what about the other methods defnined as protected, what do I do with
those? And lastly, how do i set up an event so that when data arrives on the
Com port an event is raised and provides me with the string that was sent
down the line? Thats basically ALL I want to do, is receive a text string
that is sent via the com port.
 
G

Guest

Hi Alex & all the other who helped me

I have done some serious research and I managed to get it to work! whoo hoo:) I have actually now got an event that fires when the OnRecv(byte[] b) is called, so now when something comes down the serial line my event is fired and I catch each charater and wait for a special character that determines the end of the string eg a #. Thanks so much for all your guys input, I really appreciate it, if I have any other questions, I'll be sure to be back here again:

Thank
Kevin
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top