在單片機中a++和a+1功能一樣嗎?我在學習中寫了一個小程序,模擬二進制數累加的功能程序如下:
#include<reg52.h>
unsigned char a,b;
unsigned int j;
void yanshims(unsigned int ms);
void main()
{
a=0;
while(1)
{
a=a++;
b=~a;
P1=b;
yanshims(200);
}
}
void yanshims(unsigned int ms)
{
//unsigned int j;
for(ms;ms>0;ms--)
for(j=115;j>0;j--);
}
但是這個程序運行不了,a不能累加,后來把a++改成了a+1就可以了,不知怎么回事,請高手解惑,謝謝!。。!
|