CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to CCS Technical Support

Any slick ways to do a menu without \f?

 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
evsource



Joined: 21 Nov 2006
Posts: 129

View user's profile Send private message

Any slick ways to do a menu without \f?
PostPosted: Tue Mar 13, 2007 5:30 pm     Reply with quote

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

View user's profile Send private message

PostPosted: Tue Mar 13, 2007 7:32 pm     Reply with quote

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

View user's profile Send private message

PostPosted: Tue Mar 13, 2007 10:52 pm     Reply with quote

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

View user's profile Send private message

PostPosted: Wed Mar 14, 2007 12:29 am     Reply with quote

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

View user's profile Send private message

PostPosted: Wed Mar 14, 2007 4:36 am     Reply with quote

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

View user's profile Send private message

PostPosted: Wed Mar 14, 2007 3:18 pm     Reply with quote

[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
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group