AVR-GCC如何調(diào)用存儲(chǔ)于Flash中的指向函數(shù)的指針
// 功能:演示AVR-GCC如何調(diào)用存儲(chǔ)于Flash中的指向函數(shù)的指針 (搖擺燈)
//---------------------------------------------------------------
#include <avr/io.h>
#include
#include
void ledrun(void);
typedef struct
{
void (*pFun)(void);
}Function;
const Function function PROGMEM={ledrun};
void ledrun(void)
{
static unsigned char light_on=0x01;
static unsigned char light_ddr=0;
PORTD=light_on;
if (light_ddr==0)
{
}
else
{
}
_delay_ms(50);
}
int main(void)
{
PORTD=0;
DDRD=~0;
//void (*pFun)(void) =ledrun;
while (1)
{
}
return 0;
}
評(píng)論