錯誤:1.C(352): error C267: 'AT24C02Read': requires ANSI-style prototype
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
/*******************************************************************************
* 函式名 : void At24c02Write(unsigned char addr,unsigned char dat)
* 函式功能 : 往24c02的一個地址寫入一個資料
* 輸入 : 無
* 輸出 : 無
*******************************************************************************/
void AT24C02Write(unsigned char addr,unsigned char dat)
{
I2cStart();
I2cSendByte(0xa0);//發送寫器件地址
I2cSendByte(addr);//發送要寫入記憶體地址
I2cSendByte(dat); //發送資料
I2cStop();
}
/*******************************************************************************
* 函式名 : unsigned char At24c02Read(unsigned char addr)
* 函式功能 : 讀取24c02的一個地址的一個資料
* 輸入 : 無
* 輸出 : 無
*******************************************************************************/
unsigned char At24C02Read(uchar addr,uchar num)
{
I2cStart();
I2cSendByte(0xa0); //發送寫器件地址
I2cSendByte(addr); //發送要讀取的地址
I2cStart();
I2cSendByte(0xa1); //發送讀器件地址
num=I2cReadByte(); //讀取資料
I2cStop();
return num;
}
//*******************************************************//
void Start_display()
{
錯誤:if(AT24C02Read(255)!=18)
{
AT24C02Write(0,Set_temp_H);
AT24C02Write(2,Set_temp_L);
AT24C02Write(255,18);
}
else
{
Set_temp_H=AT24C02Read(0);
Set_temp_L=AT24C02Read(2);
}
LCD_Dispstring(2,0,"Temp: ");
LCD_Dispstring(0,1,"Max: ");
LCD_Dispstring(9,1,"Min: ");
}
uj5u.com熱心網友回復:
AT24C02Read定義的時候是兩個引數,用的時候確是一個引數啊uj5u.com熱心網友回復:
那這里應該怎么改呀,謝謝uj5u.com熱心網友回復:
你宣告的函式是
unsigned char At24C02Read(uchar addr,uchar num)
呼叫的是At24C02Read(addr)
你需要改函式宣告,如
unsigned char At24C02Read(uchar addr)
{
uchar num;
。。。。。
}
轉載請註明出處,本文鏈接:https://www.uj5u.com/qita/58782.html
標籤:單片機/工控
上一篇:介面使用沖突
下一篇:樹莓派 查不到管腳資訊
