How To Transfer File Using Putty Serial Command 3,9/5 9472reviews
Keywords: Serial port communication in Windows 7 using Hyper-terminal and Putty, Putty, Hyper terminal in Windows 7 Some times you need to access serial port of your PC/LAPTOP to perform some actions like if you want to connect a GSM modem or if you are an Embedded systems programmer then to access program or interface your micro-controllers to your system. If you are performing these tasks on either Windows or Linux then you will requires some program that can communicate with your hardware and system. In the old days, Windows used to be provided Hyper terminal but now from Windows Vista they don’t provide such a tool, could not understand the reason though.
🙂 How ever you can still use Hyper terminal in Windows 7 as well as you can use other freely available serial communication utilities like Putty. Putty is a great and free tool and available for both Windows and Linux platforms. Before I start please note that: • If your system does not have any serial port, you can still use a USB-to-Serial adapter When you buy a USB-to-Serial port adapter you will get a driver for it as well. This driver makes a virtual serial port in your system. • In Windows, serial port named as COM port. • If you want to use Hyper terminal than you have to download. • If you want to use Putty than download this file from.
Set PATH=C: path to putty directory;%PATH%. This will only work for the lifetime of that particular console window. To set your PATH more permanently on Windows NT, use the Environment tab of the System Control Panel. On Windows 95, 98, and ME, you will need to edit your AUTOEXEC.BAT to include a set command. There is an ugly way that I use to copy from Putty console. In Putty configuration window, I have enabled Session Logging to get the console output dumped to a file on my system. My Putty Session Logging Configuration. Then I tail the log file in a local terminal with command: tail -f.
Now you have to follow below steps to communicate with your device: Step – 1: Connect your device with your system through RS-232 cable or USB-to-Serial adapter and check whether it’s connected successfully or not. (see step 2) Step – 2: Open device manager and check for COM ports, it get assigned a COM port or not. See below screen shot. If you are not aware about accessing device manager then follow Step – 3: Note down the “COM port number” as we will require it. Step – 4: Check user manuals or other reference documents related to your hardware for the following information: Baud Rate Data bits Stop bits Parity Flow control Above properties are critical to make the communication correctly, if you don’t configure these properties properly then you will get either junk data or no data. If you are going to use Hyper terminal than follow Step-5 to Step-9 otherwise follow Step-10 to Step-12.
Serial Communication using Hyper Terminal Step – 5 a Extract the downloaded “hypertermina.rar” file in your system, open the “Hyper terminal” folder and double click on hyper terminal application. You should see the window like the screen shot given below.
Step – 5 b Insert a name for the connection, for ex. Step – 5 c Select your “COM” i.e Serial port. Step – 5 d You will see the window like below screen shot. Set the values, you noted before remember i.e. According to your device requirements. Step – 5 e Now you are ready to communicate with your device. I am inserting a screen shot which shows a messages received by the device.
Step – 6 a By default you wont see the character you type,but if want to see the character you type that is going to received by your device then you have to click on ‘properties’, you will see the window like below: Step – 6 b Click on “settings”, you will see the window like below, click on ‘ASCII Setup’. Step-6 c Select “Echo typed character locally”, see screen shot below: Step – 7 a If you want to receive a file from your device the click on ‘settings’, then select ‘Receive file’ option. Step – 7 b Choose the receiving protocol whatever your device support, see attached screen shot. Step – 8 If you want to send a file, then select “Send file” option and sending protocol. Step – 9 Similarly you can capture the text and save it in a file. Serial Communication using Putty Step – 10 Double click on downloaded ‘Putty.exe’, you will see a window like this: Step – 11 Select ‘serial’, insert com port and baud rate value and click on ‘Serial’ (Left pan), you will see a window look like this: Step – 12 Enter all the setting according your device and then click on open, Step -13 After clicking on ‘open’, you will see a window like this, now you are ready to communicate with your device.
Putty is much more than a simple serial port communication tool, I will cover more on Putty in my future post. For now, that’s all now you can communicate with your device using serial port, Please like and share if you find it useful. HI, First check whether your PC has a serial port or not.
If not then you have to use an USB to RS232 converter cable. Install the driver from the cd of USB-2-RS232 converter into your PC. It’s provide a virtual serial port to use. Now connect RS232 part to your device and USB part to your PC. Power up the weight machine and open a hyper-terminal or any other serial port utility or software provided by the machine vendor and start the communication. Configure serial port properties according the user manual of your weight machine. To know about serial port settings read the full post.
Hope it’ll help you. Have a nice day!!!
I often need to send short character strings to a serial port in Windows. Office For Mac 2011 Keygen Download Sony on this page. The sort of thing I might use this for is sending a command to a robot or other microcontroller-based device that I’m building using a USB-to-serial converter. I actually developed a small command line utility called SerialSend for doing exactly this, but in many cases you can get away without using any special programs at all.
Instead you can just use Windows’ built-in echo, set and mode commands. The simplest case is something like the following which sends the string “hello” to COM1 (the first serial port). You can just type this command into a normal Windows console: echo hello >COM1 The echo command is typically used to display a string in the console.
Here however, its output is redirected (using the “>” character) to the special filename “COM1”, which is actually a serial port rather than a file on disk. So the string “hello” gets sent to the serial port rather than to the screen. There are a couple of potential snags though: • You need to know the number of the COM port you want to send to. If you’re using a USB-to-serial converter, this number may change over time, especially if you plug the device into different USB sockets. ( provides an easy alternative method of sending strings to whatever the highest numbered available COM port is, which can be very useful.) • The string that gets sent in the above example is actually 8 bytes long because it includes the trailing space character after the word “hello” as well as carriage return and line feed characters. I tested this myself by capturing the transmitted bytes using a microcontroller and then echoing their numerical values back to the screen – the values were: “104 101 108 108 111 32 13 10”.
The first five byte values in the sequence are just the letters of the word “hello”, but the last three are the space, carriage return and line feed characters. An alternative method of sending the string without these trailing characters using the set command is shown below. • The serial port you’re using may not already be set to the baudrate you desire. In this case, an additional mode command can be used to configure the baudrate (and/or other serial parameters). • Higher numbered COM ports may not be recognised when written this way, but a workaround is shown below.
The following example is a more robust version of the command shown above: set /p x='hello'. COM22 This probably looks a bit confusing, so let’s break it down. The set command is normally used to set the value of an environment variable. For example, the following command could be used to set an environment variable called x equal to the string “sunshine”: set x='sunshine' When used with the “/p” switch, the set command prompts the user to enter a value for the environment variable. The prompt displayed on screen is the string provided in the command.
For example, set /p x='Enter a value for x: ' Of course, we’re actually not interested in setting the value of x at all – it’s just a means to a different end. All we really want is a way of outputting the string “hello” without any carriage return and line feed characters, and the set command just happens to provide a convenient way of doing it.
We don’t want the set command to sit around waiting for the user to enter a value for x, so the input to the set command is redirected from “nul” (i.e. No input at all, rather than input from the console which would normally be the case).
This means that the command finishes immediately rather than waiting for something to be typed in. Input redirection is performed using the “. COM22 Finally, to configure the baudrate before sending a string to the serial port, the mode command can be used. For example, to set COM22 to 38,400 baud with 8 data bits and no parity checking: mode COM22 BAUD=38400 PARITY=n DATA=8 Here’s a complete example as it appeared in my console window. Hi Dorian, That’s interesting – I haven’t run into that problem myself. As a matter of interest, what version of Windows are you running?
In recent years, I just haven’t had these kind of problems because Windows seems to have got much better at cleaning up properly when a program that’s using a hardware device crashes. Also, what kind of serial port device is it you’re using? None of my machines have a built-in serial port anymore, so I’m generally using a USB-to-serial converter which could simply be plugged out and plugged back in again if it really hung. Writing a program to check which ports are open and clear them is something I thought about trying a long time ago when I used to have this kind of problem. However, I just forgot about doing it because the problem basically just stopped happening to me. I’m not sure how straightforward it would be to write such a program.
If Windows think the device is already in use, it won’t ordinarily allow another program to open or otherwise change the state of the device. Maybe there’s some way to use Administrator privileges to override another program, but I don’t know how. Anyway, I’m curious to hear more details about your setup if you don’t mind sharing them? Hi Daniel, Maybe it would be worth trying the following: copy. COM45 test.txt Apparenty, you sometimes need to specify the special file names for higher numbered COM ports in full form (i.e. With those leading slashes and full stop) in order for Windows to interpret it correctly. I’m not sure why this is, but I know I’ve had to do it in the past.
Also, to configure the serial parameters (e.g. Baud rate) you may need to do one of the following: • Go into the device settings in Windows Control panel to configure the default baud rate for your serial device. • Run a command like “ mode COM45 BAUD=38400 PARITY=n DATA=8” before you open the COM port to configure the baud rate, etc. You could also consider trying my program, which is what I use to display incoming serial data in the console. Hope that helps! Hi Daniel, Firstly, I’m not sure how to hide your surname. I agree there’s no need to display it, but WordPress displays that automatically – I don’t think it’s under my control.
Maybe you can change what’s displayed by changing your own wordpress/gravatar profile settings? Anyway, I’ll double check in case it’s something at my end.
If you can’t change it yourself, feel free to delete the messages (or I can do it) once I’ve read them. Now, back to the problem: Sorry it took a while to try this on my own computer because things are very busy in work. However, I’ve just tested it with the “type” command and I was able to output the incoming data straight to the console, as shown in this screenshot: As you can see, I ran ComPrinter first, which configured the baudrate to 38400, which is what my connected device was transmitting. I just used a dsPIC microcontroller to send in a sequence of integers. Could you give that a try?
Hi Basu, When I need to send arbitrary bytes, I use my application SerialSend, which lets you send arbitrary hex bytes to the serial port. It’s just a simple exe file that you can drop into whatever folder you’re working out of.
Here’s the link (you’ll find instructions there too for sending hex bytes): However, it’s probably possible to do what you want by placing the commands you want to send into a text file and then using a command like “type” to output the complete contents of the file to the serial port. Something like this type mycommands.txt >.
COM4 which assumes your commands are in “mycommands.txt” and that you’re sending them to COM4. You can probably even just use the “echo” command to send the commands one at a time. For example, to send two commands to COM4, you could try echo your_first_command >.
COM4 echo your_second_command >. COM4 The “echo” command automatically adds a new line at the end whatever it prints.
Hi Altonmazin, I think you probably just need to use these slightly modified commands: serialsend.exe /hex ' x6b x61 x20 x30 x31 x20 x30 x31 x0d' serialsend.exe /hex 'ka 01 01 r' As far as I recall, I made it so that you can only use the “ r” and “ r” escape sequences with SerialSend when you specify the “/hex” option. See full instructions. The two commands above could be combined into a single command, by the way. SerialSend allows you to mix normal printable characters and hex bytes when the “/hex” option is used.
Only “ x” followed by two digits will be treated as a hex value; other characters should just be treated as how they appear on screen. For example, serialsend.exe /hex ' x6b x61 x20 x30 x31 x20 x30 x31 x0dka 01 01 r' should send a total of 18 characters, including the two spaces and the carriage return. If there’s some kind of documentation for the command protocol for your TV link, I can check that the above commands send the correct bytes. Regards, Ted. Hello Ted, first of all thank you for this helpful information. According to this I now manage to talk via com25 to my microcontroller. However I am running in the same problem as Daniel above: receiving data from COM25 is still a problem: “type.
Com25” reveals the error message: “The syntax for the filename is wrong” “type com25” results in “The system cannot find the file” ( The exact wording of the error messages may be a little different since I translated them from my german windows) I saw in the thread from Daniel your screenshot, but unfortunately it does not work here. SInce Daniel did not send an answer I don’t know wether he found a work around.
Best regards michael Btw: I tried to find out some information on this “funny” notation. But without success. Do you know were i can find some additional information to fully understand what these slashes an full stop mean? Hello Ted, just an update to my question above: I tried your ComPrinter Program an this can receive the data from my microcontroller. So may be the problem can be reduced to the question wether comPrinter.exe can be automatically finished after receiving one line of Input? This sounds a little strange so it might be useful to describe what I want to do: My microcontroller waits for the charakter “m” then it starts a measuring cycle and outputs the data on the serila port. On the PC-side I thik for a batch file that will send “m” to the microcontroller, recive the measured data and append them to a file on the harddisc.
The whole thing is surrounded by some commands that crate a new file every day and include a header line as first line in the logfile. This batch file will be started at fixed times as a scheduled task So this is the idea for the batch: file MODE COM25 BAUD=9600 PARITY=N DATA=8 STOP=1 rts=off dtr=off for /f%%a in (‘date /t’) do set dat=%%a if exist “c: Temp Heizung Logfile_%dat%.csv” goto existiert if NOT exist “c: Temp Heizung Logfile_%dat%.csv” goto erzeugen:existiert echo m>. COM25 type COM25 >>”c: Temp Heizung Logfile_%dat%.csv” goto ende:erzeugen type “c: Temp Heizung Header.csv” >“c: Temp Heizung Logfile_%dat%.csv” goto existiert:ende Unfortunately the “type com25 >>logfile” does not work as explained above. On the other hand if I could stop ComPrinter after one line ( symbolized by the /STOP1LINE parameter) I could replace the “type com25″ command by the two following lines: ComPrinter.exe /quiet /devnum 25 /baudrate 9600 /STOP1Line >>Daten.txt type Daten.txt >>”c: Temp Heizung Logfile_%dat%.csv” Best regards michael. Hello again Michael, I’ve just been reading around a bit and I have a different suggestion you might try: • Stick to using the type command, but specify the full device file name for the COM port, because COM ports above COM9 apparently require the full name (“.
COM25” in this case) to be specified, as mentioned somewhere on. COM25 >>'c: Temp Heizung Logfile_%dat%.csv' • Program your microcontroller to send a at the end of the transmission to simulate “end of file”. As far as I know, Ctrl-Z is ASCII character 26 decimal (0x1A in hex).
• My hope is that the type command will interpret the Ctrl-Z as the end of the “file” and exit at that point. The reason I think that is because of what I read I suggest updating the microcontroller code first and then checking whether the Ctrl-Z trick works by typing in the ECHO and TYPE commmands manually at the command line. If the type command doesn’t finish running when it should, then apparently Ctrl-Z is not the right terminating character. To test (once you’ve updated the microcontroller to send Ctrl-Z), type in something like this at the command line: echo m >.
COM25 >>'test.csv' By the way, that echo command may send a couple of additional characters after the “m”, such as a line feed or whatever, so make sure your microcontroller code is prepared to receive (and presumably ignore) other characters that might be transmitted. Ok, give that a try and see what it does! I’m kind of guessing at the solution here, but I’m sure it should be possible to make something like that work. Hi Ted, thank you for your engagement, The fact that the echo command sends a little mor than solely “m” is no problem: th e microcontroler does what he is expected to do after the “echo m >. COM25” command Unfortunately I have already tried what you suggested.
I also tried different “end-codes” like CTRL-D, but the problem is that the command type. COM25 >>“test.csv” results in an error message that the “syntax for filename, foldername or volume is wrong” There must be a problem with the name: if I test the command with. Com1 instead of. Com25 the same error message occurs. However “type COM1 >>“test.csv”” waits for input from the com port as it should. Hi Michael, I’ve been hunting around for more information online and I’ve discovered several examples that include a colon character after the filename of the COM port device. For example: type COM1: >test.txt I’m not sure exactly what that colon means, but it’s in quite a few of the examples I found, so it’s definitely worth a try.
Derana Dream Star Season 4 Theme Song Mp3 Free Download more. Maybe one of the following will work? COM25: >Daten.txt or this c: >type '. COM25:' >Daten.txt or this c: >type '. COM25': >Daten.txt Here are a couple of the links where I found the examples I mentioned: By the way, can I just check that you’re typing in these commands into the command window, rather than cutting and pasting? The reason I ask is that the inverted comma characters are sometimes converted into different (but similar looking) characters from the normal keyboard inverted commas character. In some of the comment on this page for example, the inverted commas characters have been magically transformed into ’66’ and ’99’ style inverted commas, rather than the plain old inverted commas character you’ll find on your keyboard.
Hi Ted, first of all. Yes I’m typing all characters in th ekeyborad. The reason is that my testcomputer has no netwrok connection so I have to “read and type” instead of “copy and paste”. Concerning the colon, I have allready tried all combinations with and withot colon, inverted commas and so on but all results in the cited error message. I fear it is only a small bit that has to be modified but how to know. I meanwhile have opened a question on the microsoft site my be there comes the solution Best regards michael.
Hello Ted, unfortunately my question in the microsoft forum was not even read by anybody. So I tried to come up with some, admittedly not very elegant, workarounds to solve my problem. I managed to do so with the following code in a batch file: serialsend /devnum 25 /baudrate 9600 “m” start “COMREAD” cp.bat sleep 3 set pid=LEER for /F “tokens=1,2,3,4,5,6,7,8,9,10,11 delims= ”%%a in (‘TASKLIST /V’) do IF “%%a”==”cmd.exe” IF “%%k”==”COMREAD” SET pid=%%b Echo Beende CMD.exe (PID:%pid%) taskkill /pid%pid% set stempel=%dat%%zeit%, set /p =%stempel%>”c: Temp Heizung Logfile_%dat%.csv” type “Daten.txt” >>“c: Temp Heizung Logfile_%dat%.csv” echo. >>”c: Temp Heizung Logfile_%dat%.csv” cp.bat consists of one line only: comprinter /baudrate 9600 /devnum 25/quiet >Daten.txt As I mentionned earlier your program comprinter can access the com port and I can redirect its output to a file. The problem was that comprinter does not read only one line from the serial port but stays listening there “ad infinitum” and so no further communication via this port was possible.
This problem was solved with the aid of a colleague who had the idea to use the “Start” command which starts a new instance of cmd.exe and running comprinter there while the original batch job contioues and after waiting three seconds stops comprinter via taskkill. Unfortunately the first attempt via “start Comprinter” and afterwards killing the comprinter process or its correponding cmd instance, resulted in an empty data file. However starting a batch fle in a new cmd instance and killing this new cmd instance results in a data file containing the information read from the serial port. The rest is just file handling to copy together the measured date and the time stamp and appending them to the log-file. Only one special thing is required additionally: with this brute termination of comprinter the data file always contained only the data-string but not the CR/LF at the end; even if multiply CR/LFs were sent by the mircocontroller. So I had to insert such a CR/LF by hand via the “echo.
“command in the last line. Using the “echo “m” >. Com25″ command worked, but I feared that it might happen that the unnecessary control characters that are transmitted by this command too, might cause a buffer overrun after multiple repetition of the whole job.So I now use also your “serialsend” because with this I a am sure that only the “m” is sent. So with the aid of your tools I could solve my problem finally. Thank you very much. Another positive aspect of using cour programs is that they also work with lower com port numbers, so there is a chance to use the whole thing in combination with hardware com ports, too. Finally I just have one last question: what are the OS-requirements for your serialsend and comprinter programs?
What is the oldest windows version under which the will work? Or might they even run under Win3.11 or MS-DOS? The queston is motivated by the fact that with this whole thing I would like to monitor the heating and warm water supply system of a friend and of course I don’t want to leave a very modern computer in his cellar infinitely running this batch jobs. So thank you once again for your help michael.
Hi Michael, I’m actually not 100% sure which operating systems this program will work with, but I would be very surprised if it works in Win 3.1 or DOS because it’s basically a Win32 program and hence 32-bit, whereas those operating systems are 16-bit. If I was going to use an old PC to do something like this, I’d probably go for Linux rather than an old MS operating system. Something to keep in mind though is that older PCs tend to be much less energy efficient, so leaving it running constantly could use a significant amount of energy in the long term.
Maybe you could use a Raspberry Pi or something similar? Doing a bit of serial communication automation using Python on the Raspberry Pi would be nice way to do this! Hi Ted, to be honest mentioning Dos or Win3.XX was an, admittedly not too good, joke since they do not support USB.
However I seriously thought about a WinME but meanwhile it seems as I could arrange an old WinXP notebook, so everything should work. Concerning the energy consumption you are right of cours. The present Idea is to use the arrangement during this heating period until next spring with the old notebook. If my friend then is still fond of the data “flood” we will change to a Raspberry Pi. For me this would have the advantage to have a real project urging me to get familiar with this nice thing. For me there is the problem that if there is no real application I’m a little bit missing the drive to deal with these things just for fun So in the end for my problem I didn’t really find an elegant solution but at least some workaround that I will use until next year.
When switching to a Raspberry Pi the situation might be somewhat easier. I strolled a little bit around in the web and found some pages dealing with combining a Pi and an arduino, what is exactly what I will need. Best regards michael. We are a team of 4 engineers from Egypt working on a Flight Simulation Rig that rotates 360 degrees on 2 axis. We managed to build the simulation Rig and test it with a game (HAWX).
It performs pretty well but after a few min of playing a time shift between the simulation and the rig appears. So we decided that we need feedback from the game it self with the plane exact angle of rotation on both x an y axis so we can compare it with the cabin orientation using the gyro on it, and the best way to do that is build a simple flight sim game using Cry engine and take the needed readings from it. So here is the question: Is it possible to send the plane angles of rotation data over serial bus in real time to our micro controller? And if it is, can some one point us towards a similar project or a guide for how to do it. We really appreciate your feed back, it would really help us a lot. And best regards. Hi Mina, Sounds like you need a terminal emulator program or something like that.
PuTTY is what I normally use. Maybe you could launch PuTTY and use that?
See here It may be possible to connect to a serial port via telnet as described here (see last answer): However, you might need to enable telnet to try that. See here for Windows 7 instructions Alternatively, perhaps you could use Microsoft’s PowerShell? See here for an example of controlling a serial port from a Windows console Hopefully something there might get you closer to a solution! Thanks for the suggestion Vladimir. I’ve never heard of Docklight before, but since it’s an additional piece of proprietary software that you need to install (or at least download?) onto the machine, rather than just using functionality that’s already built into the Windows terminal (as described above), it doesn’t seem directly comparable to me. For example, I sometimes find myself working on someone else’s machine where it’s not really appropriate for me to install additional software, but I want to send data to a serial device. In that situation, it’s nice to be able to just send a few bytes from the Windows terminal.
Nevertheless, it does seem likely that something like Docklight will be better suited to some users’ needs. Hi Johns, It sounds like you’re trying to do the opposite of what’s shown in this example. You’re receiving data from a serial device (rather than sending data to a device) and you want to trigger a certain action each time a specific string is received.
I have no idea whether teraterm can help you automate this, but maybe it’s possible to set up a scripting solution using that (or another terminal / serial debugging program). Personally, I recommend installing Python and PySerial if you want an easy and flexible way to automate interaction with a serial-connected device. That’s what I use when I need to set up something quick that requires two way interaction. In your case, you would just need to write a short Python program to open the serial device and read incoming strings, checking each one to see if it matches the required one.
When you get a string that matches, you would just run whatever action you want. On Windows 7 (at least): Try typing `chgport /?` and see if you have that program. If you do, `chgport COM#=COM##` will map a double digit port to a single digit port (assuming it isn’t already in use. Use mode to see what ports exist and pick a single digit one that doesn’t.) So, for example `chgport COM5=COM50` when then allow `type COM5:`.
The trick is that unless you have hardware handshaking, the data is already gone before the PC can read it. For example, I have a board the sends back a full message like “ABCDEFGHIJKLMNOPQRSTUVWXYZ” in response to a “?” and if I send `echo?>COM5: && type COM5:` I get about “HIJKLMNOPQRSTUVWXYZ”.
It might work ok with xon=on but my board doesn’t support that yet.