MikroElektronika PIC Microcontrollers PIC16 Bedienungsanleitung Seite 69

  • Herunterladen
  • Zu meinen Handbüchern hinzufügen
  • Drucken
  • Seite
    / 172
  • Inhaltsverzeichnis
  • LESEZEICHEN
  • Bewertet. / 5. Basierend auf Kundenbewertungen
Seitenansicht 68
Example 2:
Explicit conversion can also be used when you are sure which type you want to
convert expression to. Consider the following lines:
dim tA as byte
dim tB as byte
dim tC as byte
dim A_ as short
dim B_ as short
tA = byte(A_)
B_ = short(tA + tB * tC)
It is important to understand that explicit conversion between signed and unsigned
data does not change binary representation of data; it only allows copying source
to destination. Thus, if A_ was -1, its binary representation would be 11111111,
and A would become 255.
Even if you have ordered the explicit conversion, compiler will perform implicit if
necessary.
Example 3:
You cannot execute explicit conversion on the operand left of the assignment oper-
ator:
word(b) = Bb
' compiler will report an error.
mikroBASIC
- Basic Compiler for Microchip PIC microcontrollers
64
mikroBASIC
MikroElektronika: Development tools - Books - Compilers
making it simple...
page
Seitenansicht 68
1 2 ... 64 65 66 67 68 69 70 71 72 73 74 ... 171 172

Kommentare zu diesen Handbüchern

Keine Kommentare