导航: 老古网老古论坛XMOS公共讨论区XMOS开源项目区单片机程序设计嵌入式系统广告区域
→c语言程序问题

* 47070: c语言程序问题

   jola 
jola发表的帖子 

 c语言程序问题
程序如下,
#include  <reg51.h>  
#include  <stdio.h>  
#define uint unsigned int
#define uchar unsigned char
void delay(void);
uchar keyscan();
void main(void)
{
uchar key;
while(1)
{key=keyscan();
delay();}
}
void delay(void)
{uchar i;
for(i=0;i  <200;i++){}
}
uchar keyscan(void)
{
uchar code_h;
uchar code_l;
p1  =0xf0;
if((p1&0xf0)!=0xf0)
{
delay();
if((p1&0xf0)!=0xf0)
  {
    code_h=0xfe;
    while((code_h&p1)!=0xf0)
     {
      p1=code_h;
      if((p1&0xf0)!=0xf0)
      {
        code_l=(p1&0xf0|0x0f);
        return((~code_h)+(~code_l));
       }
        else
             code_h=(code_h  <  <1)|0x01;
        }
       }
     }
return(0);
}
编译后的信息是:
Build target 'Target 1'
compiling prog.c...
PROG.C(22): error C141: syntax error near '='
PROG.C(23): error C190: '&': not an lvalue
PROG.C(26): error C190: '&': not an lvalue
PROG.C(29): error C141: syntax error near ')'
PROG.C(29): error C141: syntax error near '!='
PROG.C(29): error C141: syntax error near ')'
PROG.C(32): error C190: '&': not an lvalue
PROG.C(34): error C190: '&': not an lvalue
Target not created
为什么会这样呢?????




发表时间:2004年1月2日13:32:29

  
回复该帖

本主题共有 9 帖,分页:>>>>>该主题的所有内容[9]条

 *树形目录 只列出部分跟帖的标题以及简单的摘要信息 该主题的部分跟帖如下:

  47076.[详细]读取p1口最好加个寄存器temp=p1;if((temp&0xf0)!=0xf0)..
摘要:读取p1口最好加个寄存器  temp=p1; if((temp&0xf0)!=0xf0)......(57字)
- [guest][929次] 2004年1月2日

  47256.[详细]我想这样写的话在多任务环境中对函数的可重入性有很大作用。
摘要:我想这样写的话在多任务环境中对函数的可重入性有很大作用。......(56字)
- [rou_wexx][1120次] 2004年1月5日

  47079.[详细]?????
摘要:为什么要这样呢?能解释一下吗???那怎么来定义TEMP呢?? 谢谢!......(57字)
- [jola][840次] 2004年1月2日

[上一篇帖子]:那位大侠有Pt电阻测量温度的电路图发一份给看看好吗?谢谢。
[下一篇帖子]:我也要一份,我的EMAIL:jw_wu@163.COM .谢谢!