473,669 Members | 2,414 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

How do I create a Serial port listner

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

May 4 '07 #1
2 4731
On May 4, 8:29 am, Quentin <quinn.willoug. ..@gmail.comwro te:
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_Data Received(ByVal sender As System.Object,
ByVal e As System.IO.Ports .SerialDataRece ivedEventArgs) Handles
serialPort.Data Received

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

In there I use the serial port method,
inData = serialPort.Read Existing()
and then do whatever needs to be done with the data.
I am just learing it myself.

Jeff

May 4 '07 #2
On May 4, 1:35 pm, Hoop <jcoll...@oshtr uck.comwrote:
On May 4, 8:29 am, Quentin <quinn.willoug. ..@gmail.comwro te:
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_Data Received(ByVal sender As System.Object,
ByVal e As System.IO.Ports .SerialDataRece ivedEventArgs) Handles
serialPort.Data Received

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

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

I am just learing it myself.

Jeff
thanks for your help!

May 4 '07 #3

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

Similar topics

4
9087
by: ^CeFoS^ | last post by:
Hello to everybody, I've done an application that draws in a frame the trajectory of a robot. The robot position is readed through the serial port, and several commands are wrote through the same port to change the direction of the robot. The trajectory frame is managed by an applet, and the project works good when the applet is called by a html document allocated in the same local machine under W98 where the classes and the serial port...
2
13177
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):
3
4585
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 micro-controller chip had several pins, some of which were for output and some were for input. The crux of the project was to make the program set the ouput pins to high or low to drive the servos and motors and read the input pins that were attached to various...
3
5037
by: collinm | last post by:
hi i send a command to a led display, the led display is suppose to return me some character i write a string on a serial port void ledDisplayExist() { char msg={'\0', '\0', '\0', '\0', '\0', '\1', 'Z', '0', '0',
13
4815
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...
4
17804
by: Frank | last post by:
Hello, how to get information about all serial ports in the PC? I use the following code, but i got only the data of the FIRST serial port. All other serial port information are not available with this code sample: ManagementObjectSearcher searcher = new ManagementObjectSearcher("Select * from WIN32_SerialPort");
4
11739
by: rowan | last post by:
I'm writing a driver in Python for an old fashioned piece of serial equipment. Currently I'm using the USPP serial module. From what I can see all the serial modules seem to set the timeout when you open a serial port. This is not what I want to do. I need to change the timeout each time I do a "read" on the serial port, depending on which part of the protocol I've got to. Sometimes a return character is expected within half a second,...
0
1434
by: User | last post by:
I need to create a serial port on my "Windows Mobile 5.0 Poket PC" to send data to application receiving data from serial port. For example, I create a serial port COM10, other application connect to COM10 and now can communicate with my application. Any suggestion?
6
6652
by: terry | last post by:
Hi, I am trying to send a character to '/dev/ttyS0' and expect the same character and upon receipt I want to send another character. I tired with Pyserial but in vain. Test Set up: 1. Send '%' to serial port and make sure it reached the serial port. 2. Once confirmed, send another character.
0
8465
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
8383
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
8894
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
8587
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
1
6210
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
4206
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...
0
4384
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2792
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
2029
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.