How do I create a Serial port listner

  • Thread starter Thread starter Quentin
  • Start date Start date
Q

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!!
 
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
 
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!
 
Back
Top