一个简单的AVR测试程序
#include<iom16v.h> #include<macros.h> unsigned char led[]={0xfe,0xfd,0xfb,0xf7,0xef,0xdf,0xbf,0x7f}; void delay( ) { int i,j; for(i=0;i<56;i++) for(j=0;j<77;j++); } void main(void) { int i,j; DDRB=0xff; while(1) { PORTB=0b11111111; for(i=0;i<=7;i++) { PORTB=led[i]; delay(); } } }