SW500010 Microchip Technology, SW500010 Datasheet - Page 103

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
C Language Features
When using in-line assembler code, great care must be taken to avoid interacting with compiler-
generated code. The code generator cannot scan the assembler code for register usage and so will
remain unaware if registers are clobbered or used by the code. If in doubt, compile your program
with the PICC -S option and examine the assembler code generated by the compiler.
3.10.3 Accessing C objects from within Assembly Code
The following applies regardless of whether the assembly is part of a separate assembly module, or
in-line with C code.
symbol if it was defined elsewhere. If it is a local symbol, then it may be used immediately.
3.10.3.1 Equivalent Assembly Symbols
The assembler equivalent identifier to an identifier in C code follows a form that is dependent on
the scope and type of the C identifier. The different forms are discussed below. Accessing the C
identifier in C code and its assembly equivalent in assembly code implies accessing the same object.
Here, “global” implies defined outside a function; “local” defined within a function.
identifier cannot conflict with an identifier defined in C code. If assembly programmers choose
identifier names that do not begin with an underscore, these identifiers will never conflict with C
identifiers. Importantly, this implies that the assembly identifier, i, and the C identifier i relate to
different objects at different memory locations.
3.10.3.2 Accessing special function register names from assembler
If writing separate assembly modules, SFR definitions will not automatically be present. If writing
assembler code from within a C module, SFRs may be accessed by referring to the symbols defined
by the chip-specific C header files. Whenever you include <htc.h> into a C module, all the
available SFRs are defined as absolute C variables. As the contents of this file is C code, it cannot
be included into an assembler module, but assembler code can uses these definitions. To use a SFR
in in-line assembler code from within the same C module that includes <htc.h>, simply use the
symbol with an underscore character prepended to the name. For example:
For any non-local assembly symbol, the GLOBAL directive must be used to link in with the
C identifiers are assigned different symbols in the output assembly code so that an assembly
#endasm
}
asm("bcf 0,3");
asm("rlf _var");
asm("rlf _var+1");
// or like this
Mixing C and Assembler Code
103

Related parts for SW500010