I am currently using the PIC16F877 and need to write a comprehensive menu structure and wonder if anybody has god an efficient way of going about this as the amount of code space this routine is allowed to take up is quite critical.
___________________________
This message was ported from CCS's old forum
Original Post ID: 11358

Trampas SternGuest

Re: Has anybody got a good template for a menu structure?

Posted: Thu Feb 06, 2003 11:18 am

What type of menu, text based?

I do mine using linked lists. For example imagine a menu selection system like the following:

Menu sub_menus[]={
{ACTION_1,"sub_menu_a",0,&sub_menus[1]}, //next menu is sub_menu
{ACTION_2,"sub_menu_b",0,0}, //end of menu no next
{ACTION_3,"sub_menu_c",0,0}, //end of menu no next
{UNDEFINED ,"",0,0} //use undefined to signal end
};

//take action
//note here is where recrusive function call would be nice
}

However you may want to try it another way until the CCS compiler is fixed.

Trampas

:=I am currently using the PIC16F877 and need to write a comprehensive menu structure and wonder if anybody has god an efficient way of going about this as the amount of code space this routine is allowed to take up is quite critical.
___________________________
This message was ported from CCS's old forum
Original Post ID: 11362

TomiGuest

Re: Has anybody got a good template for a menu structure?

Posted: Thu Feb 06, 2003 11:33 am

What is about using an external EEPROM to store string data for menus? I did it using a 24LC256. If you define a uniformed length string array in the EEPROM then you can easily calculate the address of a string and use a function something like this:

:=I am currently using the PIC16F877 and need to write a comprehensive menu structure and wonder if anybody has god an efficient way of going about this as the amount of code space this routine is allowed to take up is quite critical.
___________________________
This message was ported from CCS's old forum
Original Post ID: 11363