MikroElektronika PIC Microcontrollers PIC16 Manual de usuario Pagina 77

  • Descarga
  • Añadir a mis manuales
  • Imprimir
  • Pagina
    / 172
  • Tabla de contenidos
  • MARCADORES
  • Valorado. / 5. Basado en revisión del cliente
Vista de pagina 76
if A > B then ...
if A > 47 then ...
if A + B > A ...
First, compiler evaluates the expression on the left. During runtime, result is stored
in a variable of type that matches the largest data type in the expression. In this
case it is byte, as variables A and B are both bytes.
This is correct if the value does not exceed range 0..255, that is, if A + B is less
than 255.
Let's assume Aa is of word type :
if Aa + B > A ...
First, compiler evaluates the expression on the left. The result value is treated as
type that matches the largest data type in the expression. Since Aa is word and B
is byte, our result will be treated as word type.
This is correct if the value does not exceed range 0..65535, i.e. if Aa + B is less
than 65535.
' if tC is less than zero, tC = -tC
if tC < 0 then
tC = -tC
end if
' Stay in loop while C is not equal to variable
' compare_match; increment C in every cycle
while tC <> compare_match
tC = tC + 1
wend
mikroBASIC
- Basic Compiler for Microchip PIC microcontrollers
72
mikroBASIC
MikroElektronika: Development tools - Books - Compilers
making it simple...
page
Example
Vista de pagina 76
1 2 ... 72 73 74 75 76 77 78 79 80 81 82 ... 171 172

Comentarios a estos manuales

Sin comentarios