Microcontroller Programming » Writing to Hyperterminal
May 17, 2011
As an alternative for getting value feedback from the LCD, I decided to use hyperterminal instead, however, the screen gets filled with numbers.
Here is my code
This works fine
I am trying to send a hex command to hyperterminal so that it causes a carriage return. I have the VT100 command which is 0x0D. I looked at the forum and couldn't find anyone talking about this.
I tried to follw up with this line without success
At present, my sensor is printing the following values on Hyperterminal filling the screen making me crosseyed.
ba 2387 2386 2388 2391 2390 2391 2392 2391 2392 2391 2392 2392 2391 2392 2392 23 91 2392 2391 2392 2392 2391 2391 2392ba 2388 2386 2389 2390 2392 2392 2391 2392 2391 2392 2392 2391ba 2388 3337 2820 2387 3323 2784 2388 3322 3039 2390 3319 304 7 2392 3319 3031 2391 3321 3124 2392 3318 3082 2392 3318
How do I send a hex command using the Atmega168 to Hyperterminal?
Again, I found this to be a good alternative to having the LCD as a feedback mechanism taking up 6 ports on the chip.
May 17, 2011
You can put the carriage return in the format string.
Should do the trick.
May 17, 2011
That worked. Thank you. I now have a single row which helps the eyes... but I want to clear the screen and I wonder if there's some way to do this. I did some more digging and came up with this. I know others may benefit.
If you read through, you'll see I have code here that doesn't work but I think it should
it didn't work, then I tried
it didn't work either (no errors on both, it just didn't work)
I hard set my hyperterminal session to ANSI then VT100, still, it didn't work. The screen did not clear when I ran the code.
Here's what I got from the net and added to help others.
Al (Alberto(full name));
printf_P control hyperterminal screen Backslash escape sequences
\" = double quote
\ = backslash
\a = alert (bell)
\b = backspace
\c = produce no further output
\f = form feed
\n = new line
\r = carriage return
\t = horizontal tab
\v = vertical tab
\ooo = octal number (ooo is 1 to 3 digits)
\xhh = hexadecimal number (hhh is 1 to 2 digits)
\uhhhh = 16-bit Unicode character (hhhh is 4 digits)
\Uhhhhhhhh = 32-bit Unicode character (hhhhhhhh is 8 digits)
%b = print an argument string, interpreting backslash escapes, except that octal escapes are of the form 0 or 0ooo.
The `format' argument is re-used as many times as necessary to convert all of the given arguments.
ANSI HEX CODES
If you want to send hex code to control the terminal screen, you have to first send an escape sequence hex 1Bh and a left bracket hex 5Bh ANSI escape sequence is a sequence of ASCII characters, the first two of which are the ASCII "Escape" character 27 (1Bh) and the left-bracket character " [ " (5Bh). The character or characters following the escape and left-bracket characters specify an alphanumeric code that controls a keyboard or display function.
Then add your code.
Esc[2J Erase Display:
Esc[K Erase Line:
For more hex codes search under "ANSI escape sequence" or the like.
Please log in to post a reply.