Небольшая проблемка возникла с реализацие цифрового термометра
Подключил два термодатчика ds1621 к меге 16 по i2c
копирнул текст проги из хелпа кодевижина
пуляю
на лсд 0 градусов показывает
и с одним датчиком пулял и перепаивал
все равно ноль
на датчике есть три ноги A0 A1 A2 для задания адресса обращения i2c(для подключение нескольких датчиков к шине) так вот я и не понял какое их значение соответсвует нулевому адрессу в кодевижин т.е этой команде t0=ds1621_temperature_10(0) ( 000 ? )
и какое следующему адрессу т.е этой команде t1=ds1621_temperature_10(1) ( 100 ? )
пробовал все по 5 В и все земли(сто пудово какой-то нулевой был

но посути дело не в этом т.к все равно не зафурыкало
понять не могу в чем трабла
в правильности програмной реализации я не сомневаюсь т.к все по хелпу
остается электрическая схема
я все на прямую делал
два провода к микрухе и два провода к питанию
погулял по инету везде вроде также
обвязки не видел
подскажите в чем хитрость....
вот код из хелпа:
Код
Example how to display the temperature of two DS1621 sensors with addresses 0 and 1:
/* 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 <ds1621.h>
/* the LCD module is connected to PORTC */
#asm
.equ __lcd_port=0x15
#endasm
/* include the LCD Functions */
#include <lcd.h>
/* include the prototype for sprintf */
#include <stdio.h>
/* include the prototype for abs */
#include <math.h>
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 #0 *10°C */
t0=ds1621_temperature_10(0);
/* read the temperature of DS1621 #1 *10°C */
t1=ds1621_temperature_10(1);
/* prepare the displayed temperatures */
/* 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);
/* display the temperatures */
lcd_clear();
lcd_puts(display_buffer);
};
}
/* 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 <ds1621.h>
/* the LCD module is connected to PORTC */
#asm
.equ __lcd_port=0x15
#endasm
/* include the LCD Functions */
#include <lcd.h>
/* include the prototype for sprintf */
#include <stdio.h>
/* include the prototype for abs */
#include <math.h>
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 #0 *10°C */
t0=ds1621_temperature_10(0);
/* read the temperature of DS1621 #1 *10°C */
t1=ds1621_temperature_10(1);
/* prepare the displayed temperatures */
/* 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);
/* display the temperatures */
lcd_clear();
lcd_puts(display_buffer);
};
}