I need help on who to write a program using LCD display and 5 buttons which wil
Potato
Posts: 18
The purpose of this program is to display 6 characters on a serial display, allow me to edit the characters, one at a time and when done send the characters out my serial port. I have 5 input buttons, Up, Down, Left, Right, Enter. I want to start with the value ABC123. and display it on the screen. The first character blinking indicating it was the character to change. Press the up button and the first character would change from A to B or the down button would change from A to Z. When satisfied with the letter, I want to press enter and move to the next character.
MY PROBLEM, I don't have a clue as to where to start. Has anyone seen examples of such code? I don't want to re-invent the wheel. I think someone must have done that before me.
All help would be greatly appreciated. Rick
MY PROBLEM, I don't have a clue as to where to start. Has anyone seen examples of such code? I don't want to re-invent the wheel. I think someone must have done that before me.
All help would be greatly appreciated. Rick
Comments
Of course there are many ways to do that and it depends on what else you want to do.
The easiest way is to have one COG updating the display including the blinking:
repeat
1. copy string from global buffer to internal buffer
2. if it's character off-time, overwrite the character at 'actualPos' with space
3. set the display cursor to the string position
4. write the string
5. wait for some ms
6. decide if it's on- or off- time
Then the second COG would be used to read the buttons and update 'actualPos' by hitting left/right/enter and update the character by hitting up/down in the global buffer.
Rick
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Jon McPhalen
Hollywood, CA
With a parallel LCD (4 bit bus) it's much easier! Grab my LCD driver and set it up in 'screen buffer'-mode and use a blinking character to show the active character. The refresh and blinking is done by the driver. ;o)
How about inverting the actual character instead of blinking. Is it possible to read the font data from an LCD display? Maybe I'll take that as an exercise the next days .... maybe not - currently busy with my driver model.
Rick
This kind of thing is possible; I once created a rolling digit odometer type display using a BS2p and a table with a rotating digit pattern. In the display I used custom character 0 for the rolling digit. Since the LCD auto refreshes any time I changed the character map the display automatically updated. It was a neat effect.
[noparse][[/noparse]Edit] As a quick mental warm-up before I tackle a work project I tried the inverted character approach -- but just on the digits so I didn't have to build a big table. For some digits it looks nice, not so much with others. I don't think I would use this approach. BTW... you don't have to manually create character maps. When working at Parallax in 2001 I wrote a little program called LCD Character Creator and it has the standard character maps built in.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Jon McPhalen
Hollywood, CA
Post Edited (JonnyMac) : 5/21/2010 6:13:47 PM GMT
Rick