资源描述:
《开放性AVR单片机实验板制作实验指导书.doc》由会员上传分享,免费在线阅读,更多相关内容在行业资料-天天文库。
1、开放性实验报告书课程设计名称:avr单片机实验板制作与调试专业班级电科0902学生姓名:罗丹学号:9指导教师:徐晓光《开放性实验---avr单片机实验板制作与调试实验指导书》一、avr单片机的工作原理二、avr单片机的指令系统三、avr单片机的C语言编程ICCAVR开发环境1、新建一个project2、add*.c文件3、编写*.c文件程序4、makeprojrct生成*.hex文件5、例子#include//DC_FE_UA:SPI´«ÊäÊý¾Ý³É¹¦¡£#include#pragmainterrupt_handlerTimer0
2、_OVR:10//#pragmainterrupt_handlerSPI_OK:11unsignedinti,N,L,Flash;unsignedintxv[11];unsignedintx1[32]={0x04,0x40,0x04,0x44,0xFF,0xFE,0x04,0x40,0x7F,0xFE,0x42,0x02,0x8F,0xE4,0x08,0x20,0x0B,0x20,0x08,0xA0,0x08,0x48,0x0F,0xFC,0x00,0x08,0x7F,0xC8,0x00,0x28,0x00,0x10};unsignedintx2[32]={0x02,0x2
3、0,0xFF,0x20,0x02,0x20,0x7A,0x40,0x4A,0x7C,0x4A,0x84,0x7B,0x28,0x02,0x20,0xFF,0x20,0x02,0x20,0x7A,0x20,0x4A,0x20,0x4A,0x50,0x7A,0x50,0x4A,0x8E,0x05,0x04};unsignedintx3[32]={0x04,0x40,0x04,0x44,0xFF,0xFE,0x04,0x40,0x14,0x50,0x17,0xD0,0xF0,0x12,0x17,0xDC,0x14,0x50,0x14,0x52,0x34,0x52,0xC7,0xC
4、E,0x00,0x00,0x48,0x88,0x44,0x46,0x80,0x02};unsignedintx4[32]={0x20,0x08,0x3F,0xFC,0x52,0x90,0x92,0x90,0x7F,0xFC,0x12,0x90,0x12,0x94,0xFF,0xFE,0x10,0x10,0x1E,0xFC,0x22,0x90,0x52,0x94,0x0D,0xFE,0x18,0x10,0xE0,0x10,0x00,0x10};unsignedintx5[32]={0x10,0x40,0x10,0x40,0x10,0xF8,0xFF,0x10,0x11,0x2
5、4,0x13,0xFE,0x7D,0x24,0x11,0x24,0x11,0x24,0xFF,0xFC,0x11,0x04,0x11,0x00,0x11,0x02,0x11,0x02,0x10,0xFE,0x10,0x00};unsignedintx6[32]={0x00,0x04,0x7D,0xFE,0x45,0x04,0x49,0x04,0x49,0x04,0x51,0x04,0x49,0x04,0x49,0xFC,0x45,0x04,0x45,0x04,0x45,0x04,0x69,0x04,0x51,0x04,0x41,0x04,0x41,0xFC,0x41,0x0
6、4};unsignedintx7[32]={0x00,0x08,0x7F,0xFC,0x01,0x00,0x01,0x00,0x01,0x00,0x01,0x04,0xFF,0xFE,0x01,0x00,0x02,0x80,0x02,0x80,0x04,0x40,0x04,0x40,0x08,0x20,0x10,0x10,0x20,0x0E,0xC0,0x04};voiddelay_x(void){asm("nop");asm("nop");asm("nop");asm("nop");asm("nop");asm("nop");asm("nop");asm("nop");a
7、sm("nop");asm("nop");}voiddelay_y(void){asm("nop");asm("nop");asm("nop");}voiddelay(unsignedintz){unsignedinti;for(i=z;i>0;i--);}voiddelay1(unsignedintz){unsignedinti,j;for(i=z;i>0;i--){for(j=1000;j>0;j--);}}voiddelay2(unsignedintz){unsignedinti,j,k;for(i=z;i>