Rockwell-automation 57C610 Enhanced Basic Language, AutoMax Manual de usuario Pagina 46

  • Descarga
  • Añadir a mis manuales
  • Imprimir
  • Pagina
    / 146
  • Tabla de contenidos
  • MARCADORES
  • Valorado. / 5. Basado en revisión del cliente
Vista de pagina 45
6Ć6
6.3 Variable Assignment
(LET/SET_MAGNITUDE)
There are two formats for assigning a value to a variable: the LET
statement and the SET_MAGNITUDE statement. TheLET" in an
assignment is optional. In actuality tasks are more readable without
LET" in front of the assignment. Its use is left to the discretion of the
programmer.
The following is the LET statement format:
LET variable = expression
where:
variable = simple (A%) or subscripted [A%(5)]; variable of
any data type.
expression = can be as simple as a constant or as involved
as a complex arithmetic expression. (See
section 5.0).
The following are valid LET statements:
10 LET SPEED%=25
15 LET MESSAGE$=SYSTEM FAILURE"
95 WINDER_EMPTY@=TRUE
25 GAIN_CHANGE!=GAIN%*13
10
A% = B% + C% - (D% / 234) + 15 -F%
22
TENSION = TENSION - ((19.7765 * &
GAIN%)/78 - 12.3) + OLD_REFERENCE
The following are invalid LET statements:
10 LET =
ĂA% (no variable specified on the left side of the
Ăequal sign)
10 LET A%Ă=
THIS IS A MES
SAGE" (a string value cannot
be assigned to an integer variable)
10 LET A% = 6+22-(B%-34)+(missing term)
(Invalid
expression)
The purpose of the SET_MAGNITUDE statement is to allow the
programmer to enter 16Ćbit hexadecimal values without having to
worry about sign extending the numbers into a 32Ćbit form. The
following is the SET_MAGNITUDE statement format:
SET_MAGNITUDE (variable, value)
where:
variable = a numeric simple variable (integer, double
integer) (not an array)
value =
a numeric constant or expression of same type
as variable
If the variable specified in the statement is a single integer variable,
the value loaded will be only the lower 16Ćbits of the value field with
no sign extension:
10 SET_MAGNITUDE(A%,0FFFFH)
(A% is replaced by 0FFFFH)
10 SET_MAGNITUDE(A%,0C249H OR 1234H)
(A% is replaced by 0D23DH)
Vista de pagina 45
1 2 ... 41 42 43 44 45 46 47 48 49 50 51 ... 145 146

Comentarios a estos manuales

Sin comentarios