资源描述:
《ARM经典汇编程序》由会员上传分享,免费在线阅读,更多相关内容在教育资源-天天文库。
1、1冒泡排序的ARM汇编程序ORG09B0HQUE:MOVR3,#50HQUE1:MOVA,R3MOVR0,AMOVR7,#0AHCLR00HMOVA,@R0Q12:INCR0MOVR2,ACLRCMOV22H,@R0CJNEA,22H,Q13SETBCQ13:MOVA,R2JCQ11SETB00HXCHA,@R0DECR0XCHA,@R0INCR0Q11:MOVA,@R0DJNZR7,Q12JB00H,QUE1SJMP$END2ARM汇编希尔排序法对10个带符号数进行排序Code:voidshell(intsrc[],intl,intr){intih;r++;for(i
2、h=1;ih<(r-l)/9;ih=ih*3+1);//eax,ih//ebx,il//ecx,ir//edx,cmps_asm{pusheaxpushebxpushecxpushedxpushesipushedi;貌似这堆进栈用处不大哎movedi,srcmoveax,dwordptr[ih]LIH:cmpeax,0jnaEXIHmovebx,eaxdecebxLLH:cmpebx,dwordptr[r]jnbEXLLHmovecx,ebxmovedx,dwordptr[edi+ecx*4]LCMP:movesi,eaxdecesicmpecx,esijnaEXCMP
3、pushecxsubecx,eaxcmpedx,dwordptr[edi+ecx*4]popecxjnbEXCMPpushebxpushecxsubecx,eaxmovebx,dwordptr[edi+ecx*4]popecxmovdwordptr[edi+ecx*4],ebxpopebxsubecx,eaxjmpLCMPEXCMP:movdwordptr[edi+ecx*4],edxincebxjmpLLHEXLLH:pushecxmovecx,3pushedxcdqidivecxpopedxpopecxjmpLIHEXIH:popedipopesipopedxpop
4、ecxpopebxpopeax}}351单片机C语言对流水灯编程,用定时中断做#includedefineucharunsignedcharucharm=0,i=0;voidmain(){TMOD
5、=0x01;//定时器0工作方式为1TH0=(65536-50000)/256;//装初值TL0=(65536-50000)%256;EA=1;//开总中断ET0=1;//开定时器中断TR0=1;//开启定时器while(1);//等待中断}voidtimer0()interrupt1{TH0=(65536-50000)/256;TL0=(65536-500
6、00)%256;m++;if(m==5)//12M晶振定时5*50MS=250MS{m=0;P1=~(0X01<
7、0,#78HSETBEASETBEX0SETBET0CLRIT0SJMP$;===int0外部中断子程序===XC_INT0:PUSHACCPUSHPSWSETBTR0POPPSWPOPACCRETI;===报警频率产生T0中断===BJ_T0:CPLp2.3MOVTH0,#0ECHMOVTL0,#78HRETI5单片机外部中断的编程设计单片机程序,基于T0用定时中断设计秒表,秒计数结果在数码管显示,用外部中断INT0(边沿触发方式)对秒计数结果进行清零,用P3.0对秒计数进行启动和停止控制。T0定时中断50毫秒,进行20次中断得到1秒的定时,秒计数结果送P1口进行LE
8、D显示,将外部中断设置成边沿触发方式。/***********************************************/#includesbitshiwei=P2^0;//定义接口sbitgewei=P2^1;/*********************************************/unsignedcharcodetable[]={//数码显示表0x3f,0x06,0x5b,0x4f,0x66,0x6d,0x7d,0x07,0x7f,0x6f};/*******************