[an error occurred while processing this directive]
|
Подключил DS1621 к ATMega16. Прога написана в CodeVision там в хелпе пример есть, но почему-то не работает, датчик подключил один, адресные входы на землю посадил, на индикаторе показывает ноль, вроде все правильно перепроверил сто раз может какие грабли есть, подскажите пожалуйста...
/* the DS1621 I2C bus is connected to PORTB */
/* the SDA signal is bit 3 */
/* the SCL signal is bit 4 */
#asm
.equ __i2c_port=0x18
.equ __sda_bit=3
.equ __scl_bit=4
#endasm
/* include the DS1621 Functions */
#include /* the LCD module is connected to PORTC */ #asm .equ __lcd_port=0x15 #endasm /* include the LCD Functions */ #include /* include the prototype for sprintf */ #include /* include the prototype for abs */ #include char display_buffer[33]; void main(void) { int t0,t1; /* initialize the LCD, 2 rows by 16 columns */ lcd_init(16); /* initialize the I2C bus */ i2c_init(); /* initialize the DS1621 sensor with address 0 */ /* tlow=20°C thigh=25°C */ ds1621_init(0,20,25,0); /* initialize the DS1621 sensor with address 1 */ /* tlow=30°C thigh=35°C */ ds1621_init(1,30,35,0); /* temperature display loop */ while (1) /* read the temperature of DS1621 #1 *10°C */ /* prepare the displayed temperatures */ /* display the temperatures */
E-mail:
info@telesys.ru
{
/* read the temperature of DS1621 #0 *10°C */
t0=ds1621_temperature_10(0);
t1=ds1621_temperature_10(1);
/* in the display_buffer */
sprintf(display_buffer,
"t0=%-i.%-u%cC\nt1=%-i.%-u%cC",
t0/10,abs(t0%10),0xdf,t1/10,abs(t1%10),0xdf);
lcd_clear();
lcd_puts(display_buffer);
};
}
Ответы
Перейти к списку ответов
|||
Конференция
|||
Архив
|||
Главная страница
|||
Содержание