SW500008 Microchip Technology, SW500008 Datasheet - Page 83

PICC-18 STD

SW500008

Manufacturer Part Number
SW500008
Description
PICC-18 STD
Manufacturer
Microchip Technology
Type
Compilerr
Series
PIC18r
Datasheets

Specifications of SW500008

Supported Families
PIC18
Core Architecture
PIC
Software Edition
Standard
Kit Contents
Software And Docs
Mcu Supported Families
PIC18
Tool Function
Compiler
Tool Type
Compiler
Lead Free Status / RoHS Status
Not applicable / RoHS Compliant
For Use With/related Products
PIC18 Series
Lead Free Status / Rohs Status
Lead free / RoHS Compliant
Other names
015
778-1001
778-1001
C Language Features
3.11 Mixing C and Assembler Code
Assembly language code can be mixed with C code using three different techniques.
3.11.1 External Assembly Language Functions
Entire functions may be coded in assembly language as separate .as source files, assembled by the
assembler (ASPIC18) and combined into the binary image using the linker. This technique allows
arguments and return values to be passed between C and assembler code.
that is callable from C code.
A mapping is performed on the names of all C functions and non-static global variables. See
3.11.2
The following are guidelines that must be adhered to when writing a routine in assembly code
}
select, or define, a suitable psect for the executable assembly code
select a name (label) for the routine so that its corresponding C identifier is valid
ensure that the routine’s label is globally accessable from other modules
select an appropriate equivalent C prototype for the routine on which argument passing can be
modelled
ensure any symbol used to hold arguments to the routine is globally accessable
ensure any symbol used to hold a return value is globally accessable
optionally, use a signature value to enable type checking when the function is called
write the routine ensuring arguments are read from the correct location, the return value is
loaded to the correct storage location before returning
ensure any local variables required by the routine have space reserved by the appropriate
directive
for a description of mappings between C and assembly identifiers.
}
PORTB;
RBIF = 0; // clear event flag
// process interrupt here
// Read PORTB to clear any mismatch
Mixing C and Assembler Code
69

Related parts for SW500008