|
//Правильная инициализация
#define PSW 0x1 //PSW for writing to sensor
void InitTermometer(void) //Initiating procedure
{
if (DetectDevice()) return; //Return if device not present
WriteByte1W(0xAC); //Read Status
if ( (ReadData1W(8)&0x5)!=PSW)
{
DetectDevice();
WriteByte1W(0x0C); WriteByte1W(PSW|0x40); do
{
DetectDevice();
WriteByte1W(0xAC); }
while ( ReadData1W(8)&NVB );
}
}
//часть процедуры опроса
DetectDevice()
WriteByte1W(0xEE); //Starting next convertion
DetectDevice()
WriteByte1W(0xAC); //Read Status
if ( !(ReadData1W(8)&DONE) )
return -9999; //NOT DONE
DetectDevice();
WriteByte1W(0xAA); //Read temperature-command
TEMP_READ=ReadData1W(8);//Read Temperature
E-mail: info@telesys.ru