Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

Escape sequence with hyperterminal question

Status
Not open for further replies.

Hopperito

New Member
How do you send an escape sequence to hyperterminal to clear the screen? I have a char array with a bunch of response phrases for rs232, and the standard '\r\n' works, but '\[2J' doesn't work.
 
I'm afraid you have to send this string, and other useful strings, manually... They're not supported as part of the string functions like "\n" and "\r"...

; <esc><"["><"A"> = up-arrow
; <esc><"["><"B"> = down-arrow
; <esc><"["><"C"> = right-arrow
; <esc><"["><"D"> = left-arrow
; <esc><"["><"E"> = ?
; <esc><"["><"H"> = home cursor
; <esc><"["><"J"> = clear from cursor to end of screen
;
; <esc><"["><"YY"><";"><"XX"><"f"> = goto y,x

Please let me know of any other funtions you discover?

Regards, Mike - K8LH

Code:
;  greeting string
;
sHello	db	0x1B,"[H",0x1B,"[J"	;home cursor & clear screen
    	  db	"K8LH F4620 Loader v2.0\r\n\n\0"
 
Hop', I just tried the <esc>"[2J" sequence and it works great... I didn't know about this sequence so I'm really pretty "geeked" about saving two bytes to perform the same task as <esc>"[H" <esc>"[J" (grin)...

Thanks buddy... Regards, Mike - K8LH...
 
Hop', I just tried the <esc>"[2J" sequence and it works great... I didn't know about this sequence so I'm really pretty "geeked" about saving two bytes to perform the same task as <esc>"[H" <esc>"[J" (grin)...
:D

How do you get the <esc> into a string? In my case, all the following strings work by using
Code:
putrsUSART (rs232ResponseString[x]);
Code:
const rom char *rs232ResponseString[] = 
{ 
	"UNUSED SLOT #0\n\r",
	"PIC 18F452 [Display Effects Project] ID[452_02] SELECTED\n\r",
	"PIC 18F452 [communications] ID[452_01] SELECTED\n\r",
	"UNUSED SLOT #3\n\r",
	"UNUSED SLOT #4\n\r",
	"UNUSED SLOT #5\n\r",
	"UNUSED SLOT #6\n\r",
	"UNUSED SLOT #7\n\r",
	"UNUSED SLOT #8\n\r",
	"UNUSED SLOT #9\n\r",
	"200 OK\r\n",			
	"404 NOF\r\n",
	"Invalid key (0-9 only)\n\r",
	"\n\rCommand\n\r]",
	"USART PROJECT VERSION 1.02 - Revision 01.22.05\n\r"
};
 
OK, using a bootloader has opened up a lot of possibilities. I had to learn about SPI because I got these LED display driver chips from MAXIM and I have to communicate with them using either IC2 or SPI. I have it wired up, but then I realized that I need to solve other issues, about how to send escape codes to my PC, format numbers into strings to send, and set up a command interface with this serial device attached to my 18F452. That generated a huge list of questions for this project.

I solved the escape code issue. Thanks Mike for the assembly solution, but I couldn't get it to work because I'm still learning about variables, and pointers in C, so I went back to the library PDF for C18, and I discovered 'putcUSART'. How I overlooked it before, I don't know, but I use it to send 0x1b, then the rest of the escape code, and it WORKED! Now I'm trying to buffer the bytes from my PC, and setting a flag when ENTER is pressed to let my program know when a line of text is ready to be processed. Now I can reset my PIC, read and write data to my MAX6954, and I even included a 'CLS' command for old times sake.

Thanks guys (Mike K8LH, and Nigel) for helping me so much. I couldn't be where I am now without your help!!!
 
Status
Not open for further replies.

Latest threads

New Articles From Microcontroller Tips

Back
Top