4.6.10 Memory Models

Next: 4.6.11 Stack Up: 4.6 The PIC16 port Previous: 4.6.9 Adding New Devices Contents Index

## 4.6.10 Memory Models

The following memory models are supported by the PIC16 port:

- small model
- large model

Memory model affects the default size of pointers within the source. The sizes are shown in the next table:

Pointer sizes according to memory model | small model | large model
code pointers | 16-bits | 24-bits
data pointers | 16-bits | 16-bits

It is advisable that all sources within a project are compiled with the same memory model. If one wants to override the default memory model, this can be done by declaring a pointer as far or near. Far selects large memory model's pointers, while near selects small memory model's pointers.

The standard device libraries (see 4.6.7) contain no reference to pointers, so they can be used with both memory models.