User`s manual
mikroBASIC
- Basic Compiler for Microchip PIC microcontrollers
If number is converted from less complex to more complex data type, upper bytes
are filled with zeros. If number is converted from more complex to less complex
data type, data is simply truncated (upper bytes are lost).
If number is converted from less complex to more complex data type, upper bytes
are filled with ones if sign bit equals 1 (number is negative). Upper bytes are filled
with zeros if sign bit equals 0 (number is positive). If number is converted from
more complex to less complex data type, data is simply truncated (upper bytes are
lost).
program extr
dim Sa as short
dim A as byte
dim Bb as word
dim Sbb as integer
dim Scccc as longint
A = A + Sa
' compiler will report an error,
' mixing signed with unsigned;
A = A - Sa
' compiler will report an error,
' mixing signed with unsigned;
' But you can freely combine byte with word . .
Bb = Bb + (A * A)
' . . and short with integer and longint
Scccc = Sbb * Sa + Scccc
end.
MikroElektronika:
Development
tools
-
Books
-
Compilers
mikroBASIC
making it simple...
77
page
Unsigned and
Conversion
Signed and
Conversion
Example