跨届大侠
北京龙邱智能科技有限公司
- 积分
- 10332
- 威望
- 2905
- 贡献
- 6151
- 兑换币
- 4515
- 注册时间
- 2008-6-7
- 在线时间
- 638 小时
|
<><STRONG><FONT size=5>The refference project is as fellow:</FONT></STRONG></P><P>#include <hidef.h> /* common defines and macros */<BR>#include <mc9s12dg128.h> /* derivative information */<BR>#pragma LINK_INFO DERIVATIVE "mc9s12dg128b"</P><P>void delayms(int ms)<BR>{ <BR> int ii,jj;<BR> if (ms<1) ms=1;<BR> for(ii=0;ii<ms;ii++)<BR> for(jj=0;jj<1335;jj++); //16MHz--1ms <BR> } </P><P>void main(void) {<BR> /* put your own code here */<BR> unsigned char LedCnt=0;<BR> <BR> DDRB=0xFF;<BR> PUCR_PUPBE=1;<BR> <BR> EnableInterrupts;</P><P> for(;;) { <BR> <BR> LedCnt=(LedCnt>0XFE?0:++LedCnt);<BR> delayms(800); //修改延时以修改数据发送频率<BR> <BR> //低电平灯亮用这句,注释掉下面那句 <BR> PORTB=~LedCnt;<BR> <BR> //高电平灯亮用这句,注释掉上面那句 <BR> //PORTB=LedCnt; <BR> <BR> } /* wait forever */<BR> /* 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> |
|