Is there a simple way of redirecting serial port output to a file, that I can put into place on a test Windows desktop system without changing any code?
Active8 months ago
So, one would need to resort to help of a specialized serial data capture software, such as Serial Port Monitor that would assist with capturing and examining the data exchange between RS232 devices and Windows applications. The measurement data transmits every 60 secs via rs232. I route this to a PC using a serial / usb convertor and can view the data strings as they arrive on a com port in hyper terminal. However I don't know how to capture this 'com port' data in excel - though I believe it's possible.
I'm trying to debug a problem in a serial receipt printer module and I don't have the real device handy today. I don't want to start making any changes to the code if I can help it, I just want to capture what is currently being output at the moment so that I can review it in a file.
It's Windows XP, if that makes any difference.
skaffman
353k91 gold badges748 silver badges734 bronze badges
robsoftrobsoft
4,4503 gold badges30 silver badges47 bronze badges
8 Answers
A quick google led me to RS232 Data Logger - I haven't tried it, but if it does what it says on the tin it should be OK for you. Edit: it appears to be incoming, not outgoing. Might be worth a try though :-)
Dan FDan F
10.9k3 gold badges41 silver badges66 bronze badges
FerranBFerranB
21.7k17 gold badges59 silver badges80 bronze badges
TimmmmTimmmm
41.1k40 gold badges221 silver badges279 bronze badges
You could run the printer module in a VM. VMWare allows you to redirect serial ports to files and named pipes.
![Serial Port Data Capture Serial Port Data Capture](/uploads/1/2/5/0/125075887/791972512.png)
13.8k4 gold badges35 silver badges69 bronze badges
Similar to VMWare, Virtual PC (& Virtual Server) can also redirect a COM port to a text file and setup is very simple.
ScottScott
3,1125 gold badges33 silver badges49 bronze badges
I think in the control pandel, printers, you can add manual printer and install dummay oneSo you can printing to a file for example
Ahmed SaidAhmed Said
4,2108 gold badges48 silver badges89 bronze badges
If you are developer use Serial Port component from .NET or if you don't are a developer and only want get information to file use windows HyperTerminal
pedrofernandespedrofernandes
7,6899 gold badges30 silver badges42 bronze badges
I don't know if you can redirect COM ports but you can use com0com for that kind of job.
For example, you can pair (COM1, COM2), so you can write to COM1 and read from COM2.
Nick DandoulakisNick Dandoulakis
37.2k14 gold badges89 silver badges132 bronze badges
Not the answer you're looking for? Browse other questions tagged windowsserial-port or ask your own question.
Active1 month ago
I've read a lot of questions here about how to read data from serial ports using the .NET SerialPort class but none of the recommanded approaches have proven completely efficient for me.
Here is the code I am using for now:
And the event handler:
But I am still missing some data sometimes. I've tried different way of reading the data in the event handler but with no luck.
As the .NET 4.5 brings new possibilities to do some asynchronous tasks, like with the ReadAsync method that seems to be useable on a SerialPort stream, I'm curious to see what would be the recommended approach to handle those cases.
Yannick BlondeauYannick Blondeau
7,6415 gold badges39 silver badges65 bronze badges
3 Answers
Could you try something like this for example I think what you are wanting to utilize is the port.ReadExisting() Method
Or is you want to do it based on what you were trying to do , you can try this
decates
2,7021 gold badge15 silver badges22 bronze badges
MethodManMethodMan
16.2k6 gold badges28 silver badges49 bronze badges
I used similar code to @MethodMan but I had to keep track of the data the serial port was sending and look for a terminating character to know when the serial port was done sending data.
What Is Data Capture Techniques
user1184321
Serial Port Data Capture
Vimukthi SinethVimukthi Sineth