智能车制作
标题:
流水灯的查看
[打印本页]
作者:
河大先锋
时间:
2010-3-25 10:43
标题:
流水灯的查看
#include <hidef.h> /* common defines and macros */
#include <mc9s12dg128.h> /* derivative information */
#pragma LINK_INFO DERIVATIVE "mc9s12dg128b"
int i,a,ss;
void delay(int j) {
for(i=0;i<j;i++){
for(a=0;a<j;a++){
}
}
}
void main(void) {
/* put your own code here */
EnableInterrupts;
DDRB=0XFF;
for(;;) {
int k;
PORTB=0X01;
for(k=0;k<8;k++){
delay(200);
PORTB=PORTB<<1;
ss=PORTB;
delay(200);
}
} /* wait forever */
/* please make sure that you never leave this function */
}
作者:
robust
时间:
2010-4-8 11:12
新手,用这个试跑了一下,现象是:灯从第一个开始逐一灭,但每次只灭一盏灯。然后又重新开始。修改PORTB=0X01;或PORTB=PORTB<<1;可以改变灯亮灭的情况。
作者:
wdxy
时间:
2010-4-9 16:53
作者:
xh2012
时间:
2010-4-12 01:09
ss=PORTB;
这一句有什么作用?
作者:
xh2012
时间:
2010-4-12 01:09
ss=PORTB;
这一句有什么作用?
作者:
随风静默
时间:
2011-3-3 22:01
ss好像没什么用!
作者:
supper大毛
时间:
2011-3-4 16:12
顶你,好好学习
作者:
ngng1109
时间:
2011-3-5 17:25
没看到ss干嘛的~
欢迎光临 智能车制作 (http://www.znczz.com/)
Powered by Discuz! X3.2