Danaher Motion
06/2005
BASIC Moves Development Studio
M-SS-005-03 Rev
E
19
For example:
In config file ->
Type X
Type as Long
Length as Long
End Type
In application file ->
Dim shared s1 as X
Program
?s1->Type
End program
Do not define the size of the structure data type. The size of the structure is
constant. If you declare more structure elements than allowed, a translation
error is generated.
2.2.4.1.4 Assignment
The assignment of a structure uses the following syntax:
<
variable_name
> = <
expression
> where <
expression
> is of
structure type
Whole structure assignment is allowed only if both structures are of the same
structure type. For example:
Dim STa1 As Type_1
Dim STb1 As Type_1
Dim STa2 As Type_2
STa1 = STb1 -> Structure types match
STa2 = STa1 -> Error - structure type mismatch
2.2.4.1.5 Elements
A structure element is addressed through the structure’s name and the arrow
sign. For example:
<
structure_name
>{[]…}-><
element_name
>{[]}
Structure elements are handled almost like regular variables. Structure
elements are printed, assigned, participate in mathematical operations, and
string-type elements are concatenated to other strings. They can also serve
as arguments of system functions (
SIN
,
UCASE$
, etc.), used in logic
statements and as conditions of flow control statements and event
definitions. For example:
Common Shared ST As STRUCT
PRINT ST->LongElm1
ST->LongElm2 = 21.2 * ST->LongArrElm[1]
? UCASE$(“String Element Is: “ + ST->StringElm)
IF ST->LongElm1 > 0 THEN
SELECT CASE ST->LongElm2
2.2.5. System
Elements
There are several system elements: axes, groups, cam tables, PLSs,
conveyers and compensation tables. These are not regular data types, but
are more like user interfaces of the system's internal memory or internal
function calls. You cannot handle them as a whole in expressions.
Each
system element has a set of properties, which is accessed through syntax
resembling data elements of a structure, using the point character.