编程软件avr studio6.2,感觉是数组那一块不对,请指教,谢谢
#include <avr/io.h>
#include<avr/pgmspace.h>
#include <util/delay.h>
#define uint unsigned int
#define uchar unsigned char
#include<avr/interrupt.h>
PROGMEM const uchar flash[16]={0x3f,0x06,0x5b,0x4f,0x66,0x6d,0x7d, 0x07,
0x7f,0x6f,0x77,0x7c,0x39,0x5e,0x79,0x71};
int main(void)
{
DDRG|=(1<<PG3);//段选
DDRG|=(1<<PG4);//位选
DDRB=0XFF;//数据
while(1)
{
PORTG|=(1<<PG3);
PORTB=pgm_read_byte(flash[9]);
PORTG&=~(1<<PG3);
PORTB=0XFF;
PORTG|=(1<<PG4);
PORTB=0xfe;
PORTG&=~(1<<PG4);
_delay_ms(2);
}
} |