PMX-4EX-SA Manual
page 56
Rev 3.11
6.25.4. Standalone Subroutines
The PMX-4EX-SA has the capabilities of using up to 32 separate subroutines.
Subroutines are typically used to perform functions that are repeated throughout
the operation of the standalone program. Note that subroutines can be shared by
both standalone programs. Refer to section 9 for further details on how to define
subroutines.
Once a subroutine is written into the flash, they can be called via USB
communication using the
GS
command. Standalone programs can also jump to
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.
6.25.5. Error Handling
Subroutine 31 is designated for error handling. If an error occurs during
standalone execution (i.e. limit error, StepNLoop error), the standalone program
will automatically jump to SUB 31. If SUB 31 is not defined, the program will
cease execution and go into error state.
If SUB 31 is defined by the user, the code within SUB 31 will be executed.
Typically the code within subroutine 31 will contain the standalone command
ECLEARX
in order to clear the current error. Section 9 contains examples of
using subroutine 31 to perform error handling.
The return jump from subroutine 31 will be determined by the ASCII command
SAP
. Write a "0" to this setting to have the standalone program jump back to the
last performed line. Write a "1" to this setting to have the standalone program
jump back to the first line of the program.
6.25.6. Standalone Variables
The PMX-4EX-SA has 100 32-bit signed standalone variables available for
general purpose use. They can be used to perform basic calculations and
support integer operations. The
V[0-99]
command can be used to access the
specified variables. The syntax for all available operations can be found below.
Note that these operations can only be performed in standalone programming.
Operator
Description
Example
+
Integer Addition
V1=V2+V3
-
Integer Subtraction
V1=V2-V3
*
Integer Multiplication
V1=V2*V3
/
Integer Division (round down)
V1=V2/V3
%
Modulus
V1=V2%5
>>
Bit Shift Right
V1=V2>>2
<<
Bit Shift Left
V1=V2<<2
&
Bitwise AND
V1=V2&7
Содержание PMX-4EX-SA
Страница 1: ...PMX 4EX SA Manual page 1 Rev 3 11 PMX 4EX SA Advanced 4 Axis Stepper Motion Controller ...
Страница 9: ...PMX 4EX SA Manual page 9 Rev 3 11 3 Dimensions 3 1 PMX 4EX SA TBS Dimensions Figure 3 0 ...
Страница 10: ...PMX 4EX SA Manual page 10 Rev 3 11 3 2 PMX 4EX SA TB9 Dimensions Figure 3 1 ...
Страница 19: ...PMX 4EX SA Manual page 19 Rev 3 11 4 11 PMX 4EX SA Interface Circuit Figure 4 10 ...