Up to 32 (0-31) subroutines can be called upon. Subroutines are independent program snippets that can be accessed based on the needs of the programmer.  Typically, subroutines are used to perform functions that are repeated throughout the operation and can be used in conjunction with logic statements related to motor actions or the status of inputs and outputs.  Sections 5.4.6 Standalone Example Program 6 – Single Thread with subroutine, 5.4.9 Standalone Example Program 9 – Multi-thread with subroutine, and 5.4.10 Standalone Example Program 10 – Multi-thread with subroutine contain examples of using a subroutine in a program.

Subroutine 31 is used specifically for error handling and is executed whenever an error occurs.

Note: subroutines can be shared by both standalone programs and the ASCII command set.  Once a subroutine is written into the flash memory, it can be recalled via ASCII communication using the GS command. Standalone programs can also jump to a subroutine using the GOSUB command. The subroutines are referenced by their subroutine number [SUB 0- SUB 31]. If a subroutine number is not defined, the controller will return with an error.

  

< Previous Section | Topic Home | Home |  Next Section  >