void read() //讀一個位元組回傳應答信號
//-------------------------------------------------------
// reads a byte form the Sensibus and gives an aknowledge in case of "ack=1"
unsigned char i,val=0;
temp_ LL=0;
temp_ _h=0;
DATA=https://bbs.csdn.net/topics/1; //釋放資料總線
for (i=0x80;i>0;i/=2) //位移8位
{ SCK=1; //上升沿讀入
if (DATA) val=(val | i); //確定 值
SCK=0;
}
DATA=https://bbs.csdn.net/topics/0; //讀應答信號, 有應答為1,為應答為0通過CPU下拉為應答
SCN-L, //第9個脈沖
_nop_ ();_ nop_ (); _nop_ (); //pulswith approx. 5 us
SCK=0;
DATA=https://bbs.csdn.net/topics/1; //釋放資料總線
temp_ h=val;
val=0;
//低8位///////////////////////////////
DATA=https://bbs.csdn.net/topics/1; //釋放資料總線
for (i=0x80;i>0;i/=2) //位移8位
{ SCK=1; //上升沿讀入
if (DATA) val=(val| i); //確定 值
SCK=0;
}
DATA=https://bbs.csdn.net/topics/1;//0; //不需要應答通過CPU下拉為應答
SCK=1; //第9個脈沖
nop_ ();_ nop_ ();_ _nop_ (); //pulswith approx. 5 us
SCK=0;
DATA=https://bbs.csdn.net/topics/1; //釋放資料總線
temp_ LL=val;
// return ack;
}
FDS.C(59): error C132: 'i': not in formal parameter list
FDS.C(59): error C244: 'val': can't initialize, bad type or class
FDS.C(59): error C132: 'val': not in formal parameter list
FDS.C(60): error C244: 'temp_LL': can't initialize, bad type or class
FDS.C(60): error C132: 'temp_LL': not in formal parameter list
FDS.C(61): error C244: 'temp_h': can't initialize, bad type or class
FDS.C(61): error C132: 'temp_h': not in formal parameter list
FDS.C(62): error C244: 'DATA': can't initialize, bad type or class
FDS.C(62): error C132: 'DATA': not in formal parameter list
FDS.C(63): error C141: syntax error near 'for'
FDS.C(63): error C141: syntax error near '=', expected ')'
FDS.C(63): error C129: missing ';' before '>'
轉載請註明出處,本文鏈接:https://www.uj5u.com/houduan/134399.html
標籤:C語言
