Home All Groups Group Topic Archive Search About

How do I create a Serial port listner

Author
4 May 2007 1:29 PM
Quentin
I would like to create a serial port listener that starts recording
data to a text file as soon as the port starts receiving the data.

How do I trigger the program to start running when data is sent to
that port.

Any help with the code would be great!

Thank you!!

Author
4 May 2007 5:35 PM
Hoop
On May 4, 8:29 am, Quentin <quinn.willoug***@gmail.com> wrote:
> I would like to create a serial port listener that starts recording
> data to a text file as soon as the port starts receiving the data.
>
> How do I trigger the program to start running when data is sent to
> that port.
>
> Any help with the code would be great!
>
> Thank you!!

Hi,
I have just started working with the SerialPort class availble in,
Imports System.IO.Ports

You can declare an instance,
Private WithEvents serialPort As SerialPort = New SerialPort()

It have a recieved event,
Private Sub serialPort_DataReceived(ByVal sender As System.Object,
ByVal e As System.IO.Ports.SerialDataReceivedEventArgs) Handles
serialPort.DataReceived

This event is fired when some data arives at the port.

In there I use the serial port method,
inData = serialPort.ReadExisting()
and then do whatever needs to be done with the data.


I am just learing it myself.

Jeff
Author
4 May 2007 7:01 PM
Quentin
On May 4, 1:35 pm, Hoop <jcoll***@oshtruck.com> wrote:
Show quoteHide quote
> On May 4, 8:29 am, Quentin <quinn.willoug***@gmail.com> wrote:
>
> > I would like to create a serial port listener that starts recording
> > data to a text file as soon as the port starts receiving the data.
>
> > How do I trigger the program to start running when data is sent to
> > that port.
>
> > Any help with the code would be great!
>
> > Thank you!!
>
> Hi,
> I have just started working with the SerialPort class availble in,
> Imports System.IO.Ports
>
> You can declare an instance,
>  Private WithEvents serialPort As SerialPort = New SerialPort()
>
> It have a recieved event,
> Private Sub serialPort_DataReceived(ByVal sender As System.Object,
> ByVal e As System.IO.Ports.SerialDataReceivedEventArgs) Handles
> serialPort.DataReceived
>
> This event is fired when some data arives at the port.
>
> In there I use the serial port method,
> inData = serialPort.ReadExisting()
> and then do whatever needs to be done with the data.
>
> I am just learing it myself.
>
> Jeff

thanks for your help!