標(biāo)題:
剛開始學(xué)習(xí),就遇到困難,代碼編譯總是出錯。
[打印本頁]
作者:
我就要飛刀
時間:
2015-1-20 08:20
標(biāo)題:
剛開始學(xué)習(xí),就遇到困難,代碼編譯總是出錯。
這個代碼是網(wǎng)上供學(xué)習(xí)的作品,用Proteus編譯,有27處錯誤,用KEIL編譯,未生成目標(biāo),幫分析分析。程序如下
/* 名稱:從左到右的流水燈
說明:接在P0口的8個LED從左到右循環(huán)依次點亮,產(chǎn)生走馬燈效果
*/
#include<reg51.h>
#include<intrins.h>
#define uchar unsigned char
#define uint unsigned int
//延時
void DelayMS(uint x)
{
uchar i;
while(x--)
{
for(i=0;i<120;i++);
}
}
//主程序
void main()
{
P0=0xfe;
while(1)
{
P0=_crol_(P0,1); //P0的值向左循環(huán)移動
DelayMS(150);
}
}
作者:
admin
時間:
2015-1-20 15:18
QQ截圖20150120151608.png
(32.11 KB, 下載次數(shù): 125)
下載附件
2015-1-20 15:18 上傳
我這邊提示 0個錯誤 0個警告 你這個程序肯定是沒有問題的。
建議重裝一下keil
http://www.torrancerestoration.com/keil%CF%C2%D4%D8.html
keil c51編程軟件下載
http://www.torrancerestoration.com/mcu/keil%BD%CC%B3%CC.html
這個是 keil c51教程
作者:
wind02072107
時間:
2015-1-24 22:42
void main()
作者:
wind02072107
時間:
2015-1-24 22:48
本帖最后由 wind02072107 于 2015-1-24 22:50 編輯
void main() {
Led=0xfe;
while(1)
{
P0 = Led;
DelayMS(150);
Led=_crol_(Led,1); //P0的值向左循環(huán)移動
}
}
作者:
liaolinhui
時間:
2015-1-24 23:28
我復(fù)制到我的keil試了,完全沒錯誤,你存在錯誤估計是你方法有誤,建議你看看protues和keil的教程,學(xué)習(xí)下這兩個軟件的用法
作者:
looksave
時間:
2015-3-15 20:36
多練習(xí)就不會那么容易出錯了
歡迎光臨 (http://www.torrancerestoration.com/bbs/)
Powered by Discuz! X3.1