bianchi77
Advanced Member level 4

- Joined
- Jun 11, 2009
- Messages
- 1,313
- Helped
- 21
- Reputation
- 44
- Reaction score
- 20
- Trophy points
- 1,318
- Location
- California
- Activity points
- 9,442
Guys,
I tried to read DS18B20...
but the output in USART is
Temperature : ?
What should I change in this code ? thanks
I tried to read DS18B20...
but the output in USART is
Temperature : ?
What should I change in this code ? thanks
Code:
char printbuff[100];
double d = 0;
int d1 = d;
usart_init(BAUD_PRESCALE);
usart_pstr("TEST DS18B20 \n" );
//init interrupt
sei();
while(1)
{
d = ds18b20_gettemp();
//printf(printbuff,"%d",d1);
sprintf(printbuff, "%.2f", d);
usart_pstr("Temperature:");
usart_pstr(printbuff);
usart_pstr("\r\n");
_delay_ms(500);
}