|
|||||||||||
| 技術交流 | 電路欣賞 | 工控天地 | 數(shù)字廣電 | 通信技術 | 電源技術 | 測控之家 | EMC技術 | ARM技術 | EDA技術 | PCB技術 | 嵌入式系統(tǒng) 驅(qū)動編程 | 集成電路 | 器件替換 | 模擬技術 | 新手園地 | 單 片 機 | DSP技術 | MCU技術 | IC 設計 | IC 產(chǎn)業(yè) | CAN-bus/DeviceNe |
為什么編譯出錯了?初學小蟲蟲求助 |
| 作者:apu_ccc 欄目:單片機 |
程序是: #include <REGX51.H> #include <stdio.h> void main(void) { SCON = 0x50; //串口方式1,允許接收 TMOD = 0x20; //定時器1定時方式2 TCON = 0x40; //設定時器1開始計數(shù) TH1 = 0xE8; //11.0592MHZ 1200波特率 TL1 = 0xE8; TI = 1; TR1 = 1; //啟動定時器 while(1) { printf ("Hello World!\n"); //顯示Hello World } } 出錯的提示是: Build target 'Target 1' compiling hello.c... HELLO.C(5): error C100: unprintable character 0xA1 skipped HELLO.C(5): error C100: unprintable character 0xA1 skipped HELLO.C(6): error C100: unprintable character 0xA1 skipped HELLO.C(6): error C100: unprintable character 0xA1 skipped HELLO.C(7): error C100: unprintable character 0xA1 skipped HELLO.C(7): error C100: unprintable character 0xA1 skipped HELLO.C(8): error C100: unprintable character 0xA1 skipped HELLO.C(8): error C100: unprintable character 0xA1 skipped HELLO.C(9): error C100: unprintable character 0xA1 skipped HELLO.C(9): error C100: unprintable character 0xA1 skipped HELLO.C(10): error C100: unprintable character 0xA1 skipped HELLO.C(10): error C100: unprintable character 0xA1 skipped HELLO.C(11): error C100: unprintable character 0xA1 skipped HELLO.C(11): error C100: unprintable character 0xA1 skipped HELLO.C(13): error C100: unprintable character 0xA1 skipped HELLO.C(13): error C100: unprintable character 0xA1 skipped HELLO.C(14): error C100: unprintable character 0xA1 skipped HELLO.C(14): error C100: unprintable character 0xA1 skipped HELLO.C(14): error C100: unprintable character 0xA1 skipped HELLO.C(14): error C100: unprintable character 0xA1 skipped HELLO.C(15): error C100: unprintable character 0xA1 skipped HELLO.C(15): error C100: unprintable character 0xA1 skipped HELLO.C(15): error C100: unprintable character 0xA1 skipped HELLO.C(15): error C100: unprintable character 0xA1 skipped HELLO.C(15): error C100: unprintable character 0xA1 skipped HELLO.C(15): error C100: unprintable character 0xA1 skipped HELLO.C(16): error C100: unprintable character 0xA1 skipped HELLO.C(16): error C100: unprintable character 0xA1 skipped HELLO.C(16): error C100: unprintable character 0xA1 skipped HELLO.C(16): error C100: unprintable character 0xA1 skipped Target not created 誰能告訴我哪出錯了呢?其中頭文件原來是#include <AT89X51.H>的,后來我改成 #include <REGX51.H>,因為編譯提示找不到AT89X51.H, 而后來發(fā)現(xiàn)在REGX51.H 里有,所以改后編譯就沒有找不到的提示了,卻出現(xiàn)了以上十幾行的錯誤了,555 誰能給小蟲蟲一點提示呢? * - 本貼最后修改時間:2005-6-17 17:36:48 修改者:apu_ccc |
| 2樓: | >>參與討論 |
| 作者: apu_ccc 于 2005/6/17 18:11:00 發(fā)布:
為什么沒有人回復呢? 我知道我的問題問得簡單,可是我真的是不會! |
|
| 3樓: | >>參與討論 |
| 作者: 劍寒情暖 于 2005/6/17 18:14:00 發(fā)布:
應該沒什么錯誤 |
|
| 4樓: | >>參與討論 |
| 作者: 劍寒情暖 于 2005/6/17 18:16:00 發(fā)布:
找到問題了 你的每條語句前面都有漢字字符,看不到,不信你在keil里面,在每條語句前面刪掉一個空格試一下! |
|
| 5樓: | >>參與討論 |
| 作者: apu_ccc 于 2005/6/17 18:16:00 發(fā)布:
那我編譯為什么出了那么多行錯誤? 這程序是直接從教材上弄下來的 我還不會燒寫,所以弄了個最簡單的 555... |
|
| 6樓: | >>參與討論 |
| 作者: 劍寒情暖 于 2005/6/17 18:21:00 發(fā)布:
這是KEIL自己帶的程序 /*------------------------------------------------------------------------------ HELLO.C COPYRIGHT 1995-1999 Keil SOFTWARE, Inc. ------------------------------------------------------------------------------*/ #include <REG52.H> /* special function register declarations */ /* for the intended 8051 derivative */ #include <stdio.h> /* prototype declarations for I/O functions */ #ifdef MONITOR51 /* Debugging with Monitor-51 needs */ CHAR code reserve [3] _at_ 0x23; /* space for serial interrupt if */ #endif /* Stop Exection with Serial Intr. */ /* is enabled */ /*------------------------------------------------ The main C function. Program execution starts here after stack initialization. ------------------------------------------------*/ void main (void) { /*------------------------------------------------ Setup the serial PORT for 1200 baud at 16MHZ. ------------------------------------------------*/ #ifndef MONITOR51 SCON = 0x50; /* SCON: mode 1, 8-bit UART, enable rcvr */ TMOD |= 0x20; /* TMOD: timer 1, mode 2, 8-bit reload */ TH1 = 221; /* TH1: reload VALUE for 1200 baud @ 16MHZ */ TR1 = 1; /* TR1: timer 1 run */ TI = 1; /* TI: set TI to send first CHAR of UART */ #endif /*------------------------------------------------ Note that an embedded program never exits (because there is no operating SYSTEM to return to). It must loop and execute forever. ------------------------------------------------*/ while (1) { P1 ^= 0x01; /* Toggle P1.0 each time we print */ printf ("Hello World\n"); /* Print "Hello World" */ } } |
|
| 7樓: | >>參與討論 |
| 作者: apu_ccc 于 2005/6/17 18:24:00 發(fā)布:
呵呵,謝謝你,修改成功 按你的去做了,呵呵,問題解決了 謝謝劍寒情暖,非常感謝。海 |
|
|
|
| 免費注冊為維庫電子開發(fā)網(wǎng)會員,參與電子工程師社區(qū)討論,點此進入 |
Copyright © 1998-2006 m.58mhw.cn 浙ICP證030469號 |