473,327 Members | 2,090 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,327 software developers and data experts.

Saving Serial Port Data To File

Hello everyone,

I generally look at Google and other websites before I post a question, but trust me I still cannot find and answer to this problem.

I'm using VB.net. My problem being is that I don't know how to redirect the serial port output to a selected file. I looked in the forum but no luck.

Here is the sequence of events.

User selects a file to write to. No problem here.
Sends a command to the equipment to start outputting text. No problem here.

At the moment the text is going to text box. Is easy to wait for the output to finish and then save the file. But I do not want this. The user does not need to see the text. Just some sort of indication that data is being sent. No Problem here.

Is more like a Serial Port Data Log.

Friend Sub DataReceived(ByVal sender As Object, ByVal e As SerialDataReceivedEventArgs)

Dim newReceivedData As String

Try
' Get data from the COM port.

newReceivedData = selectedPort.ReadExisting

' Save the number of characters received.

receivedDataLength += newReceivedData.Length

RaiseEvent UserInterfaceData("AppendToMonitorTextBox", newReceivedData, Color.Black)

' I guess I could choose to Write the line to the file instead.

Catch ex As Exception
DisplayException(ModuleName, ex)
End Try
End Sub

Any suggestions? Thanks!
Nov 23 '07 #1
2 3043
Killer42
8,435 Expert 8TB
Isn't it just a matter of opening the text file in Append mode and writing the data to it?
Nov 30 '07 #2
Isn't it just a matter of opening the text file in Append mode and writing the data to it?
Hi Killer,

Opening the data file and appending to it is not the problem. Is just where to put the code to write to the file while the serial port is outputting data. For example
when the serialport read.existing happens then do a file writeline. That's all I need.

Thanks for your reply.
Dec 1 '07 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

14
by: McBooCzech | last post by:
Hi I am just trying to analyze (parse) data from the serial port (I have connected GPS receiver to the ttyS0, so I can read ASCII characters in the CSV form on the serial port 1). I am doing this...
4
by: joe bloggs | last post by:
I am writing a mobile application to interface with a legacy system and I am planning to use web services to communicate with this system. The legacy system receives data through a serial port. ...
0
by: Daniel | last post by:
Ive used the New Serial Port Namespace in Net Framework 2 to write a Serial Port Monitoring Application. Basically the program opens the serial port and listens for any data that is received. It...
4
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...
2
by: zdicklin | last post by:
I am working on a very simple hardware project and would like to develop serial port controls, but I'm having a little bit of trouble starting out. The project is the following: I have built an...
13
by: Rob | last post by:
Hi all, I am fairly new to python, but not programming and embedded. I am having an issue which I believe is related to the hardware, triggered by the software read I am doing in pySerial. I...
4
by: Petr Jakes | last post by:
I am trying to save data it is comming from the serial port continually for some period. (expect reading from serial port is 100% not a problem) Following is an example of the code I am trying to...
8
by: glaskan | last post by:
This code is meant to take an input from the serial port and then save the input from the serial port as the name and as the data to a text file but all i am getting is an empty text file or a text...
2
by: joaquimfpinto | last post by:
Dear All, I made an app in c# that uses several serial ports. For the serial ports I use a pnp Sunix board, some with 8 serial ports other with 4 or even 2 serial ports. Whenever I use the...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

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.