In SX Microcontrollers, SX/B Compiler and SX-Key Tool, CrustyNoodle wrote: Hi, I'm trying to get the sensirion SHT1x humidity sensor up and running with my SX28 and I'm having a little trouble... I've adapted the example Basic Stamp code to mostly work under SX/B to the point whereby I am able to get readings from the SHT1x and I am able to do the calcs to get the correct temperature however I can't get the humidity calcs to work - due to my inexperience/ignorance I suspect. The code example to linearize the humidity reading is: [code] ' linearize humidity: ' rhLin = (soRH * 0.0405) - (soRH * 0.004 * soRH * 0.0007) - 4 ' Note that soRH is a word variable that holds the reading from the SHT1x and rhLin is also defined as a word variable. With Basic Stamp code to do this: [/code] [code] rhLin = soRH ** 26542 rhLin = rhLin - ((soRH ** 3468) * (soRH ** 3468) + 50 / 100) rhLin = rhLin - 40 [/code] So apart from the fact that I haven't managed to work out how we got from the first box to the second (I need to do more reading here) and that it would appear that SX/B can only do one math operation per line (I probably should have read this but ended up working it out by trial and error), I am still unable to replicate this code (or should I say the result from this code) using SX/B. Is the answer straight forward or do I need to go back to school to learn about maths in binary and hex? ---------- End of Message ---------- You can view the post on-line at: http://forums.parallax.com/forums/default.aspx?f=7&p=1&m=272864 Need assistance? Send an email to the Forum Administrator at forumadmin@parallax.com The Parallax Forums are powered by dotNetBB Forums, copyright 2002-2008 (http://www.dotNetBB.com)