MikroElektronika PIC Microcontrollers PIC16 Manuel d'utilisateur Page 86

  • Télécharger
  • Ajouter à mon manuel
  • Imprimer
  • Page
    / 172
  • Table des matières
  • MARQUE LIVRES
  • Noté. / 5. Basé sur avis des utilisateurs
Vue de la page 85
mikroBASIC
- Basic Compiler for Microchip PIC microcontrollers
If number is converted from less complex to more complex data type, upper byte
is filled with zeros;
If number is converted from more complex to less complex data type, data is sim-
ply truncated (upper bytes are lost).
Example for unsigned and logical operators :
dim teA as byte
dim Bb as word
main:
Bb = $F0F0
teA = $aa
Bb = Bb and teA
' Bb becomes $00a0
end.
In this case, A is treated as a word with upper byte equal to 0 prior to the opera-
tion.
If number is converted from less complex data type to more complex, upper bytes
are filled with ones if sign bit is 1 (number is negative); upper bytes are filled with
zeros if sign bit is 0 (number is positive).
If number is converted from more complex data type to less complex, data is sim-
ply truncated (upper bytes are lost).
dim Sa as short
dim Sbb as integer
main:
Sbb = $70FF
Sa = -12
Sbb = Sbb and Sa
' Bb becomes $70f4
end.
In this case, Sa is treated as an integer with the upper byte equal to $FF (this in
fact is sign extending of short to integer) prior to the operation.
MikroElektronika:
Development
tools
-
Books
-
Compilers
mikroBASIC
making it simple...
81
page
Unsigned and
Conversion
Signed and
Conversion
Vue de la page 85
1 2 ... 81 82 83 84 85 86 87 88 89 90 91 ... 171 172

Commentaires sur ces manuels

Pas de commentaire