How does RealTerm send Numbers

5,896

If you're using the Send Numbers button after typing a decimal number (or several or they could be hexadecimal, etc.), it's sending the character that corresponds to that code. In PuTTY, if you want to send an ASCII 65 (decimal) then you'd type an "A". If you want to send an ASCII 11 (decimal - Vertical Tab) you could press Ctrl-K or hold down the Alt key and type 11 on the numeric keypad.

Without knowing what you're communicating with, what it expects for input, whether you have PuTTY configured properly, etc., that's the best I can do.

Share:
5,896

Related videos on Youtube

tushark
Author by

tushark

indian tech geek / entrepreneur from japan, columbia engineering (@cuseas) grad, project manager / marketing @socialbicycles

Updated on September 17, 2022

Comments

  • tushark
    tushark almost 2 years

    How does RealTerm send numbers? For some reason, when I enter a number under the "Send" tab to be sent over the serial line in RealTerm, it works, but inputting the same commands in PuTTY through the command line does not work. What is the reason for this?

  • tushark
    tushark over 13 years
    Thanks for the answer. I am trying to communicate with an iRobot series 500 Roomba. I am not quite sure what it expects and trying to figure that out. The iRobot SCI documentation lists opcodes which can be sent to the Roomba to control it. Right now, I am trying to send the two opcodes 128 and 133 to the Roomba. In Realterm, all I have done is go to the "Send Numbers" button. In PuTTY, I have tried communicating with the serial port using the same baud & other config + forcing local echo and line editing on, to no avail. Can you help?
  • Dennis Williamson
    Dennis Williamson over 13 years
    @tushark: I'm not familiar with communicating with or controlling a Roomba. Are those opcodes decimal byte values or ASCII digit characters? It seems like they are the former. If you hold down Alt and press 128 on the numeric keypad and release Alt do you get any response? Is the Roomba showing any startup output (copyright message, prompt string, etc.) when you use PuTTY? Since RealTerm works, why not continue using it?
  • Dennis Williamson
    Dennis Williamson over 13 years
    @tushark: Now that I've had a chance to glance at the docs, I see that they are byte values so there's a good chance that the Alt key technique will work. By the way, I don't see an opcode 133 documented.
  • tushark
    tushark over 13 years
    @dennis-williamson I am trying to figure out the data type that I need to send to the Roomba and don't have a numeric keypad. I was using PuTTY / RealTerm to debug and need to figure out how to send the opcodes because I'm writing a program in PHP for the Roomba. Someone wrote a PHP serial class, so I can communicate with the Roomba, but the Roomba doesn't seem to be accepting any of my commands. StackOverflow question
  • tushark
    tushark over 13 years
    @dennis-williamson Thanks for looking at the docs. Is there another method which doesn't use a numeric keypad? The 133 opcode is for powering the Roomba on and off. Thanks for the help once again!
  • Dennis Williamson
    Dennis Williamson over 13 years
    @tushark: Are you using a laptop? Does it have a Fn-key overlaid numeric keypad? Fn-Alt-j would be a one, Fn-Alt-u would be a four. Otherwise you could use the Windows Character Map and paste characters from it to PuTTY. A 128 would be a hex 80. The character you see would depend on the font (but wouldn't affect what the Roomba sees). You said RealTerm works. Why don't you stick with it? The docs indicate that the Roomba could appear to hang if it's expecting data bytes that it hasn't received after an opcode that requires them. I'm assuming you've cycled power manually to start fresh.
  • tushark
    tushark over 13 years
    @dennis-williamson I am using a laptop, but it doesn't have an overlaid numeric keypad. I tried the Windows character map, but unfortunately, selecting the numbers there and pasting it in doesn't work (it just shows numbers for the characters). I don't really want to use either PuTTY or RealTerm - I'm trying to figure out how to convert to the necessary data type in PHP (StackOverflow question referenced above). In doing so, I decided to try and get it to work in PuTTY and now I would like to figure that out before programming even further. Thanks for the repeated help!
  • Dennis Williamson
    Dennis Williamson over 13 years
    @tushark: Never mind regarding Char Map. I just did some testing and it wants to deal with everything in Unicode. You wouldn't select the digits there, by the way. If it worked you'd select the character that corresponded to the byte value (it would be something like "Ç"). Here's how you can output a decimal 128 byte in PHP from the command line using the hex equivalent: php -r 'print "\x80";'. You should be able to do something similar to send that byte over the serial line using the serial class you mentioned.
  • Dennis Williamson
    Dennis Williamson over 13 years
    @tushark: By the way, you can also do the output in decimal like this: php -r 'print chr(128);' or php -r 'printf("%c",128);'.
  • Dennis Williamson
    Dennis Williamson over 13 years
    @tushark: It allows you to run short code snippets from the command line without needing <?...?>. I don't know why the first two variations you tried didn't work, but the last one isn't likely to. The way you'd probably need to do that might be something like $char = sprintf("%c",128); $serial->sendMessage($char);. All three are essentially the same. (The sendMessage() function takes an optional wait time as a second parameter, so your third form seems to hang because you told it to wait for 128 seconds.) If these aren't working then the communication parameters aren't set correctly...
  • Dennis Williamson
    Dennis Williamson over 13 years
    ... or there's something wrong. Does it work properly using RealTerm?
  • Dennis Williamson
    Dennis Williamson over 13 years
    @tushark: I would think PHP should be capable of doing this. Unfortunately serial communication is sometimes a nightmare to deal with. Assuming that RealTerm is actually working and making your Roomba perform actions (I'm still not 100% sure since you haven't directly answered my question(s) regarding that), then there's no reason it shouldn't be possible. I've only written stuff for the web using PHP and I'm very rusty even on that so I have no idea whether the CGI version of PHP can do what you want. When you call $serial->deviceOpen() what mode are you using for its argument? It should...
  • Dennis Williamson
    Dennis Williamson over 13 years
    ...be r+b or rb or omitted (to use the default which is r+b).
  • Dennis Williamson
    Dennis Williamson over 13 years
    Are you connecting using a USB to serial adapter which has lights on it? If so, do the lights change when you try to communicate with the Roomba? If it's a regular serial cable can you buy or borrow a serial breakout box with status lights (similar to this )?
  • tushark
    tushark over 13 years
    @dennis-williamson I am out of the house right now, but I wanted to thank you for your help and answer a few of your questions. I am already using a USB to serial adapter with lights on it (which is how I know I am communicating with the Roomba - it lights up in the direction of sending information to the Roomba). Using RealTerm, I can communicate with the Roomba directly using the Send Numbers function (if I try to communicate any other way, it sends every keypress). Also, I call $serial->deviceOpen(); just like that? Should I be sending an argument? Thanks for the help once again!
  • Dennis Williamson
    Dennis Williamson over 13 years
    @tushark: Without an argument, it uses the default of r+b which is suitable for your use. Maybe you could edit your question and post your code and I could look at it.
  • tushark
    tushark over 13 years
    @dennis-williamson Would it be more appropriate to edit my StackOverflow question since this is now programming related? I'll post code as soon as I get back. Thanks again for the help!
  • Dennis Williamson
    Dennis Williamson over 13 years
    @tushark: Probably so, please leave a reply here when you do so I get the notification. By the way, only the first three characters are needed so you can say @Dennis instead of using my whole name.
  • tushark
    tushark over 13 years
    @Dennis I added the code to the Stack Overflow question. Thanks for the help!