In SX Microcontrollers, SX/B Compiler and SX-Key Tool, Zoot wrote: [quote="Zoot"]signed byte (-127 to 127 )[/quote] First "param" is either byte or word (unsigned). Second "param" is byte only, signed, as above. Result is unsigned. FYI -- the code above works (I'm already using it). Just figured there might be a more elegant way. Since I'm tired today and not sure I'm explaining it decently, here's pseudo code to explain: [code]x = some byte value from 0 to 255 y = some byte value from -127 to 127 z = result z = x + y if ( z < 0 ) { z = 0 } elseif ( z > 255 ) { z = 255 }[/code] ---------- End of Message ---------- You can view the post on-line at: http://forums.parallax.com/forums/default.aspx?f=7&p=1&m=286020#m286363 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)