MikroElektronika PIC Microcontrollers PIC16 Manual do Utilizador Página 73

  • Descarregar
  • Adicionar aos meus manuais
  • Imprimir
  • Página
    / 172
  • Índice
  • MARCADORES
  • Avaliado. / 5. Com base em avaliações de clientes
Vista de página 72
As already stated, destination will store the correct value only if it can properly
represent the result of the expression (that is, the result fits in destination range).
dim testA as byte
dim testB as byte
dim Cc as word
dim Sa as short
dim Sb as short
dim Sc as short
dim Saa as integer
dim Sbbbb as longint
main:
testA = 250
testB = 10
Cc = testA * testB + testB
' Cc becomes 2510;
Sb = 120
Sc = -100
Sa = Sb + Sc
' Sa becomes 20;
Sa = Sb - Sc
' Sa is short with range -127..128,
' thus, instead of 220,
' Sa becomes -36, because only
' lower 8 bits are registered
Saa = (Sb * Sc) div 13
' Saa becomes -923
Sbbbb = integer(Sb * Sc) * Sc
' Sbbbb becomes 1200000
end.
mikroBASIC
- Basic Compiler for Microchip PIC microcontrollers
68
mikroBASIC
MikroElektronika: Development tools - Books - Compilers
making it simple...
page
Vista de página 72
1 2 ... 68 69 70 71 72 73 74 75 76 77 78 ... 171 172

Comentários a estes Manuais

Sem comentários