Rockwell-automation 1771-DB BASIC MODULE Manuel d'utilisateur Page 121

  • Télécharger
  • Ajouter à mon manuel
  • Imprimer
  • Page
    / 394
  • Table des matières
  • DEPANNAGE
  • MARQUE LIVRES
  • Noté. / 5. Basé sur avis des utilisateurs
Vue de la page 120
Chapter
Expressions, Variables and Operators
9
9 -11
ATN
Use the ATN operator to return the arctangent of the argument.
The result is in radians. Calculations are carried out to 7 significant digits.
The ATN operator returns a result between +
PI/2 (3.1415926/2).
>PRINT ATN(PI) Result: 1.2626272
>PRINT ATN(1)
Result: .78539804
The BASIC module contains a complete set of functional operators.
These operators are single-operand operators.
ABS
Use the ABS operator to return the absolute value of the expression.
>PRINT ABS(5) Result:
5
>PRINT ABS(-5) 5
NOT
Use the NOT operator to return the one’s complement of the expression.
The one’s complement is the inverse of the number. BASIC converts the
integer to binary and reverses the state of each bit within the number (ex. it
turns 1s to 0s and 0’s to 1’s). Then BASIC converts the result back into
integer format. The expression must be a valid integer (ex.
between
0
and 65535 (0FFFFH) inclusive
). Non-integers are truncated, not
rounded.
>PRINT NOT(65000) Result: 535
This example calculates the one’s complement for the number 65000 and
prints the result. First, BASIC converts 65000 to binary:
650000 =1 1 1 1 1 1 0 1 1 1 1 0 1 0 0 0
Then the BASIC module replaces the 1’s with 0’s and the 0’s with 1s.
1 1 1 1 1 1 0 1 1 1 1 0 1 0 0 0
0 0 0 0 0 0 1 0 0 0 0 1 0 1 1 1
BASIC converts the resulting binary number back into an integer and
prints the result.
0 0 0 0 0 0 1 0 0 0 0 1 0 1 1 1 = 535
Functional Operators
Vue de la page 120
1 2 ... 116 117 118 119 120 121 122 123 124 125 126 ... 393 394

Commentaires sur ces manuels

Pas de commentaire