In SX Microcontrollers, SX/B Compiler and SX-Key Tool, peterverkaik wrote: Tim, The ANALOGIN produces a 8bit value, 0-255, that represents the full scale. In case of the sx/b help file example, both resistors are equal and the input range is 0-5v. TrueVoltage = (Volt/255)*5v Your measured 85 therefore represents (85/255)*5v = 1.66v More generally, using Uinmin and Uinmax TrueVoltage = Uinmin + (Volt/255)*(Uinmax-Uinmin) Note that when you use this formula directly in sx/b you will not have a result in decimals due to the integer division. To have 2 decimals let TrueVoltage = 100 represent 1.00v TrueVoltage = 100*Uinmin + (100*Volt/255)*(Uinmax-Uinmin) Use words to do the math. regards peter ---------- End of Message ---------- You can view the post on-line at: http://forums.parallax.com/forums/default.aspx?f=7&p=1&m=278052#m278349 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)