In SX Microcontrollers, SX/B Compiler and SX-Key Tool, tdg8934 wrote: I tried to pass a variable to a subroutine which is inside of another subroutine and it is not sucessfull. For example: [code] temp1 VAR Byte cs VAR Byte Subroutine1 SUB 2 Subroutine2 SUB 1 PROGRAM Start Main: cs = 5 Subroutine1 3, cs END SUB Subroutine1 temp1 = __PARAM1 cs = __PARAM2 [b]Subroutine2 cs[/b] temp1 = temp1 + 1 'Do something with temp1 now.... ENDSUB SUB Subroutine2 cs = __PARAM1 cs = cs + 1 'Do something with cs now.... ENDSUB [/code] Something like this format does not work unless even if I declare in the begining of the program: cs = 5 However, If I change it to this, it works: [code] temp1 VAR Byte cs VAR Byte Subroutine1 SUB 1 Subroutine2 SUB 1 PROGRAM Start Main: Subroutine1 3 END SUB Subroutine1 temp1 = __PARAM1 [b]Subroutine2 5[/b] temp1 = temp1 + 1 'Do something with temp1 now.... ENDSUB SUB Subroutine2 cs = __PARAM1 cs = cs + 1 'Do something with variable2 now.... ENDSUB [/code] Any ideas? ---------- End of Message ---------- You can view the post on-line at: http://forums.parallax.com/forums/default.aspx?f=7&p=1&m=375134 Need assistance? Send an email to the Forum Administrator at forumadmin@parallax.com The Parallax Forums are powered by dotNetBB Forums, copyright 2002-2009 (http://www.dotNetBB.com)