symbol SCL = PORTE.0 symbol SDA = PORTE.1 symbol ADDR = %10010000 'for the DS1621, this is set as 1001 binary for read and write operations. 'The next 3 bits of the control byte are the device select bits (A2, A1, A0).
Temp var WORD
' Define LCD pins Define LCD_DREG PORTB Define LCD_DBIT 4 ' Set starting Data bit (0 or 4) if 4-bit bus Define LCD_RSREG PORTB 'LCD register select port Define LCD_RSBIT 2 'LCD register select bit Define LCD_EREG PORTB 'LCD enable port Define LCD_EBIT 3 'LCD read/write port DEFINE LCD_BITS 4 ' Set LCD bus size (4 or 8 bits)
Lcdout $FE,1 pause 500
mainloop:
I2CWRITE SDA,SCL,ADDR,$ac,[0] 'Access Config [ACh] If R/W is “0” this command writes to the configuration register. pause 100
I2CWRITE SDA,SCL,ADDR,$ee 'Start Convert T [EEh] This command begins a temperature conversion. Pause 1000
I2CREAD SDA,SCL,ADDR,$aa,[Temp] 'Read Temperature [AAh] This command reads the last temperature conversion result. 'The DS1621 will send 2 bytes, in the format described earlier, which are the contents of this register Temp = Temp >> 8
lcdout $FE,2,"Temp:",Dec2(Temp)
goto mainloop
End
имею на ногах такое
смущает, на третьем скриншоте ответ датчика - setup read from 0x91 - ну и дальше, всегда (вне зависимости от температуры датчика) одно и тоже 0xFF и 0x80... адресные ноги A0-A2 на земле, выходы притянуты к питашке резиками 4K7 ...