avr-gcc-list
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[avr-gcc-list] Array of pointers to functions


From: Royce & Sharal Pereira
Subject: [avr-gcc-list] Array of pointers to functions
Date: Sat, 17 Jul 2004 13:01:39 +0530

Hi, all,

I'm trying to call a function from an array, like this..

char f_cnt;

void fun1(void)
    {
        //some code
    }
//---------------------
void fun2(void)
    {
        //some code
    }
//---------------------
void fun3(void)
    {
        //some code
    }
//---------------------

void (*call_fun[])() PROGMEM = { fun1, fun2, fun3};  //This puts the addresses 
in code memory(seems
so from the .lst file).
//----------------------
void main(void)
    {
        (*call_fun[f_cnt])();  //But here I get a 'ld' instruction. How to 
cause an LPM instruction
to get the function address before the 'icall' ?
    }
//---------------------

Many Thanks,

--Royce.




reply via email to

[Prev in Thread] Current Thread [Next in Thread]