View previous topic :: View next topic |
Author |
Message |
evsource
Joined: 21 Nov 2006 Posts: 129
|
Any slick ways to do a menu without \f? |
Posted: Tue Mar 13, 2007 5:30 pm |
|
|
I'm working with a couple different applications where I'm creating a user interface menu to be used in a terminal program (e.g. Hyperterminal).
I've just been re-displaying the entire menu (along with some operating parameters that change regularly) every couple of seconds. I just clear the screen with \f, and write the whole thing out.
Problem is, the refreshing of the screen every few seconds is slow and gets to be annoying. I'm wondering if anyone has used a more eye-pleasing method, and if so, how you're doing it.
The only thing I've been able to think of is to Write out the basic information that doesn't change much (such as menu choices), and for the parameters that are changing, just backspace the entire line and re-write that/those lines every time they change. Still seems un-sophisticated.
Thanks in advance! |
|
|
jds-pic
Joined: 17 Sep 2003 Posts: 205
|
|
Posted: Tue Mar 13, 2007 7:32 pm |
|
|
most likely the LCD you are using supports absolute cursor positioning -- that is, you can move the cursor to [X,Y] using built-in LCD commands. take advantage of this to rewrite only the sections that change.
since you did not post the model of the display you are using, i can not help you with determining what the exact command sequence would be.
jds-pic |
|
|
evsource
Joined: 21 Nov 2006 Posts: 129
|
|
Posted: Tue Mar 13, 2007 10:52 pm |
|
|
jds-pic wrote: |
since you did not post the model of the display you are using, i can not help you with determining what the exact command sequence would be.
jds-pic |
Thanks for the response.
Actually, I did specify that the menu was to be displayed in a terminal program, e.g. Hyperterminal. It's an RS-232 connection from the PIC to a computer, with the data being displayed on the computer screen (from within the terminal program).
Does that make it more clear?
So I don't think coordinate positioning would work. |
|
|
hp
Joined: 07 Sep 2003 Posts: 4 Location: Texas
|
|
Posted: Wed Mar 14, 2007 12:29 am |
|
|
Take a look at ansi escape codes. These escape sequences are standardized and recognized by many consoles, terminals, etc. It is also how text gets colored in the linux terminal.
I have used this method in a few projects. One of which was to digitalize video and display pixel values in a grid. I was able to use a goto xy type ansi sequence to overwrite parts of the screen which is much faster than clearing and redrawing.
http://en.wikipedia.org/wiki/ANSI_escape_code |
|
|
libor
Joined: 14 Dec 2004 Posts: 288 Location: Hungary
|
|
Posted: Wed Mar 14, 2007 4:36 am |
|
|
I suggest buffering the screen contents in the PIC's ram implementing a virtual copy of the LCD.
I have a char array that holds the actual characters 'on screen'. My lcd_write() routine first checks each character to be written if they're really needed to be sent into the lcd. It sends them to the LCD only if they differ from the LCD's contents in that particular position and also keeps the ram-copy updated.
Doing so, you can save a lot of unnecessary (slow) port communication between the PIC and the LCD without any logical change in your main code logic with a very fast ram-compare loop overhead only.
You can also add your own escape sequences or a parametered version to this routine, like 'clear till end of line from here' or 'jump to x,y position' etc.
Added later:
Oops. Sorry. I was also misled like the first poster, not reading carefully it was not about LCDs.
Anyway I suggest to keep a ram-copy of your hyperterminal-menu in the PIC minimizing the serial communication. |
|
|
jds-pic
Joined: 17 Sep 2003 Posts: 205
|
|
Posted: Wed Mar 14, 2007 3:18 pm |
|
|
[quote="evsource"] jds-pic wrote: |
So I don't think coordinate positioning would work. |
it will.
i'm not sure if hyperterminal supports vt100 emulation, but if it does not then ditch it and use something that does. then have the PIC send vt100 cursor postioning codes to the PC.
see the "cursor control" section of
http://www.termsys.demon.co.uk/vtansi.htm
jds-pic |
|
|
|