|
|
View previous topic :: View next topic |
Author |
Message |
Neckruin
Joined: 17 Jan 2006 Posts: 66
|
Smart LCD usage |
Posted: Thu Oct 12, 2006 1:50 am |
|
|
Hello all,
I'd like to ask for some suggestions about LCD usage. I'm developing a project in wich I have to use an LCD to show a big ammount of different messages, menus, scroll then, select options, etc. The problem is that this is the first ever time I use an LCD.
I'm using PIC16F877 and 20x4 LCD from Powertip. I have already found PCM's flex_lcd420.c and tried a bit, showing some messages and similar.
Now I'd like to ask you for suggestions on some topics that I have found while thinking about the problem. Let's go!
1st: I have to show a big ammount if different messages, so they can not be allocated in RAM, they must be constants on program memory. Is this the best option? In case it is... how can I force them to be allocated in PM?
2nd: Some of the messages I have to show are composed by a constant part and a variable one. For example: "Status = X", where X can be one of several strings like "OK" or "BUSY". How can I combine fixed and variable strings to show them in the best way to save as much memory as possible (16F877 has very few mmory)?
3rd: The menu. I have to show a menu and scroll it. Any suggestion about how to move the menu? I also have to know where the focus is, I mean, which option from the menu the user has selected and feedback him in some way (by showing that line different). How can I do that?
Well, at the moment I think this is all. I'm looking forward to hear your suggestions. If I find any extra trouble I'll post it here as well.
THANK YOU VERY MUCH IN ADVANCE!!!
Yours,
Juanma |
|
|
Mattr0
Joined: 27 Mar 2005 Posts: 30
|
|
Posted: Fri Oct 13, 2006 10:17 am |
|
|
Juanma,
I have used many LCDD screens in my designs. I agree with you that you do not want to store the messages in ram. You want to define them as a constant like this.
Code: | const char menu1[]="Option1"; |
this will store the string Option1 in PM memory. to get it to the LCD screen use the printf command
Code: | printf(LCD_PUTC, "%s",menu1); |
this will print Option1 on the LCD.
also look at the LCD420.C it is included with the compiler. The printf command would be compatible with this driver.
The printf command is also how you would create varible strings
for example
Code: |
int x = 57;
char good[] = "ok";
printf(LCD_PUTC, "%s %u %s",menu1,x,good);
|
this will print
Option1 57 ok
on the LCD screen
you should look at the printf command for more options
asfar as the menu goes make a state machine out of it. It will be the easiest way to handle it.
good luck |
|
|
Neckruin
Joined: 17 Jan 2006 Posts: 66
|
|
Posted: Sat Oct 14, 2006 4:05 am |
|
|
Thank you very much Mattr0
Your comments will be really useful for me.
Thanks a lot again. |
|
|
|
|
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
|