MikroElektronika PIC Microcontrollers PIC16 Bedienungsanleitung Seite 77

  • Herunterladen
  • Zu meinen Handbüchern hinzufügen
  • Drucken
  • Seite
    / 172
  • Inhaltsverzeichnis
  • LESEZEICHEN
  • Bewertet. / 5. Basierend auf Kundenbewertungen
Seitenansicht 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
Seitenansicht 76
1 2 ... 72 73 74 75 76 77 78 79 80 81 82 ... 171 172

Kommentare zu diesen Handbüchern

Keine Kommentare