This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

COM to .txt file

Other Parts Discussed in Thread: MSP430F2274

Hello, 

I am working with the MSP430f2274 and I would like to create log.txt to record temperature values used with the ez430 rf2500 sensor monitor demo. At this point I can see all the value in PuTTy, but I have no way to store them. Can anyone point me in the right direction?

-Thanks a bunch!

  • By increasing complexity:

    1) Turn on PuTTY logging ("Session->Logging" tab). This is a bit clumsy, but you can do it in about 15 seconds.

    2) Find a  PuTTY variant that you can run from the command line (google "putty command line"). I haven't used it, but I suspect there's some permutation of options that will do what you want. This will take about 15 minutes.

    3) Write your own program to drive the serial port and collect exactly the data you want. This will probably take a few hours, depending on your Windows (C/C#/Python etc) programming expertise.

  • A very simply way without any software is using the console window.

    Open a console window (AKA DOS-window) and type

    copy COM4: datei.txt

    It will copy everything from COM4 to "datei.txt". You can stop if by pressing CTRL-C. Also, transfer ends when CTRL-Z is received (end-of-file marker). This can be prevented by giving the /b option

    However, you'll need to set the baudrate etc in the device manager. So a dedicated program is probably better.

    Note that older versions of PUTTY did not support serial ports access.

    However, HyperTerminal, which did come with most windows versions, also supports logging into a file. It also supports XModem protocol, a way to send files over serial, with checksum and repeating damaged packets.

  • If I wanted the log to be only a x number of lines. (3 for example) How do I flush the old data without restarting putty?

  • I am assuming I have to do something in the console command window. I can even settle with only having one line being overwritten when new data comes in. I am at a stand still. Any pointers?

  • “logging” usually means “write down everything”. And that’s how it is implemented in almost every program I know. At least if it is about logging into a file.
    For screen display, of course a scrolling window with only the last n lines is common. However, a random-access media like a screen can easily scroll old messages out while new ones come in. But for a file, it is rather complex to remove data from the beginning while appending data to the end. So if you need this very specific feature, I fear you’ll have to write a frontend on your own.

**Attention** This is a public forum