標(biāo)題: [求助]為什么我的第一個(gè)程序總是有錯(cuò)誤? [打印本頁(yè)]

作者: ms    時(shí)間: 2011-11-3 13:21
標(biāo)題: [求助]為什么我的第一個(gè)程序總是有錯(cuò)誤?

#include <reg52.h>
#include <stdio.h>
 void main(void)
{
   SCON=0x52;
  TMOD=0x20;
    TH1=0xf3;
  TR1=1;
    printf("Hello I am KEIL. \n");
   printf("I will be your friend.\n");
    while(1);
}

編譯程序時(shí)顯示:




作者: ms    時(shí)間: 2011-11-3 13:22
 說(shuō)明:
完全是按照這個(gè)教程操作的:
http://www.torrancerestoration.com/mcu/keil%E6%95%99%E7%A8%8B.html

[此貼子已經(jīng)被作者于2011-11-3 13:23:32編輯過]

作者: pjking1214    時(shí)間: 2011-11-3 17:25

沒問題呀,調(diào)試正常

#include <reg52.h>
#include<stdio.h>
void main(void)
{
 SCON=0x52;
 TMOD=0x20;
 TH1=0xf3;
 TR1=1;
 printf("HELLO I am KEIL.\n");
 printf("I will be your friend.\n");
 while(1);
}

 

建造目標(biāo) '目標(biāo) 1'
正在編繹 11.c...
連接中...
Program Size: data=30.1 xdata=0 code=1129
"11" - 0 錯(cuò)誤 (s), 0   警告 (s).


作者: pjking1214    時(shí)間: 2011-11-3 17:29
看下你的最后的分號(hào)是不是全角的?這個(gè)符號(hào)一定要在英文狀態(tài)下打出來(lái)。
作者: pjking1214    時(shí)間: 2011-11-3 17:31
哥們,你把每句前面的空格刪一下,最好別從別處復(fù)制,自己寫就可以了,要打半角的字符,不要出現(xiàn)全角的字符。
[此貼子已經(jīng)被作者于2011-11-3 17:32:40編輯過]

作者: wsh75    時(shí)間: 2011-11-11 12:48
  SCON=0x52;這行前面的空格有問題!





歡迎光臨 (http://www.torrancerestoration.com/bbs/) Powered by Discuz! X3.1