打印

求助

[复制链接]
1474|6
手机看帖
扫描二维码
随时随地手机跟帖
跳转到指定楼层
楼主
liming0505|  楼主 | 2007-10-13 10:51 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
各位好!麻烦帮我看看这程序错在哪里啊!

#include<AT89X51.H>
void main(void)
{while(1);
{if(P1_4==0)
{P1_0=0;}
else{P1_0=1;}
if(P1-5==0)
{P1_1=0;}
else{P1_1=1;}}
运行后出现这几行字

Build target 'Target 1'
assembling STARTUP.A51...
compiling my-test3.c...
MY-TEST3.C(9): error C141: syntax error near ''
Target not created
多谢各位

相关帖子

沙发
ayb_ice| | 2007-10-13 13:22 | 只看该作者

你这编程的风格也太....

#include<AT89X51.H>

void main(void)
{
    while(1);
    {
        if(P1_4 == 0){
            P1_0 = 0;
        }else{
            P1_0 = 1;
        }
        if(P1-5 == 0){
            P1_1 = 0;
        }else{
            P1_1 = 1;
        }
    }
这是帮你整理后的结果,你应该知道错误在哪了吧...

使用特权

评论回复
板凳
liming0505|  楼主 | 2007-10-13 14:41 | 只看该作者

多谢

#include<AT89X51.H>

void main(void)
{
    while(1);
    {
        if(P1_4 == 0){
            P1_0 = 0;
        }else{
            P1_0 = 1;
        }
        if(P1_5 == 0){
            P1_1 = 0;
        }else{
            P1_1 = 1;
        }
    }
 根据你的程序运行后,还是那样啊,真的不知道为什么了
Build target 'Target 1'
assembling STARTUP.A51...
compiling my-test3.c...
MY-TEST3.C(19): error C141: syntax error near ''
Target not created这是运行后的结果

使用特权

评论回复
地板
magic87| | 2007-10-13 15:00 | 只看该作者

对头

使用特权

评论回复
5
computer00| | 2007-10-13 15:23 | 只看该作者

我晕....这程序写得...改成这样:

#include <AT89X51.H>

void main(void)
{
 while(1)
 {
  if(P1_4 == 0)
  {
   P1_0 = 0;
  }
  else
  {
   P1_0 = 1;
  }

  if(P1_5 == 0)
  {
   P1_1 = 0;
  }
  else
  {
   P1_1 = 1;
  }
 }
}

使用特权

评论回复
6
hittydong| | 2007-10-13 15:29 | 只看该作者

...

使用特权

评论回复
7
hotpower| | 2007-10-13 15:50 | 只看该作者

我再晕,写成这样行否???

#include <AT89X51.H>

void main(void)
{
  while(1)
  { 
    P1_0 = P1_4;
    P1_1 = P1_5;
  }
}


汇编也许优化为:
mov c, p1.4;
mov p1.0, c;
mov c, p1.5;
mov p1.1, c;

使用特权

评论回复
发新帖 我要提问
您需要登录后才可以回帖 登录 | 注册

本版积分规则

11

主题

14

帖子

1

粉丝