SW500008 Microchip Technology, SW500008 Datasheet - Page 69

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.5.1.1 Auto Variables
Auto (short for automatic) variables are the default type of local variable. Unless explicitly declared
to be static, a local variable will be made auto however the auto keyword may be used if desired.
Auto variables are allocated in the auto-variable block and referenced by indexing from the symbol
that represents that block. The variables will not necessarily be allocated in the order declared - in
contrast to parameters which are always in lexical order. Note that most type qualifiers cannot be
used with auto variables, since there is no control over the storage location. The exceptions are
const and volatile.
share the same bank of memory for auto objects. The size of a function’s auto-variable block may
not exceed the size of one bank, which is 100H bytes.
tions are never called at the same time.
with a_function plus some offset, where function is the name of the function in which the object
is defined. For example, if the int object test is the first object placed in main()’s auto-variable
block it will be accessed using the addresses ?a_main and ?a_main+1 since an int is two bytes
long.
auto objects with banked instructions, the compiler will ensure that the bank of the auto-variable
block is selected using a movlb instruction, and then access the locations using the appropriate
instructions. In essence this amounts to an 8 bit access within the selected bank.
3.5.1.2 Static Variables
Uninitialized static variables are allocated in one of the bss, rbss or bigbss psects. Objects
qualified near appear in the rbss psect; objects larger than one bank in size or byte sized objects
are placed in the bigbss psect and the remainder in the bss psect. They will occupy fixed memory
locations which will not be overlapped by storage for other functions. Static variables are local in
scope to the function in which they are declared, but may be accessed by other functions via pointers
since they have permanent duration. Static variables are guaranteed to retain their value between
calls to a function, unless explicitly modified via a pointer. Static variables are not subject to any
architectural limitations on the PIC18.
Thus, they may be preferable over initialised auto objects which are assigned a value every time the
block in which the definition is placed is executed.
All auto variables are allocated memory within one bank of RAM. At present, all functions
The auto-variable blocks for a number of functions are overlapped by the linker if those func-
Auto objects are referenced with a symbol that consists of a question mark, “?”, concatenated
Auto variables may be accessed using the banked instructions of the PIC18. When accessing
Static variables which are initialised are only done so once during the program’s execution.
Storage Class and Object Placement
55

Related parts for SW500008