Разработка, производство и продажа радиоэлектронной аппаратуры
|
Требуется программист в Зеленограде - обработка данных с датчиков; ColdFire; 40 тыс.
e-mail: jobsmp@pochta.ru
|
printf("CodeVisionAVR\n1 Wire Bus Demo");
delay_ms(1000);
// Determine the number of DS1820 devices
// connected to the 1 Wire bus
ds1820_devices=w1_search(0xf0,rom_codes);
printf("%u DS1820\nDevice detected",ds1820_devices);
delay_ms(1000);
/* display the ROM codes for each device */
if (ds1820_devices)
{
for (i=0;i<ds1820_devices;i++)
{
printf("Device #%u ROM\nCode is:",i+1);
delay_ms(2000);
for (j=0;j<8;j++)
{
printf("%02X ",rom_codes[i][j]);
};
delay_ms(1000);
};
}
else
while (1); /* stop here if no devices were found */
/* measure and display the temperature(s) */
while (1)
{
for (i=0;i<ds1820_devices;)
{
temp=ds1820_temperature_10(&rom_codes[i][0]);
j='+';
if (temp<0)
{
j='-';
temp=-temp;
};
printf("t%u=%c%i.%u\xdfC",++i,j,temp/10,temp%10);
delay_ms(800);
};
};
Составить ответ | Вернуться на конференцию
Ответы