07.04.2013 Views

MPLAB C Compiler for PIC24 MCUs and dsPIC DSCs ... - Microchip

MPLAB C Compiler for PIC24 MCUs and dsPIC DSCs ... - Microchip

MPLAB C Compiler for PIC24 MCUs and dsPIC DSCs ... - Microchip

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.

__builtin_psvoffset<br />

Built-in Functions<br />

Error Messages The following error message is produced when this function is used<br />

incorrectly:<br />

“Argument to __builtin_psvoffset() is not the address of an<br />

object in code, psv, or eedata section”.<br />

The argument must be an explicit object address.<br />

For example, if obj is object in an executable or read-only section, the<br />

following syntax is valid:<br />

unsigned page = __builtin_psvoffset(&obj);<br />

__builtin_readsfr<br />

Description: Reads the SFR.<br />

Prototype: unsigned int __builtin_readsfr(const void *p);<br />

Argument: p object address<br />

Return Value: Returns the SFR.<br />

Assembler Operator<br />

/ Machine<br />

Instruction:<br />

readsfr<br />

Error Messages The following error message is produced when this function is used<br />

incorrectly:<br />

__builtin_return_address<br />

Description: Returns the return address of the current function, or of one of its callers.<br />

For the level argument, a value of 0 yields the return address of<br />

the current function, a value of 1 yields the return address of the caller<br />

of the current function, <strong>and</strong> so <strong>for</strong>th. When level exceeds the current<br />

stack depth, 0 will be returned. This function should only be used with a<br />

non-zero argument <strong>for</strong> debugging purposes.<br />

Prototype: int __builtin_return_address (const int level);<br />

Argument: level Number of frames to scan up the call stack.<br />

Return Value: Returns the return address of the current function, or of one of its callers.<br />

Assembler Operator<br />

/ Machine<br />

Instruction:<br />

return_address<br />

__builtin_sac<br />

Description: Shifts value by shift (a literal between -8 <strong>and</strong> 7) <strong>and</strong> returns the<br />

value.<br />

For example:<br />

register int value asm("A");<br />

int result;<br />

result = __builtin_sac(value,3);<br />

Might generate:<br />

sac A, #3, w0<br />

Prototype: int __builtin_sac(int value, int shift);<br />

Argument: valueInteger number to be shifted.<br />

shiftLiteral amount to shift.<br />

Return Value: Returns the shifted result to an accumulator.<br />

© 2008 <strong>Microchip</strong> Technology Inc. DS51284G-page 157

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

Saved successfully!

Ooh no, something went wrong!