SW500010 Microchip Technology, SW500010 Datasheet - Page 102

HI-TECH C PRO FOR PIC10/12/16

SW500010

Manufacturer Part Number
SW500010
Description
HI-TECH C PRO FOR PIC10/12/16
Manufacturer
Microchip Technology
Type
Compilerr
Series
PIC10/12/16r
Datasheets

Specifications of SW500010

Supported Families
PIC10, PIC12, PIC16
Core Architecture
PIC
Software Edition
Professional
Kit Contents
Software And Docs
Mcu Supported Families
PIC10/12/16
Tool Type
Compiler
Lead Free Status / RoHS Status
Not applicable / Not applicable
For Use With/related Products
PIC10, PIC12, PIC14, PIC16, PIC16E
Lead Free Status / Rohs Status
Lead free / RoHS Compliant
Other names
019P
778-1006
778-1006
Mixing C and Assembler Code
ensures that the compiler knows how to encode the function call in terms of parameters and return
values, however no other code is necessary.
when the calling and called routines’ signatures can be compared.
sembler routine, then calls the routine.
void main(void)
{
3.10.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().
which 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.
behaves like a C statement, however each instruction must be encapsulated within an asm() state-
ment.
cases, use only the asm("") form, which is a C statement and will correctly interact with all C
flow-of-control structures.
102
To call an assembly routine from C code, a declaration for the routine must be provided. This
If a signature value is present in the assembly code routine, its value will be checked by the linker
To continue the previous example, here is a code snippet that declares the operation of the as-
extern unsigned int add(unsigned a, unsigned b);
}
The #asm and #endasm directives are used to start and end a block of assembly instructions
The asm() statement is used to embed a single assembler instruction. This form looks and
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:
int a, result;
a = read_port();
result = add(5, a);
unsigned int var;
void main(void)
{
#asm
var = 1;
bcf 0,3
rlf _var
rlf _var+1
// like this...
C Language Features

Related parts for SW500010