In SX Microcontrollers, SX/B Compiler and SX-Key Tool, Jon Williams wrote: As of version 1.2 we have added the ability to declare a subroutine to the compiler; this helps the programmer in two ways: 1) Subroutines can exist anywhere in memory now 2) The compiler will check for the proper number of parameters. In one of the posts above I showed a the subroutine code for TX_BYTE. Here's how that's declared to the compiler: TX_BYTE SUB 1, 2 The "1, 2" section tells the compiler that this subroutine requires one parameter, and could take two. So if you do something like this: TX_BYTE aVal, bVal, cVal The compiler will flag it as too many parameters. Notice too that I didn't need to use GOSUB -- this is optional with declared subroutines and saves a bit of typing. Really, it's like adding your own commands. For an example, have a look at this [early] version of the Serial Inkjet Printer drive code. [url=http://forums.parallax.com/forums/attach.aspx?a=4029]http://forums.parallax.com/forums/attach.aspx?a=4029[/url] You'll see a bunch of declared subroutines -- some with no parameters, so with mandatory and optional parameters. ---------- End of Message ---------- You can view the post on-line at: http://forums.parallax.com/forums/default.aspx?f=7&p=2&m=95955#m96230 Need assistance? Send an email to the Forum Administrator at forumadmin@parallax.com The Parallax Forums are powered by dotNetBB Forums, copyright 2002-2005 (http://www.dotNetBB.com)