In SX Microcontrollers, SX/B Compiler and SX-Key Tool, JonnyMac wrote: converting your CalcTime subroutine to a function so that you can pass it a value and have it return a value. [code]FUNC CALC_TIME tmpB1 = __PARAM1 LOOKUP tmpB1, 1, 2, 3, 5, 10, 20, 30, 50, 100, 120, tmpB1 RETURN tmpB1 ENDFUNC[/code] In use, you'd do this: [code] counter = CALC_TIME del1[/code] For the greatest code re-use you'll want to avoid using global variables in your subroutines and functions -- instead, pass values back and forth as parameters. ---------- End of Message ---------- You can view the post on-line at: http://forums.parallax.com/forums/default.aspx?f=7&p=1&m=211027#m211091 Need assistance? Send an email to the Forum Administrator at forumadmin@parallax.com The Parallax Forums are powered by dotNetBB Forums, copyright 2002-2007 (http://www.dotNetBB.com)