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_btg<br />

Built-in Functions<br />

Description: This function will generate a btg machine instruction.<br />

Some examples include:<br />

int i; /* near by default */<br />

int l __attribute__((far));<br />

struct foo {<br />

int bit1:1;<br />

} barbits;<br />

int bar;<br />

void some_bittoggles() {<br />

register int j asm("w9");<br />

int k;<br />

}<br />

k = i;<br />

__builtin_btg(&i,1);<br />

__builtin_btg(&j,3);<br />

__builtin_btg(&k,4);<br />

__builtin_btg(&l,11);<br />

return j+k;<br />

Prototype:<br />

Note that taking the address of a variable in a register will produce<br />

warning by the compiler <strong>and</strong> cause the register to be saved onto the<br />

stack (so that its address may be taken); this <strong>for</strong>m is not recommended.<br />

This caution only applies to variables explicitly placed in registers by<br />

the programmer.<br />

void __builtin_btg(unsigned int *, unsigned int<br />

0xn);<br />

Argument: * A pointer to the data item <strong>for</strong> which a bit should be toggled.<br />

0xn A literal value in the range of 0 to 15.<br />

Return Value: Returns a btg machine instruction.<br />

Assembler Operator<br />

/ Machine<br />

Instruction:<br />

btg<br />

Error Messages An error message will be displayed if the parameter values are not<br />

within range<br />

__builtin_clr<br />

Description: Clear the specified accumulator. For example:<br />

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

result = __builtin_clr();<br />

will generate:<br />

clr A<br />

Prototype: int __builtin_clr(void);<br />

Argument: None<br />

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

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

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

Saved successfully!

Ooh no, something went wrong!