View previous topic :: View next topic |
Author |
Message |
jecottrell
Joined: 16 Jan 2005 Posts: 559 Location: Tucson, AZ
|
LCD Cursor Quickie |
Posted: Wed Oct 05, 2005 1:33 pm |
|
|
I'm getting deeper into displaying menu pages and I need to be able to enter 3 digit numbers. I am writing the routines that will accept the keypresses and display the numbers. I would like to use a cursor on pages that require data entry and no cursor on pages that don't. From my searching I see that cursor attributes are set during the lcd_init.
How can I change cursor attributes (cursor on and flash) on the fly? Do I just re-init the LCD with each change? Or can I just set the new attributes?
Thanks,
John |
|
|
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
|
jecottrell
Joined: 16 Jan 2005 Posts: 559 Location: Tucson, AZ
|
|
Posted: Wed Oct 05, 2005 3:15 pm |
|
|
Thanks PCM,
I had found your post in my readings and I had pasted those parameters into my lcd.c file for future reference . I just wasn't sure about how to set just the cusrsor stuff.
John |
|
|
edhaslam
Joined: 15 Jul 2005 Posts: 89 Location: UK
|
Re: LCD Cursor Quickie |
Posted: Fri Oct 07, 2005 2:46 am |
|
|
jecottrell wrote: | I'm getting deeper into displaying menu pages and I need to be able to enter 3 digit numbers. I am writing the routines that will accept the keypresses and display the numbers. I would like to use a cursor on pages that require data entry and no cursor on pages that don't. From my searching I see that cursor attributes are set during the lcd_init.
How can I change cursor attributes (cursor on and flash) on the fly? Do I just re-init the LCD with each change? Or can I just set the new attributes?
Thanks,
John |
John,
Do you have any good links to menu building and in particular inputting data to an LCD via the keypad? I too am about to embark on this for a project I'm working on.
Ed |
|
|
jecottrell
Joined: 16 Jan 2005 Posts: 559 Location: Tucson, AZ
|
|
Posted: Fri Oct 07, 2005 9:11 am |
|
|
No, I didn't find any silverbullets or snippets that prevented large amounts of coding.
I am using a "state machine" scheme. I store menu lines in EEPROM and when I change from one state to the next I send the new menu display to the LCD. (I send the menu display to the LCD upon leaving the previous state.) Search for "state machine" and you'll find a simple boilerplate using switch statements. That was my starting point.
To enter digits for numerical data just think about this:
display = (display * 10) + keypress
BTW, I have found specific questions (usually from at least attempting the task) get answered very quickly in the forum. General questions don't elicit many responses because they imply an attempt hasn't been made. I'm new to all of this and I like to ask general questions too. Mostly about "which is better", etc. But they don't generally get much interest.
Good luck,
John |
|
|
|