SW500008 Microchip Technology, SW500008 Datasheet - Page 68

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
Storage Class and Object Placement
The const, volatile, far and persistent modifiers may also be applied to pointers in the above
manner.
keywords is allowed with PICC-18 pointer definitions in the manner described above. These key-
words have no effect and do not alter the way in which indirect accesses are made. The use of these
keywords with pointers defined in PICC does affect the operation of pointer dereferences - see your
PICC manual for more details.
3.5 Storage Class and Object Placement
Objects are positioned in different memory areas dependant on their storage class and declaration.
This is discussed in the following sections.
3.5.1 Local Variables
A local variable is one which only has scope within the block in which it was defined. That is, it may
only be referenced within that block. C supports two classes of local variables in functions: auto
variables which are normally allocated in the function’s auto-variable block, and static variables
which are always given a fixed memory location and have permanent duration.
54
To allow portability between PICC and PICC-18 code, the use of the bank1, bank2 and bank3
The first example is a pointer called nip. It contains the address of an int object that is
qualified near. Since a near object is in the access bank the pointer is only 8 bits wide
as discussed above. The pointer itself (i.e. the 8-bit value the pointer holds) will reside
somewhere in the main banked memory.
The second example is a pointer called inp which contains the address of an int object.
Since this object is not qualified near, the pointer needs 16 bits to access the object’s
location. The near keyword after the * indicates that the pointer itself has been qualified
near and so the pointer (i.e. the 16-bit value the pointer holds) will reside in the access
bank, but the object whose address the pointer holds is located in the main banked
memory.
The last example is of a pointer called ninp which is itself qualified near and which
also holds the address of an object that is also qualified near. In this example, both the
pointer and the object that the pointer references will be located in the access bank. The
pointer will be 8 bits wide.
The rule is as follows: if the modifier is to the left of the * in the pointer declaration, it
applies to the object which the pointer addresses. If the modifier is to the right of the *,
it applies to the pointer variable itself.
C Language Features

Related parts for SW500008