views:

929

answers:

6

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?

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.

A: 

I don't know if you can redirect COMM ports but you can use com0com for that kind of jobs.

For example you can pair (COM1, COM2), so you can write to COM1 and read from COM2.

Nick D
A: 

I think in the control pandel, printers, you can add manual printer and install dummay one So you can printing to a file for example

Ahmed Said
Thanks for the suggestion. I originally tried something like this but found that my app wouldn't talk to the com port if it thought it was involved with a Windows printer. I'm not ruling out that I was doing something wrong, though!
robsoft
+2  A: 

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 F
Thanks Dan. It let me to their Serial Port Monitor, which is capturing something. However I didn't factor that the app/com port component itself would expect some kind of feedback from the device before it would work - it might be that this whole approach is a bust without the receipt printer itself. :-)
robsoft
Serial Port Monitor did the trick Dan. I was able to watch output going to the receipt printer even though it wasn't plugged in, once I'd sussed it out a bit. Many thanks!
robsoft
Awesome, glad it worked out :-)
Dan F
A: 

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

pho3nix
+3  A: 

You could run the printer module in a VM. VMWare allows you to redirect serial ports to files and named pipes.

Niki
Oh wow - how cool. The machine is already a VM - I didn't realise I could redirect the serial comms that way. I'll give that a try - many thanks!
robsoft
Wow, that is very cool!
Jason Down
+1  A: 

Similar to VMWare, Virtual PC (& Virtual Server) can also redirect a COM port to a text file and setup is very simple.

Scott