Hola ,tengo un pequño problema he conseguido hacer funcionar un sensor de temp el ds1621,el codigo que pongo a continuacion me funciona pero a medias ,me explico la parte de temp entera el byte msb perfecto pero la parte decima el lsb siempre me devuelve la misma cantidad 255, con locual no se si no lo esta leyendo bien o que me falta alguna configuracion del sensor ,pongo el codigo a ver si me pueden ayudar,gracias
dim Soft_I2C_Scl as sbit at RA0_bit
dim Soft_I2C_Sda as sbit at RA1_bit
dim Soft_I2C_Scl_Direction as sbit at TRISA0_bit
dim Soft_I2C_Sda_Direction as sbit at TRISA1_bit
dim take as byte
dim tak as byte
txt as string[3]
dim
LCD_RS as sbit at RB0_bit
LCD_EN as sbit at RB1_bit
LCD_D7 as sbit at RB7_bit
LCD_D6 as sbit at RB6_bit
LCD_D5 as sbit at RB5_bit
LCD_D4 as sbit at RB4_bit
dim
LCD_RS_Direction as sbit at TRISB0_bit
LCD_EN_Direction as sbit at TRISB1_bit
LCD_D7_Direction as sbit at TRISB7_bit
LCD_D6_Direction as sbit at TRISB6_bit
LCD_D5_Direction as sbit at TRISB5_bit
LCD_D4_Direction as sbit at TRISB4_bit
main:
Soft_I2C_Init()
Soft_I2C_Start()
Soft_I2C_Write(%10010000)
Soft_I2C_Write($ee)
Soft_I2C_Write(0)
Soft_I2C_Stop()
delay_ms 1000
inicio:
lcd_init()
Soft_I2C_Start()
Soft_I2C_Write(%10010000)
Soft_I2C_Write($aa)
Soft_I2C_Start()
Soft_I2C_Write(%10010001)
take = Soft_I2C_Read(0)
tak = Soft_I2C_Read(1)
Soft_I2C_Stop()
lcd_cmd(_lcd_clear)
lcd_cmd(_LCD_CURSOR_OFF)
ByteToStr(take, txt)
lcd_out(1,1,txt)
ByteToStr(tak, txt)
lcd_out(2,1,txt)
goto inicio
end.