one question about the sensirion sht library. I tried it with a PIC18F6722. But unfortunately I get no data from the sensor...
10k pullup resistor is there. When I meassure the data and clock line I get no signal...
What I`m doing wrong?
Code: Select all
program SHT_Test
include sensirion_lib_P18
dim SHTxx_SDA as sbit at RA5_bit
SHTxx_SDA_dir as sbit at TRISA5_bit
SHTxx_SCLK as sbit at RA4_bit
SHTxx_SCLK_dir as sbit at TRISA4_bit
dim NoError as boolean
temperature, humidity as float
temperature_d, humidity_d as integer
lcd_txt as string[20]
main:
OSCCON = %01110000
ADCON1 = %11111111
UART2_Init(19200)
Sensirion_init()
while true
NoError = sensirion_get_temp_hum_dec(temperature_d, humidity_d)
if NoError then
lcd_txt = "Temperature "
UART2_Write_Text(lcd_txt)
IntToStr(temperature_d, lcd_txt)
StrCat(lcd_txt, " C")
UART2_Write_Text(lcd_txt)
lcd_txt = "Humidity "
UART2_Write_Text(lcd_txt)
IntToStr(humidity_d, lcd_txt)
StrCat(lcd_txt, " %")
UART2_Write_Text(lcd_txt)
else
lcd_txt = "ERROR READING SHTxx "
UART2_Write_Text(lcd_txt)
end if
delay_ms(4000)
wend
end.