11.07.2015 Views

PicC 9.50 dsPIC Manual.pdf

PicC 9.50 dsPIC Manual.pdf

PicC 9.50 dsPIC Manual.pdf

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Supported Data Types and VariablesC Language FeaturesTable 3.4: Floating-point formatsFormat Sign biased exponent mantissaIEEE 754 32-bit x xxxx xxxx xxx xxxx xxxx xxxx xxxx xxxxTable 3.5: Floating-point format example IEEE 754Number biased exponent1.mantissadecimal7DA6B69Bh 11111011b 1.01001101011011010011011b 2.77000e+37(251) (1.302447676659)where 23 is the number of bits taken up by the mantissa, to give 0.302447676659. Add one to thisfraction. The floating-point number is then given by:−1 0 ×2 124 ×1.302447676659 = 1×2.126764793256e+37×1.302447676659≈ 2.77000e+37Variables may be declared using the float and double keywords, respectively, to hold valuesof these types. Floating point types are always signed and the unsigned keyword is illegal whenspecifying a floating point type. Types declared as long double will use the same format as typesdeclared as double.3.4.7 Structures and UnionsHI-TECH <strong>dsPIC</strong>C supports struct and union types of any size from one byte upwards. Structuresand unions only differ in the memory offset applied for each member. The members of structuresand unions may not be objects of type bit, but bit-fields are fully supported.Structures and unions may be passed freely as function arguments and return values. Pointers tostructures and unions are fully supported.3.4.7.1 Bit-fields in StructuresHI-TECH <strong>dsPIC</strong>C fully supports bit-fields in structures.Bit-fields are always allocated within 16-bit words. The first bit defined will be the least significantbit of the word in which it will be stored. When a bit-field is declared, it is allocated within thecurrent 16-bit unit if it will fit, otherwise a new word is allocated within the structure. bit-fields cannever cross the boundary between 16-bit allocation units. For example, the declaration:34

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

Saved successfully!

Ooh no, something went wrong!