i need help with DS1820 temperature sensor one-wire.
whats wrong in my code
i need read temperature on PORTB.7 and if temperature is 25°C then 1 is on PORTB.0
i dont use LCD
Please help
main:
PORTB = 00000000
TRISB = 10000000
read_temperature:
PORTB.0 = 0
Ow_Reset(PORTB,7)
Ow_Write(PORTB,7,$CC)
Ow_Write(PORTB,7,$44)
Delay_us(120)
Ow_Reset(PORTB,7)
Ow_Write(PORTB,7,$CC)
Ow_Write(PORTB,7,$BE)
temp = Ow_Read(PORTB,7)
temp = (Ow_Read(PORTB,7) << 8) + temp
Delay_ms(500)
IF temp = 25 then PORTB.0 = 1
else PORTB.0 = 0
end if
delay_ms(500)
goto read_temperature
end.