SW500009 Microchip Technology, SW500009 Datasheet - Page 82

HI-TECH FOR DSPIC/PIC24

SW500009

Manufacturer Part Number
SW500009
Description
HI-TECH FOR DSPIC/PIC24
Manufacturer
Microchip Technology
Type
Compilerr
Series
PIC24 & DsPICr
Datasheet

Specifications of SW500009

Supported Families
PIC24
Core Architecture
PIC, DsPIC
Software Edition
Standard
Kit Contents
Software And Docs
Tool Type
Compiler
Mcu Supported Families
PIC24 MCUs And DsPIC DSCs
Lead Free Status / RoHS Status
Not applicable / RoHS Compliant
For Use With/related Products
DSPIC3X/PIC24
Lead Free Status / Rohs Status
Lead free / RoHS Compliant
Other names
025
778-1003
778-1003
Mixing C and Assembler Code
3.11.2 #asm, #endasm and asm()
PIC instructions may also be directly embedded “in-line” into C code using the directives #asm,
#endasm or the statement asm().
are to be embedded into the assembly output of the code generator. The #asm and #endasm construct
is not syntactically part of the C program, and thus it does not obey normal C flow-of-control rules,
however you can easily include multiple instructions with this form of in-line assembly.
haves like a C statement, however each instruction must be encapsulated within an asm() statement.
cases, use only the asm("") form, which is a C statement and will correctly interact with all C
flow-of-control structures.
68
extern unsigned int add(unsigned a, unsigned b);
void main(void)
{
}
The #asm and #endasm directives are used to start and end a block of assembly instructions which
The asm() statement is used to embed a single assembler instruction. This form looks and be-
You should not use a #asm block within any C constructs such as if, while, do etc. In these
The following example shows both methods used:
unsigned int var;
void main(void)
{
#asm
#endasm
}
int a, result;
a = read_port();
result = add(5, a);
var = 1;
// like this...
bcf 0,3
rlf _var
rlf _var+1
// or like this
asm("bcf 0,3");
asm("rlf _var");
asm("rlf _var+1");
C Language Features

Related parts for SW500009