In SX Microcontrollers, SX/B Compiler and SX-Key Tool, JonnyMac wrote: SUBs and FUNCs are covered in the Definitions section of the help file. The reason for the number is that it tells the compiler how many (possible) bytes you can pass to the subroutine. In your question, the "1, 2" means that the subroutine expects at least one byte, but could handle two. A good use for subroutines is to encapsulate SX/B keywords that generate a lot of code; PAUSE, for example. By putting PAUSE into a subroutine it only gets compiled once. By allowing variable parameters the subroutine can be as flexible as the original keyword. This subroutine handles PAUSE and will accept byte or word values. [code] ' Use: DELAY ms ' -- 'ms' is delay in milliseconds, 1 - 65535 DELAY: IF __PARAMCNT = 1 THEN tmpW1 = __PARAM1 ' save byte value ELSE tmpW1 = __WPARAM12 ' save word value ENDIF PAUSE tmpW1 RETURN [/code] Note that if your subroutine doesn't require any parameters you should specify zero. ---------- End of Message ---------- You can view the post on-line at: http://forums.parallax.com/forums/default.aspx?f=7&p=1&m=189955#m189958 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)