- 1、本文档共20页,可阅读全部内容。
- 2、有哪些信誉好的足球投注网站(book118)网站文档一经付费(服务费),不意味着购买了该文档的版权,仅供个人/单位学习、研究之用,不得用于商业用途,未经授权,严禁复制、发行、汇编、翻译或者网络传播等,侵权必究。
- 3、本站所有内容均由合作方或网友上传,本站不对文档的完整性、权威性及其观点立场正确性做任何保证或承诺!文档内容仅供研究参考,付费前请自行鉴别。如您付费,意味着您自己接受本站规则且自行承担风险,本站不退款、不进行额外附加服务;查看《如何避免下载的几个坑》。如果您已付费下载过本站文档,您可以点击 这里二次下载。
- 4、如文档侵犯商业秘密、侵犯著作权、侵犯人身权等,请点击“版权申诉”(推荐),也可以打举报电话:400-050-0827(电话支持时间:9:00-18:30)。
查看更多
《开放性实验---avr单片机实验板制作与调试实验指导书》
徐晓光 编写
一、avr单片机的工作原理
二、avr单片机的指令系统
Atmega8的内部资源
三、avr单片机的C语言编程
ICCAVR开发环境
1、新建一个project
2、add *.c文件
3、编写*.c文件程序
4、make projrct生成*.hex文件
5、例子
#includeiom8v.h//DC_FE_UA:SPI′?ê?êy?Y3é1|?£#includemacros.h#pragma interrupt_handler Timer0_OVR:10//#pragma interrupt_handler SPI_OK:11unsigned int i,N,L,Flash; unsigned int xv[11];unsigned int x1[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}; unsigned int x2[32]={0x02,0x20,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};unsigned int x3[32]={0x04,0x40,0x04,0x44,0xFF,0xFE,0x04,0x40,0x14,0x50,0x17,0xD0,0xF0,0x12,0x17,0xDC,0x14,0x50,0x14,0x52,0x34,0x52,0xC7,0xCE,0x00,0x00,0x48,0x88,0x44,0x46,0x80,0x02};unsigned int x4[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};unsigned int x5[32]={0x10,0x40,0x10,0x40,0x10,0xF8,0xFF,0x10,0x11,0x24,0x13,0xFE,0x7D,0x24,0x11,0x24,0x11,0x24,0xFF,0xFC,0x11,0x04,0x11,0x00,0x11,0x02,0x11,0x02,0x10,0xFE,0x10,0x00};unsigned int x6[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,0x04};unsigned int x7[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};void delay_x(void){asm(nop);asm(nop);asm(nop);asm(nop);asm(nop);asm(nop);asm(nop);asm(nop);asm(nop);asm(nop);}void delay_y(void){asm(nop);asm(nop);asm(nop);}void delay(unsigned int z){unsigned int i; for(i=z;i0;i--) ;}void delay1(unsigned int z){unsigned int i,j;for(i=z;i0;i--){for(j=1000;j0;j--);}}void delay2(u
文档评论(0)