智能车制作

标题: codewarrior4.6 LED灯计数的示范工程 [打印本页]

作者: chiusir    时间: 2008-10-15 01:36
标题: codewarrior4.6 LED灯计数的示范工程
<><STRONG><FONT size=5>The refference project is as fellow:</FONT></STRONG></P><P>#include &lt;hidef.h&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; /* common defines and macros */<BR>#include &lt;mc9s12dg128.h&gt;&nbsp;&nbsp;&nbsp;&nbsp; /* derivative information */<BR>#pragma LINK_INFO DERIVATIVE "mc9s12dg128b"</P><P>void delayms(int ms)<BR>{&nbsp;&nbsp; <BR>&nbsp;&nbsp; int ii,jj;<BR>&nbsp;&nbsp; if (ms&lt;1) ms=1;<BR>&nbsp;&nbsp; for(ii=0;ii&lt;ms;ii++)<BR>&nbsp;&nbsp;&nbsp;&nbsp; for(jj=0;jj&lt;1335;jj++);&nbsp;&nbsp;&nbsp; //16MHz--1ms&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <BR>&nbsp;}&nbsp; </P><P>void main(void) {<BR>&nbsp; /* put your own code here */<BR>&nbsp; unsigned char LedCnt=0;<BR>&nbsp; <BR>&nbsp; DDRB=0xFF;<BR>&nbsp; PUCR_PUPBE=1;<BR>&nbsp; <BR>&nbsp; EnableInterrupts;</P><P>&nbsp; for(;;) {&nbsp;&nbsp; <BR>&nbsp; <BR>&nbsp;&nbsp;&nbsp; LedCnt=(LedCnt&gt;0XFE?0:++LedCnt);<BR>&nbsp;&nbsp;&nbsp; delayms(800);&nbsp;&nbsp; //修改延时以修改数据发送频率<BR>&nbsp;&nbsp;&nbsp; <BR>&nbsp;&nbsp;&nbsp; //低电平灯亮用这句,注释掉下面那句 <BR>&nbsp;&nbsp;&nbsp; PORTB=~LedCnt;<BR>&nbsp;&nbsp;&nbsp; <BR>&nbsp;&nbsp;&nbsp; //高电平灯亮用这句,注释掉上面那句&nbsp;&nbsp; <BR>&nbsp;&nbsp;&nbsp; //PORTB=LedCnt;&nbsp; <BR>&nbsp; <BR>&nbsp; } /* wait forever */<BR>&nbsp; /* please make sure that you never leave this function */<BR>}</P><P>欲看完整工程请下载:</P><BR><BR><IMG src="http://www.znczz.com/images/affix.gif"><A target=_blank href="http://blog.21ic.com/UploadFiles/2008-11/211237689797.rar" target=_blank>LEDdemo.rar</A>
作者: lynd323    时间: 2008-10-15 04:18
标题: Re:codewarrior4.6 LED灯计数的示范工程
顶下,
作者: whut_wj    时间: 2008-10-15 05:23
标题: Re:codewarrior4.6 LED灯计数的示范工程
好东西,希望楼主常常来指导。
作者: chiusir    时间: 2008-10-16 06:19
标题: Re:codewarrior4.6 LED灯计数的示范工程
<>呵呵,时间允许的话一定来!</P>
作者: ranbing0614    时间: 2008-11-23 03:33
标题: Re:codewarrior4.6 LED灯计数的示范工程
<>下载不了</P>
作者: chiusir    时间: 2008-11-23 04:17
标题: Re:codewarrior4.6 LED灯计数的示范工程
<>我修改了连接,应该可以了!</P>
作者: zhuzhu0    时间: 2010-3-28 21:23
ding
作者: ldq    时间: 2013-11-18 19:50
求下载




欢迎光临 智能车制作 (http://dns.znczz.com/) Powered by Discuz! X3.2