|
|
| Author |
Message |
Zexston
Joined: 23 May 2007
Posts: 1
|
|
Posted: 24 May 2007, 14:49 PM Post subject: User Interface Example Code? |
|
|
Hello,
I currently have a BasicX LCDX project that I'm going to upgrade to a Zbasic because I need more RAM for COM ports and the need for sting arrays. But for now, I need some help or suggestions with writing code pertaining to menuing options with the LCD and collecting user input data from the keypad, like setting values.
My goal is to have menu options, you know...like, press 2 fro options, press 3 for sensor options, press 5 to enter sensor distance - press 1,5, ENTER key - Return to main menu. Some kind of a sequence like this.
I'm finding that programming the user interface of my project is the hardest part. Any help, code examples or suggestings would be greatly appreciated.
|
|
| Back to top |
|
 |
dkinzer Site Admin
Joined: 03 Sep 2005
Posts: 2593
Location: Portland, OR
|
|
Posted: 24 May 2007, 15:21 PM Post subject: Re: User Interface Example Code? |
|
|
| Zexston wrote: | | I need some help or suggestions with writing code pertaining to menuing options with the LCD and collecting user input data from the keypad, like setting values. |
There was a post a while back on the topic of using a keypad for input and displaying the entered data on an LCD. The code that was included might give you some ideas. See http://www.zbasic.net/forum/about700.html.
Several years ago, I build a controller for a positioning device for a machine tool that had a multi-level menu system. I ended up writing a menu compiler that converted a textual representation of the menu structure along with associated action codes to initialization data for a ProgramMemory data array. That project used a BX-24 but the ideas could be equally well applied to a ZX-based project. See http://www.kinzers.com/don/BX24/Indexer for more information. Additional information regarding the menu compiler can be found on the page one level up from that.
|
|
| Back to top |
|
 |
dkinzer Site Admin
Joined: 03 Sep 2005
Posts: 2593
Location: Portland, OR
|
|
Posted: 24 May 2007, 15:30 PM Post subject: |
|
|
The attached example program shows how one might collect data from a keypad and compose values from the keypresses. Although it is written for a keypad interfaced using ShiftIn(), that part can be easily replaced.
| Description: |
| Example program for getting values from a keypad. |
|
 Download |
| Filename: |
keyboard.bas |
| Filesize: |
8.01 KB |
| Downloaded: |
2879 Time(s) |
|
|
| Back to top |
|
 |
victorf
Joined: 01 Jan 2006
Posts: 342
Location: Schenectady, New York
|
|
Posted: 26 May 2007, 18:46 PM Post subject: |
|
|
| Quote: |
There was a post a while back on the topic of using a keypad for input and displaying the entered data on an LCD. The code that was included might give you some ideas. See http://www.zbasic.net/forum/about700.html.
|
I was the original poster of that thread. My system uses a Seetron TRM-425 4X20 display with a 4X4 keypad interface and I am quite happy with the results. The display allows the user to pre-store up to 95 screens (4X20 lines each)of text and any of the screens can be called up programmatically. I have a calculator style data entry function that collects data entered on the keypad.
A piezo-buzzer announces key stroke input. This is a feature on the 425. You supply the buzzer tho.
I am currently using 30 or so of the 95 screens.
If interested, post here and I will try to answer questions. Code is available. If anyone is interested, I'll repost the latest version on this thread.
WARNING: This is a pricey board, ~120 bucks! , but it gets the job done.
HTH
Vic
|
|
| Back to top |
|
 |
mdown
Joined: 03 Feb 2006
Posts: 62
Location: Dallas, Texas
|
|
Posted: 17 June 2007, 21:29 PM Post subject: |
|
|
NCD makes a keypad encoder that I have used before and works well see http://tinyurl.com/2ossma . It outputs each keypress as an ascii character.
-MikeD
|
|
| Back to top |
|
 |
|