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

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

AW: [avr-gcc-list] Array of function pointers in program memory


From: Stumpf Michael
Subject: AW: [avr-gcc-list] Array of function pointers in program memory
Date: Fri, 4 May 2001 07:38:33 +0200

 Hi,
 
 try typedefs like
 
 typedef void (*FuncPtr)(void);
 typedef FuncPtr FuncPtrArray[2];
 typedef FuncPtrArray prog_FuncPtrArray PROGMEM;
 
 void function0();
 void function1();
 
 static FuncPtrArray FunctionTable = { function0, function1 };
 
> > -----Urspr√ľngliche Nachricht-----
> > Von: Guy Robinson [mailto:address@hidden]
> > Gesendet: Freitag, 4. Mai 2001 03:48
> > An: address@hidden
> > Betreff: [avr-gcc-list] Array of function pointers in program memory
> >
> >
> > Hi
> >
> > OK, the following program runs but the array is in SRAM not
> > program memory
> > like I want. Can anyone point me to some documentation that
> > might explain
> > what I'm doing wrong or even better tell me the answer:-)?
> >
> > Regards,
> >
> > Guy
> >
> > #include <io.h>
> > #include <pgmspace.h>
> >
> > typedef unsigned char u08;
> > typedef unsigned int u16;
> >
> > void function0();
> > void function1();
> >
> > static prog_void (*FunctionTable[2])() ={function0,function1};
> >
> > u08 index;
> >
> > void function0(){
> > }
> >
> > void function1(){
> > }
> >
> > void main(void){
> >  index =0;
> >  do
> >  {
> >  (*FunctionTable[index])();
> >  index++;
> >  }
> >  while(index<2);
> > }
> >
> >
> >
> > _______________________________________________
> > avr-gcc-list mailing list
> > address@hidden
> > http://avr.jpk.co.nz/mailman/listinfo/avr-gcc-list
> >
>


reply via email to

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