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

Create successful ePaper yourself

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

CONTENTSCONTENTS3.6.2 Function Return Values . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 423.6.2.1 Integral Return Values . . . . . . . . . . . . . . . . . . . . . . . . 423.6.2.2 Structure Return Values . . . . . . . . . . . . . . . . . . . . . . . 423.7 Register Usage . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 423.8 Operators . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 423.8.1 Integral Promotion . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 423.8.2 Shifts applied to integral types . . . . . . . . . . . . . . . . . . . . . . . . . 443.8.3 Division and modulus with integral types . . . . . . . . . . . . . . . . . . . 443.9 Psects . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 443.9.1 Compiler-generated Psects . . . . . . . . . . . . . . . . . . . . . . . . . . . 453.10 Interrupt Handling in C . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 463.10.1 Interrupt Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 473.10.1.1 Context Saving on Interrupts . . . . . . . . . . . . . . . . . . . . 493.10.1.2 Context Restoration . . . . . . . . . . . . . . . . . . . . . . . . . 493.10.2 Enabling Interrupts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 493.11 Mixing C and Assembler Code . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 493.11.1 External Assembly Language Functions . . . . . . . . . . . . . . . . . . . . 503.11.2 #asm, #endasm and asm() . . . . . . . . . . . . . . . . . . . . . . . . . . . 523.11.3 Accessing C objects from within Assembly Code . . . . . . . . . . . . . . . 533.11.3.1 Equivalent Assembly Symbols . . . . . . . . . . . . . . . . . . . 533.11.3.2 Accessing specifal function register names from assembler . . . . 533.12 Preprocessing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 543.12.1 Preprocessor Directives . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 543.12.2 Predefined Macros . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 543.12.3 Pragma Directives . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 573.12.3.1 The #pragma inline Directive . . . . . . . . . . . . . . . . . . . . 573.12.3.2 The #pragma jis and nojis Directives . . . . . . . . . . . . . . . . 583.12.3.3 The #pragma pack Directive . . . . . . . . . . . . . . . . . . . . . 583.12.3.4 The #pragma printf_check Directive . . . . . . . . . . . . . . . . 583.12.3.5 The #pragma psect Directive . . . . . . . . . . . . . . . . . . . . 593.12.3.6 The #pragma regsused Directive . . . . . . . . . . . . . . . . . . 603.12.3.7 The #pragma switch Directive . . . . . . . . . . . . . . . . . . . . 613.13 Linking Programs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 613.13.1 Replacing Library Modules . . . . . . . . . . . . . . . . . . . . . . . . . . 623.13.2 Signature Checking . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 623.13.3 Linker-Defined Symbols . . . . . . . . . . . . . . . . . . . . . . . . . . . . 643.14 Standard I/O Functions and Serial I/O . . . . . . . . . . . . . . . . . . . . . . . . . 64vi

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

Saved successfully!

Ooh no, something went wrong!