Just curious, what humidity sensor are you using.
If you know WHERE the data digits are, you can simply do math on the ascii characters.
result=100*(array[5]-48)+10*(array[6]-48)+array[7]-48
As for bringing in the 2nd sensor, can you look at using a chip enable if they're open collector outputs, and then just select one or the other on the same hserin input?
-------------------Picster-----------------
My array is 13 bits long. Assuming the array numbers start with 0 and ends at 12. Here is the string (the x's represent numbers in ascii) H xx.x T xx.x with the spaces (I assume) part of the array. I need to use the numbers after T xx.x (which is temperature in Celsius) and convert it to Fahrenheit. Here is what I used:
temp=(humidity1[9]* 90) / 5
temp1=(humidity1[10]*9)/ 5
temp2=(humidity1[12]*9)/50
tempfin=temp+temp1+temp2+32
Humidity is the str array variable that holds the information. When I get the final value and output it on the lcd, I get an unrecognizable character. Any suggestions? thanks
Yep, you need to subtract 48 from each ASCII value to come up with the numerical value before you do the factoring.
------------------Picster-----------------
It works now. thanks. Just out of curiosity, why do you subtract 48? I forgot to mention earlier, I am using HS-2000D humidity sensor made by PRECONUSA.
the answer is located in the ASCII table in your PBP manual. Character 0 is decimal ASCII 48.
Steve
It's not a bug, it's a random feature.
There's no problem, only learning opportunities.
Hi,
check the thread R/H Temp sensor.
Bruce used the same sensor and posted the code to show H and Temp in C and F.
I am using the same sensor and some of Bruces work in my code.
Works like a champ!!!
Joe
Bookmarks