Email: Password: Remember Me | Create Account (Free)

Back to Subject List

Old thread has been locked -- no new posts accepted in this thread
???
04/04/04 04:09
Read: times


 
#67902 - RE: State Machines
Responding to: ???'s previous message
I have explored state machines and they just seem like they belong more in VHDL than C or ASM my own prejudice. This may very well be the best way to accomplish a menu system and that’s why I decided to ask on here to get others opinions.

As an answer to the other two posts I have tried state machines, a recursive menu tree (exhausted the stack pretty quick), a character array based setup, and a setup using pointers to a character arrays that setup the screen for each menu.

Each of these seem to produce code at least twice the size I would expect. I admit I have not done it in ASM yet which probably would help a lot. The one i currently like was posted a while back it seems simple enough in c but the code size generated adds 1k of code to the file.


for(;;) {
gotoLCDLine(menuPOS);
charLCDOut(0xD7);
if(!btn_up) menuPOS++;
if(!btn_down) menuPOS--;
if(!btn_cancel) break;
if(!btn_ok){/*perform menu stuff*/}
if(menuPOS>4) menuPOS=1;
if(menuPOS<1) menuPOS=4;
// my buttons are normally closed btw and tie to ground
}


I like this as it is easy to follow and it looked like it would be nice and tight. This still seems to get a bit large and since I am limited to 16K internal ROM on the 89c420 if it gets to large I'm dead in the water. When I get something I feel like I can implement I have about 20 menu items as 5-9 characters a piece. That gives about 200 bytes of text. In any event I'm interested in other methodologies that are used. If anyone is willing to share let me know.


List of 17 messages in thread
TopicAuthorDate
LCD Based Menu system            01/01/70 00:00      
   RE: LCD Based Menu system            01/01/70 00:00      
      State Machines            01/01/70 00:00      
         RE: State Machines            01/01/70 00:00      
            RE: State Machines            01/01/70 00:00      
            RE: State Machines            01/01/70 00:00      
            RE: State Machines            01/01/70 00:00      
   RE: LCD Based Menu system            01/01/70 00:00      
      RE: LCD Based Menu system            01/01/70 00:00      
         RE: LCD Based Menu system            01/01/70 00:00      
            RE: Function pointers in Keil C51            01/01/70 00:00      
               RE: Function pointers in Keil C51            01/01/70 00:00      
                  RE: Function pointers in Keil C51            01/01/70 00:00      
   RE: LCD Based Menu system            01/01/70 00:00      
      RE: LCD Based Menu system            01/01/70 00:00      
   RE: LCD Based Menu system            01/01/70 00:00      
      RE: LCD Based Menu system            01/01/70 00:00      

Back to Subject List