13.07.2015 Views

TASKING VX-toolset for 8051 User Guide

TASKING VX-toolset for 8051 User Guide

TASKING VX-toolset for 8051 User Guide

SHOW MORE
SHOW LESS
  • No tags were found...

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

<strong>TASKING</strong> <strong>VX</strong>-<strong>toolset</strong> <strong>for</strong> <strong>8051</strong> <strong>User</strong> <strong>Guide</strong>C Typeunsigned intSize16Align8Limits[0, 2 16 -1]enum * 18161880 or 1[-2 7 , 2 7 -1] or [0, 2 8 -1][-2 15 , 2 15 -1] or [0, 2 16 -1]long32 8 [-2 31 , 2 31 -1]unsigned long328[0, 2 32 -1]long long ** 32 8 [-2 31 , 2 31 -1]unsigned long long **32 8 [0, 2 32 -1]float (23-bit mantissa)double **long doublepointer to __sfr, __bsfr, __data,__bdata, __idata, __pdata or __bitpointer to function, __xdata or __rom32328168888[–3.402E+38, –1.175E-38][+1.175E-38, +3.402E+38][–3.402E+38, –1.175E-38][+1.175E-38, +3.402E+38][0, 2 8 -1][0, 2 16 -1]* When you use the enum type, the compiler will use the smallest sufficient type (__bit, char,unsigned char or int), unless you use C compiler option --integer-enumeration (always use16-bit integers <strong>for</strong> enumeration).** The long long types are treated as long. The double and long double types are alwaystreated as float.Bit Data TypeYou can use the __bit type to define scalars in the bit-addressable area and <strong>for</strong> the return type offunctions. A struct containing bit-fields cannot be used <strong>for</strong> this purpose, <strong>for</strong> example because the structis aligned at a byte boundary. Unlike the _Bool type the __bit type is aligned on a bit boundary.The following rules apply to __bit type variables:• A __bit type variable is always unsigned.• A __bit type variable can be exchanged with all other type-variables. The compiler generates thecorrect conversion.A __bit type variable is like a boolean. There<strong>for</strong>e, if you convert an int type variable to a __bit typevariable, it becomes 1 (true) if the integer is not equal to 0, and 0 (false) if the integer is 0. The nexttwo C source lines have the same effect:bit_variable = int_variable;bit_variable = int_variable ? 1 : 0;2

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!