PDA

View Full Version : Need help with debug



Darrenmac
- 2nd March 2008, 05:47
I have used Debug before and I understand how to use it, It works very well. I am using it to send the value of 3 variables out to a PC.
I need a little help formating the screen for it to look good.
When I have the following in a loop I get a messy scroll of repeated messages down the screen.
debug "Current Voltage =",vc,10,13
debug "Start Voltage =",vst,10,13
debug "Stop Voltage =",vsp,10,13


Current Voltage =12
Start Voltage =11
Stop Voltage = 14
Current Voltage =12
Start Voltage =11
Stop Voltage = 14
Current Voltage =12
Start Voltage =11
Stop Voltage = 14
etc
If I add debug 12 in as well I get only the 3 lines of information and it does not repeat all down the screen but as it refreshes it clears the screen so the effect is a high speed flicker.
Can anyone tell me if there is a way to arrow up, down, left, right with debug?

skimask
- 2nd March 2008, 06:02
This might be what you want, ANSI Escape Sequences...
The table obviously doesn't cut/paste correctly. But if you Google the term mentioned above, you should be able to find the up/down/left/right arrow functions that you want.

Name Escape Code Hexadecimal Description
Reset
Device
<ESC>c $1B $63 Resets all terminal settings to default.
Enable Line
Wrap
<ESC>[7h $1B $5B $37
$68
Enables wrapping text to the next line if text is longer than
the display area.
Disable
Line Wrap
<ESC>[7l $1B $5B $37
$6C
Disables wrapping text; text will be clipped if longer than
display area.
Cursor Home <ESC>[H $1B $5B $48 Moves the cursor to the home position (upper left hand
corner).
Cursor
Position
<ESC>[{ROW};
{COL}H
$1B $5B
${ROW} $3B
${COL} $48
Sets the position of the cursor at ({ROW}, {COL}).
Cursor Up <ESC>[{NUM}A $1B $5B
${NUM} $41
Moves the cursor up {NUM} rows;
{NUM} defaults to 1 if omitted.
Cursor Down <ESC>[{NUM}B $1B $5B
${NUM} $42
Moves the cursor down {NUM} rows;
{NUM} defaults to 1 if omitted.
Cursor Left <ESC>[{NUM}D $1B $5B
${NUM} $44
Moves the cursor left {NUM} columns;
{NUM} defaults to 1 if omitted.
Cursor
Right
<ESC>[{NUM}C $1B $5B
${NUM} $43
Moves the cursor right {NUM} columns;
{NUM} defaults to 1 if omitted.
Save Cursor <ESC>[s $1B $5B $73 Saves the current cursor position.
Restore
Cursor
<ESC>[u $1B $5B $75 Restores the previously stored cursor position.
Erase End
of Line
<ESC>[K $1B $5B $4B Erases from the current cursor position to the end of the
current row.
Erase Start
of Line
<ESC>[1K $1B $5B $31
$4B
Erases from the start of the current row to the current
cursor position.
Erase Line <ESC>[2K $1B $5B $32
$4B
Erases the entire current row.
Erase Down <ESC>[J $1B $5B $4A Erases from the current row down to the bottom of the
screen.
Erase Up <ESC>[1J $1B $5B $31
$4A
Erases from the current row to the top of the screen.
Erase
Screen
<ESC>[2J $1B $5B $32
$4A
Erases the entire screen and moves the cursor to the home
position.
Scroll All <ESC>[r $1B $5B $72 Enables scrolling for the entire display.
Scroll
Section
<ESC>[{SRT};
{END}r
$1B $5B
${SRT} $3B
${END} $72
Enables scrolling only for rows {SRT} to {END}.
Scroll Down <ESC>D $1B $44 Scrolls the display down one line.
Scroll Up <ESC>M $1B $4D Scrolls the display up one line.
Attribute
Mode set
<ESC>[{ATR1};
...;{ATRn}m
$1B $5B
${ATR1} $3B
... $3B
${ATRn} $6D
Sets multiple display attribute settings; any number can be
set. ATRn may be any of the following values:
Standard
Values for
Attribute
Mode Set
0 Reset Attributes
1 Bright
2 Dim
4 Underscore
5 Blink
7 Reverse
8 Hidden
Foreground Colors
30 Black
31 Red
32 Green
33 Yellow
34 Blue
35 Magenta
36 Cyan
37 White
Background Colors
40 Black
41 Red
42 Green
43 Yellow
44 Blue
45 Magenta
46 Cyan
47 White

Darrenmac
- 4th March 2008, 06:37
Thanks Skimask.
That was exactly what I was looking for. A few mor hours and it will be looking sweet.