Search code examples
cmicrocontrolleruart8051

UART, return to the start of the page


Is it possible,somehow,to return to the beginning of the page, not line, page. Using something like "hello\r" would,obviously, write "hello" and return to the start of the line.

But what about when I am on a second line? So after "hello\n" it would put me on a second line. Can I somehow return back to the 1st line.

From the research I have conducted it seems that you can only operate on 1 line, but I am not 100% sure and thus would like someone to confirm this.

Programming in C and using RealTerm.


Solution

  • RealTerm has an ANSI terminal emulation mode.

    Find the "Display Formatting " configuration dialog and select the Ansi option.

    Now you can embed an escape sequence for Cursor Home much like you embed the newline.

    <ESC>[H
    

    Where, of course, <ESC> means the single character 0x1b. You can implement it like this

    sprintf(buffer, "%c[Hmy text\n", 27);
    transmit(buffer);
    

    or similar.