Command used to set or return the value of a variable. When used in standalone programming, variables can also be used in mathematical operations.


Applies to: CMD-4CR, CMD-4EX-SA, PMX-4EX-SA, PMX-4ET-SA, PMX-2ED-SA, PMX-2EX


ASCII/Standalone                V[var]                


Syntax:                        

Read:

V[var]                

Where:        [var] specifies variable number (0-99 for 4-axis controllers, 0-64 for 2-axis controllers) 


Write:

V[var]=[value]                

Where:        [var] specifies variable number (0-99 for 4-axis controllers, 0-64 for 2-axis controllers) 

[value] specifies the set value for the variable, 32-bit value range

Reply: 

Command is accepted and executed

Read:         

Return the standalone variable value


Write:           

OK


Command cannot be processed

       An error message is returned. See Error Codes

Example: 

Read:        

V12                * Returns the value of variable V12


Write:        

V88=1000        * Sets the variable V88 to equal 1000


Applies to: Standalone mode only 

V3=V3+7        * Sets the value of V3 to the current value of V3 + 7


Notes:

  • Variables can be set to specific values between -2,147,483,648 and +2,147,483,647
  • Variables can be used with the following mathematical expressions. The syntax for all available operations can be found below.


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

|

Bitwise OR

V1=V2|8

~

Bitwise NOT

V1=~V2

Operations

  • Note that mathematical operations can only be performed in standalone programming.

Applies to: CMD-4CR, CMD-4EX-SA

  • Variables V0 through V99 can be stored to flash memory using the STORE command

Applies to: PMX-4EX-SA, PMX-4ET-SA

  • Variables V50 through V99 can be stored to flash memory using the STORE command
  • Variables V0-V49 will be initialized to zero on power up

Applies to: PMX-2ED-SA, PMX-2EX

  • Variables V32 through V63 can be stored to flash memory using the STORE command
  • Variables V0-V31 will be initialized to zero on power up

See also:

Standalone Programming

SACTRL, SAP, SASTAT, SLOAD, GS, SPC

Commander Manual

2.1.1.1 Identification Number