bolandgoo
Newbie level 3
Hi,
I want to read temperature and humidity data from SHT11 by ATMEGA32. I use Code Vision compiler. The hardware is based on Figure 10 in the SHT11 datasheet.
The source code that I found was related to AT89s53 microcontroller. I changed something to prepare it to use with ATMEGA32. However the code had some errors that I think they don’t related to the kind of microcontroller. Here are some:
1) The “value” variable in the “s_write_byte” function cause an error.
After I changed this name to another, the compiler can compile it without any error.
2) I think the statement “if (error! = 0) “in the while is true every time and so I can’t read the data. After I changed it to “if (error==0) “the data replied.
3) The compiler has two important Warning. It says:
a) local variable ‘humi_val’ is used before it’s value is set.
b) local variable ‘temp_val’ is used before it’s value is set.
I was wondering if anybody would mind helping me to solve the problem.
Finally, I want to know, how can I translate the data that SHT11 will response to temperature and humidity? For example in the page 7 of its data sheet we can see 1073(Hex) equals 35.50% RH. How? What about temperature?
Thanks
I want to read temperature and humidity data from SHT11 by ATMEGA32. I use Code Vision compiler. The hardware is based on Figure 10 in the SHT11 datasheet.
The source code that I found was related to AT89s53 microcontroller. I changed something to prepare it to use with ATMEGA32. However the code had some errors that I think they don’t related to the kind of microcontroller. Here are some:
1) The “value” variable in the “s_write_byte” function cause an error.
After I changed this name to another, the compiler can compile it without any error.
2) I think the statement “if (error! = 0) “in the while is true every time and so I can’t read the data. After I changed it to “if (error==0) “the data replied.
3) The compiler has two important Warning. It says:
a) local variable ‘humi_val’ is used before it’s value is set.
b) local variable ‘temp_val’ is used before it’s value is set.
I was wondering if anybody would mind helping me to solve the problem.
Finally, I want to know, how can I translate the data that SHT11 will response to temperature and humidity? For example in the page 7 of its data sheet we can see 1073(Hex) equals 35.50% RH. How? What about temperature?
Thanks