标题: 老是报错warning C290: missing return value 单片机大神们,求助一波 [打印本页]

作者: qws007    时间: 2017-12-14 14:40
标题: 老是报错warning C290: missing return value 单片机大神们,求助一波
下面的单片机程序报错XIANSHI.C(67): warning C290: missing return value

unit read2543(unsigned char port)
{
unsigned int i;
unit ad_value=0;

TCL2543_CLK=0;
TCL2543_CS=0;
port<<=4;
for(i=0;i<12;i++)
{
  if(TCL2543_DOUT)
   ad_value|=0x01;
  TCL2543_ADIN=(bit)(port&0x80);
  TCL2543_CLK=1;
   delay(60);
  TCL2543_CLK=0;
   delay(60);
port=port<<1;
  ad_value=ad_value<<1;
}
TCL2543_CS=1;
ad_value=ad_value>>1;
}


作者: angmall    时间: 2017-12-14 18:10
试试看

  1. unit read2543(unsigned char port)
  2. {
  3.         unsigned int i;
  4.         unit ad_value=0;

  5.         TCL2543_CLK=0;
  6.         TCL2543_CS=0;
  7.         port<<=4;
  8.         for(i=0;i<12;i++)
  9.         {
  10.                 if(TCL2543_DOUT)
  11.                 ad_value|=0x01;
  12.                 TCL2543_ADIN=(bit)(port&0x80);
  13.                 TCL2543_CLK=1;
  14.                 delay(60);
  15.                 TCL2543_CLK=0;
  16.                 delay(60);
  17.                 port=port<<1;
  18.                 ad_value=ad_value<<1;
  19.         }
  20.         TCL2543_CS=1;
  21.         ad_value=ad_value>>1;
  22.         return ad_value;
  23. }

复制代码





欢迎光临 (http://www.51hei.com/bbs/) Powered by Discuz! X3.1