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.

ASCII character

Status
Not open for further replies.

chandu13

New Member
hay to all

iam displaying 3 sensors data on the HyperTerminal

first row first sensor data
2nd row 2nd sensor data
3rd row 3rd sensor data by using new line (0x0a) & carriage return characters (0x0d).

How to transfer the curser from 3 row to 1st row to continue the sensor data.
What ASCII character I have to use to jump the cursor from ending location to starting location.

Regards

chandu
 
Look up ANSI sequences;

Code:
[FONT=Tahoma,San-serif][SIZE=2][COLOR=#f0ffaa][FONT=Tahoma,San-serif][SIZE=2][COLOR=Black][FONT=Courier,Courier New][SIZE=2] ;------------------------------------------------------------------------------
; ANSI ESCAPE SEQUENCES
; USED TO CONTROL CURSOR MOVEMENTS AND TO ALTER
; THE FOREGROUND AND BACKGROUND COLORS ON THE
; TERMINAL EMULATOR PROGRAM
;------------------------------------------------------------------------------
;------------------------------------------------------------------------------
; ESC[yy;xxH  - Sets cursor position at xx (0-79) and yy (0-23)
; ESC[H       - Homes the cursor (no x or y params sent.
; ESC[nnA     - Moves cursor up nn rows
; ESC[nnB     - Moves cursor down nn rows
; ESC[nnC     - Moves cursor forward nn columns
; ESC[nnD     - Moves cursor backward nn columns
; ESC[2J      - Clears screen and homes cursor
; ESC[6n      - Command for VDT to report its cursor position.
; [B]ESC[[/B]row;column[B]R[/B] - The terminal's reply to previous command.
; ESC[K - Erases from cursor to end of current line.
; ESC[1K - Erases from cursor to start of current line.
; ESC[2K - Erases the entire line.
; ESC[J - Erase from current line thru end of screen.
; ESC[2J - Erase from current line thru top of screen.

; ESC[xx;xxm  - Where xx is parameters according to:
; 0 - All attributes off
; 1 - Bold on
; 4 - Underscore on
; 5 - Blink on
; 7 - Reverse video on
; Text color $30 BLK, $31 RED, $32 GRN, $33 YEL, $34 BLU, $35 VIO, $36 CYN, $37 WHT
; Bkgd color $40 BLK, $41 RED, $42 GRN, $43 YEL, $44 BLU, $45 VIO, $46 CYN, $47 WHT
;------------------------------------------------------------------------------
[/SIZE][/FONT][/COLOR][/SIZE][/FONT]
  [/COLOR][/SIZE][/FONT]
[FONT=Tahoma,San-serif]

[/FONT]
 
The GotoXY ANSI sequence I've used ended with an 'f' char. Not sure what the difference is.

Good luck. Mike

Code:
;
;  GotoXY macro, ESC[yy;xxf,  xx = h'00'..h'79', yy = h'00'..h'23'
;
GotoXY  macro   pX, pY
        movlw   h'1B'           ; the <ESC> char
        call    Put232          ;
        movlw   '['             ;
        call    Put232          ;
        movlw   pY              ; Y pos, h'00'..h'23'
        call    PutByte         ; send as 2 ascii digits
        movlw   ';'             ;
        call    Put232          ;
        movlw   pX              ; X pos, h'00'..h'79'
        call    PutByte         ; send as 2 ascii digits
        movlw   'f'             ;
        goto    Put232          ; all done
        endm
;
;  Print byte in W as two ASCII nybbles
;
PutByte movwf   TEMP            ; save byte                       |B0
        swapf   TEMP,W          ; swap nibbles in W               |B0
        call    Hex2Asc         ; process left nibble             |B0
        movf    TEMP,W          ; process right nibble            |B0
Hex2Asc andlw   b'00001111'     ; mask off left nibble            |B0
        addlw   h'36'           ;                                 |B0
        btfsc   STATUS,DC       ;                                 |B0
        addlw   h'07'           ;                                 |B0
        addlw   0-6             ; ($FA)                           |B0
        goto    Put232          ; print ASCII nibble              |B0
 
Last edited:
ASCII table

hay

thanks for the reply

iam just confuse with you are post.

iam using ATmega32 , codevision AVR & "C" displaying the data on

hyperterminal.

we have any charecters in the ASCII table to jump the cursor from

one position to other position or last line to first line .

Regards

Chandu
 
Hi Gramo,

Not sure I understand your question. Sorry.

Each character in the <esc>[yy;xxf sequence is an ASCII character. If you wanted to place the cursor on the 14th line and 20th column you would send the following characters;

<esc>, '[', '1', '3', ';', '1', '9', 'f'
1B, 5B, 31, 33, 3B, 31, 39, 66

I represented the X and Y positions as a hex byte in my code because it was faster (for me) to convert the byte to two ASCII nybbles.

<added>

Perhaps my "x=" and "y=" comments were misleading? I edited the post to show "xx=" and "yy=". Is that where the confusion was coming from? The macro shows we're working with 'byte' values but that's easy to miss.
 
Last edited:
gramo said:
Yea - I completely mis understood that, thanks for clarifying it, time to play with the idea

You're obviously too young! :p

Such control sequences were commonplace in the early home computing days, make sure though you use a terminal type that supports ANSI - quite a few don't.
 
Status
Not open for further replies.

Latest threads

New Articles From Microcontroller Tips

Back
Top