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.

C Language FeaturesSupported Data Types and Variablesstruct {unsigned lo : 1;unsigned dummy : 14;unsigned hi : 1;} foo;will produce a structure occupying 2 bytes. If foo was ultimately linked at address 10H, the field lowill be bit 0 of address 10H, hi will be bit 7 of address 11H. The least significant bit of dummy willbe bit 1 of address 10H and the most significant bit of dummy will be bit 6 of address 11h.Unnamed bit-fields may be declared to pad out unused space between active bits in controlregisters. For example, if dummy is never used the structure above could have been declared as:struct {unsigned lo : 1;unsigned : 14;unsigned hi : 1;} foo;If a bit-field is declared in a structure that is assigned an absolute address, no storage will be allocatedfor the structure. Absolute structures would be used when mapping a structure over a register to allowa portable method of accessing individual bits within the register.A structure with bit-fields may be initialised by supplying a comma-separated list of initial valuesfor each field. For example:struct {unsigned lo : 1;unsigned mid : 14;unsigned hi : 1;} foo = {1, 8, 0};3.4.7.2 Structure and Union QualifiersHI-TECH C supports the use of type qualifiers on structures. When a qualifier is applied to a structure,all of its members will inherit this qualification. In the following example the structure isqualified const.const struct {int number;int *ptr;} record = { 0x55, &i};35

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

Saved successfully!

Ooh no, something went wrong!