News:

  • April 16, 2026, 04:19:50 PM

Login with username, password and session length

Author Topic: SubRoutines  (Read 8053 times)

jneill

  • Jr. Member
  • **
  • Posts: 19
SubRoutines
« on: March 06, 2011, 08:12:56 AM »
 :P  Can a subroutine be nested within a subroutine?

Example:
           Main Program .....

           .............(GTS/K1)
           .............(end)
         
           Sbr(K1
           .............(GTS/K1)
           .............(RT)
           .............(GTS/K2)
           .............(RT

           .............(RT)

I know and appologize for the cruedness, but I am sure you all get the picture

Thanks!
     

b_carlton

  • Internal Dev
  • Hero Member
  • ****
  • Posts: 606
    • thePLCguy
Re: SubRoutines
« Reply #1 on: March 06, 2011, 09:37:12 AM »
Yes but with this warning as noted in the GTS instruction

Quote
The GTS instructions can be nested up to 8 levels

So you can't do large recursive things
An output is a PLC's way of getting its inputs to change.

Controls Guy

  • Internal Dev
  • Hero Member
  • ****
  • Posts: 3607
  • Darth Ladder
Re: SubRoutines
« Reply #2 on: March 29, 2011, 03:55:15 PM »
I'm pretty sure it's a bad idea to call K1 from WITHIN K1. ;D
I retract my earlier statement that half of all politicians are crooks.  Half of all politicians are NOT crooks.  There.