ID : 5236
Local Variable
Available Variable Types for Local Variable
The following variable types can be used as local variables in the same manner as global variables.
- Type I: Integer variable (range: - 2147483648 to + 2147483647)
- Type F: Floating-point variable of type real (-3.402823E + 38 to 3.402823E + 38)
- Type D: Double-precision variable of type real (- 1.79769313486231D + 308 to 1.79769313486231D + 308)
-
Type S: String variable (maximum of 243 characters)
- Type V: Vector variable (X, Y, Z)
- Type P: Position variable (X, Y, Z, RX, RY, RZ, FIG)
- Type J: Joint variable (J1, J2, J3, J4, J5, J6) (6 axes) (J1, J2, J3, J4)(4 axes)
- Type T: Homogeneous transform variable (X, Y, Z, Ox, Oy, Oz, Ax, Ay, Az, FIG)
- Type IO: I/O variable
Declaring Local Variables
Local variables can be used after type declaration is executed using type declaration commands.
Type declaration can also be executed using the type declaration characters for numeric value type and character string type local variables.
There are two ways to declare local variables as shown below.
Type | Declaration example 1 | Declaration example 2 |
---|---|---|
Type I | Dim AAA As Integer | AAA% |
Type F | Dim AAA As Single | AAA! |
Type D | Dim AAA As Double | AAA# |
Type S | Dim AAA As String | AAA$ |
Type V | Dim AAA As Vector | - |
Type P | Dim AAA As Position | - |
Type J | Dim AAA As Joint | - |
Type T | Dim AAA As Trans | - |
Type IO | Defio AAA | - |
Defio is used for IO type only and Dim is used for other types of variables.
As Declaration example 2 shows, postposition is available for I, F, D, S type to declare.
Dim Denso As Integer 'Declare integer variables Denso
Dim Robo As Integer 'Declare integer variables Robo
Dim AA As Double 'Declare double-precision variable AA
DefIO Port = Byte, 104, &B00101011
'Declare the IO variable Port and use 8 bits (BYTE)
'starting from input port 104
CC% = Denso*2 'Declare the integer variable CC and assign
'the calculation result of "Denso*2" to it
DD$ = "Denso Robot" 'Declare the string variable DD and assign the
'string "Denso Robot" to it
AA = F[5]/5 'Assign the result of the right side
'to the double-precision variable AA
In Robo = Port 'Convert I/O data of Port into decimal and
'assign it to the integer variable Robo
ID : 5236