Campbell-scientific CR1000 Measurement and Control System Manual de usuario Pagina 494

  • Descarga
  • Añadir a mis manuales
  • Imprimir
  • Pagina
    / 588
  • Tabla de contenidos
  • SOLUCIÓN DE PROBLEMAS
  • MARCADORES
  • Valorado. / 5. Basado en revisión del cliente
Vista de pagina 493
Appendix A. CRBasic Programming Instructions
494
The result of these operators is the value of the left hand operand with all of its
bits moved by the specified number of positions. The resulting "holes" are filled
with zeroes.
Consider a sensor or protocol that produces an integer value that is a composite of
various "packed" fields. This approach is quite common to conserve bandwidth
and/or storage space. Consider the following example of an eight-byte value:
bits 7-6: value_1
bits 5-4: value_2
bits 3-0: value_3
Code to extract these values is shown in CRBasic example Using Bit-Shift
Operators
(p. 494).
With unsigned integers, shifting left is equivalent to multiplying by two. Shifting
right is equivalent to dividing by two.
<<
Bitwiseleftshift
Syntax
Variable = Numeric Expression >> Amount
>>
Bitwiserightshift
Syntax
Variable = Numeric Expression >> Amount
&
BitwiseANDassignment‐‐PerformsabitwiseANDofavariablewithan
expressionandassignstheresultbacktothevariable.
A.6.4 Compound-assignment operators
Table 117. Compound-Assignment Operators
Symbo
l
Name Function
^=
Exponent
assignment
Raises the value of a variable to the power of an expression and
assigns the result back to the variable.
*=
Multiplication
assignment
Multiplies the value of a variable by the value of an expression and
assigns the result to the variable.
+=
Addition
assignment
Adds the value of an expression to the value of a variable and
assigns the result to the variable. Also concatenates a String
expression to a String variable and assigns the result to the
variable.
-=
Subtraction
assignment
Subtracts the value of an expression from the value of a variable
and assigns the result to the variable.
/=
Division
assignment
Divides the value of a variable by the value of an expression and
assigns the result to the variable.
\=
Division integer
assignment
Divides the value of a variable by the value of an expression and
assigns the integer result to the variable.
Vista de pagina 493
1 2 ... 489 490 491 492 493 494 495 496 497 498 499 ... 587 588

Comentarios a estos manuales

Sin comentarios