Hello!
Function onewire_read() always return 0, so it will be infinite loop.
Function must read data from 18b20 temperature sensor.
Code C - [expand] |
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
| int onewire_read()
{
int count, data;
for (count=0; count<8; ++count)
{
output_low(ONE_WIRE_PIN);
delay_us( 2 ); // pull 1-wire low to initiate read time-slot.
output_float(ONE_WIRE_PIN); // now let 1-wire float high,
delay_us( 8 ); // let device state stabilise,
shift_right(&data,1,input(ONE_WIRE_PIN)); // and load result.
delay_us( 120 ); // wait until end of read slot.
}
return( data );
} |
Defined
Code C - [expand] |
1
| #define ONE_WIRE_PIN PIN_A0 |
Same problem discuss here
https://www.edaboard.com/threads/5984/