| ??? 01/13/03 13:28 Read: times |
#36329 - RE: To choice from the menu |
Chris:
I do not know enough about the details of your hardware...but lets assume that the user inputs from two switches that are connected to P0.1 and P0.2 as the "1" and "2" inputs respectively. Arrange the switches so that they pull the port bit to a "0" or low level when they are pushed. You could write code that works as follows: A- First output the choice menu to the LCD screen. B- Next read P0 to a variable called PREV. C- Delay about 0.1 second D- Read P0 again to another variable called CURR. E- Compare to see if bit 1 of PREV == bit 1 of CURR and if bit 2 of PREV == bit 2 of CURR. If one or both are different then copy CURR to PREV and jump back to step C to let switches debounce. F- Test if bit 1 of CURR is "0". If so then have program go to Practical Game. G- Test if bit 2 of CURR is "0". If so then have program go to the Academic Game. Note that with these steps in this order the Practical game will take priority if both switches were pressed at the same time. H- If neither switch was pressed jump back to step C to wait for the users eventual input. Hope this helps Michael Karas |
| Topic | Author | Date |
| To choice from the menu | 01/01/70 00:00 | |
| RE: To choice from the menu | 01/01/70 00:00 | |
| RE: To choice from the menu | 01/01/70 00:00 | |
| RE: To choice from the menu | 01/01/70 00:00 | |
RE: To choice from the menu | 01/01/70 00:00 |



