标题:
missing function-prototype求大佬指点指点,哪里错了?
[打印本页]
作者:
Ozner
时间:
2020-2-27 18:45
标题:
missing function-prototype求大佬指点指点,哪里错了?
#include<reg52.h>
#include<Temp.h>
sbit LSA=P2^2;
sbit LSC=P2^3;
sbit LSB=P2^4;
uchar code smgduan[10]={0x3f,0x06,0x5b,0x4f,0x66,0x6d,0x7d,0x07,0x7f,0x6f};
uchar Display[8];
float tp;
void delay(uint i)
{
while(i--);
}
void datapros(int temp)
{
if (temp<0)
{
Display[0]=0x40;
temp=temp-1;
temp=~temp;
tp=temp;
temp=tp*0.0625*100+0.5;
}
else
{
Display[0]=0x00;
tp=temp;
temp=tp*0.0625*100+0.5;
}
Display[1]= smgduan[temp/10000];
Display[2]= smgduan[temp%10000/1000];
Display[3]= smgduan[temp%10000%1000/100] | 0x80;
Display[4]= smgduan[temp%100/10];
Display[5]= smgduan[temp%10];
}
void dianliang()
{
uchar i;
for(i=0;i<=5;i++)
{
switch(i)
{
case(0):LSA=1;LSB=1;LSC=1;break;
case(1):LSA=0;LSB=1;LSC=1;break;
case(2):LSA=1;LSB=0;LSC=1;break;
case(3):LSA=0;LSB=0;LSC=1;break;
case(4):LSA=1;LSB=1;LSC=0;break;
case(5):LSA=0;LSB=1;LSC=0;break;
}
P0=Display[i];
delay(100);
P0=0x00;
}
}
void main()
{
while(1)
{
datapros(Ds18b20_ReadTemp());
dianliang();
}
}
#include"Temp.h"
void Delay_ms(uint y)
{
uint x;
for( ; y>0; y--)
{
for(x=110; x>0; x--);
}
}
uchar Ds18b20_Init()
{
uchar i;
DQ = 0;
i = 70;
while(i--);
DQ = 1;
i = 0;
while(DQ)
{
Delay_ms(1);
i++;
if(i>5)
{
return 0;
}
}
return 1;
}
void Ds18b20_WriteByte(uchar dat)
{
uint i;
for(i=0;i<8;i++)
{
DQ=0;
i++;
DQ=dat&0x01;
i=6;
while(i--);
DQ=1;
dat=dat>>1;
}
}
uchar Ds18b20_ReadByte()
{
uchar bi,Byte;
uint i,j;
for(i=0;i<8;i++)
{
DQ=0;
j=0;
DQ=1;
j++;
j++;
bi=DQ;
Byte =(Byte>>1)|(bi<<7);
i=4;
while(i--);
}
return Byte;
}
void Ds18b20_ConvertTemp()
{
Ds18b20_Init();
Delay_ms(1);
Ds18b20_WriteByte(0xcc);
Ds18b20_WriteByte(0x44);
}
void Ds18b20_ReadTempCom()
{
Ds18b20_Init();
Delay_ms(1);
Ds18b20_WriteByte(0xcc);
Ds18b20_WriteByte(0xbe);
}
int Ds18b20_ReadTemp()
{
int temp=0;
uchar tmh,tml;
Ds18b20_ConvertTemp();
Ds18b20_ReadTempCom();
tml=Ds18b20_ReadByte();
tmh=Ds18b20_ReadByte();
temp=tmh;
temp<<=8;
temp|=tml;
return temp;
}
#ifndef _temp_H
#define _temp_H
#include<reg52.h>
sbit DQ=P3^7;
#ifndef uchar
#define uchar unsigned char
#endif
#ifndef uint
#define uint unsigned int
#endif
int Ds18b20Read_Temp();
#endif
复制代码
作者:
Ozner
时间:
2020-2-27 18:48
标题:
这是错误提示
本帖最后由 Ozner 于 2020-2-27 22:13 编辑
Build target 'Target 1'
compiling main.c...
MAIN.C(66): warning C206: 'Ds18b20_ReadTemp': missing function-prototype
compiling Temp.c...
linking...
Program Size: data=21.0 xdata=0 code=1463
creating hex file from "Temp"...
"Temp" - 0 Error(s), 1 Warning(s).
欢迎光临 (http://www.51hei.com/bbs/)
Powered by Discuz! X3.1