SW500009 Microchip Technology, SW500009 Datasheet - Page 83

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
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.11.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.
if it was defined elsewhere. If it is a local symbol, then it may be used immediately.
3.11.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.11.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 symbol
C identifiers are assigned different symbols in the output assembly code so that an assembly
#include <htc.h>
void main(void)
{
PORTA = 0x55;
asm("movlw #0xAA");
asm("movwf _PORTA);
Mixing C and Assembler Code
69

Related parts for SW500009