Hi David,

On Mon, 26 Feb 2007 02:07:54 +0530, David McNab <[EMAIL PROTECTED]> wrote:


> Surely it can't be too hard to place a table of function pointers into
> flash, retrieve function pointers from this table, and 'call' them.
>

I remember as a newbie to the list, I'd asked this very question a couple of 
years ago. A few members kindly replied, and since then I've gone on to create 
many projects implementing their advice.

Try:

void (*do_func[])(void) PROGMEM=
    { func1, func2, func3, func4, func6 };

int main(void)
    {
       void (*func)(void);

        while(1)
           {
                        .......
                (fun= pgm_read_word(&do_func[func_no]))(); //func_no is the 
element no..
                .......
           }
        return 0;
     }

Bye,
--Royce 

>
> _______________________________________________
> AVR-GCC-list mailing list
> AVR-GCC-list@nongnu.org
> http://lists.nongnu.org/mailman/listinfo/avr-gcc-list
>



-- 
Using Opera's revolutionary e-mail client: http://www.opera.com/mail/


_______________________________________________
AVR-GCC-list mailing list
AVR-GCC-list@nongnu.org
http://lists.nongnu.org/mailman/listinfo/avr-gcc-list

Reply via email to