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

Create successful ePaper yourself

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

16-Bit C <strong>Compiler</strong> User’s Guide<br />

__builtin_sac<br />

Assembler Operator<br />

/ Machine<br />

Instruction:<br />

sac<br />

Error Messages An error message will be displayed if:<br />

• the result is not an accumulator register<br />

• the shift value is not a literal within range<br />

__builtin_sacr<br />

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

which is rounded using the rounding mode determined by the<br />

CORCONbits.RND control bit.<br />

For example:<br />

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

int result;<br />

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

Might generate:<br />

sac.r A, #3, w0<br />

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

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

shiftLiteral amount to shift.<br />

Return Value: Returns the shifted result to CORCON register.<br />

Assembler Opera- sacr<br />

tor / Machine<br />

Instruction:<br />

Error Messages An error message will be displayed if:<br />

• the result is not an accumulator register<br />

• the shift value is not a literal within range<br />

__builtin_sftac<br />

Description: Shifts accumulator by shift. The valid shift range is -16 to 16.<br />

For example:<br />

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

int i;<br />

result = __builtin_sftac(i);<br />

Might generate:<br />

sftac A, w0<br />

Prototype: int __builtin_sftac(int shift);<br />

Argument: shiftLiteral amount to shift.<br />

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

Assembler Opera- sftac<br />

tor / Machine<br />

Instruction:<br />

Error Messages An error message will be displayed if:<br />

• the result is not an accumulator register<br />

• the shift value is not a literal within range<br />

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

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

Saved successfully!

Ooh no, something went wrong!