Syntax:
ProgramRead (location, store) or for the 18FxxQ41 family of chips use: PFMRead (location, store)
Command Availability:
Available on all Microchip PIC microcontrollers with self write capability. Not available on Atmel AVR at present.
Explanation:
ProgramRead reads information from the program memory on chips that
support this feature. location and store are both word variables,
meaning that they can store values over 255.
The largest value possible for location depends on the amount of
program memory on the Microchip PIC microcontroller, which is given on the datasheet. store range is explained in the next section.
_Maximum Stored Value_
The maximum value that can be stored in a single program memory word location across the PIC families you asked about (PIC10, PIC12, PIC14, PIC16, PIC18), formatted as clean markdown:
|
Family |
Instruction Word Size |
Program Memory Word Width |
Maximum Value per Word (unsigned decimal) |
Hex Range |
Can store full 16-bit value (0–65535) in one word? |
|
PIC10 |
12-bit |
12 bits |
4095 |
0x000 – 0xFFF |
No |
|
PIC12 (baseline) |
12-bit |
12 bits |
4095 |
0x000 – 0xFFF |
No |
|
PIC12 (enhanced mid-range) |
14-bit |
14 bits |
16383 |
0x0000 – 0x3FFF |
No |
|
PIC14 |
14-bit |
14 bits |
16383 |
0x0000 – 0x3FFF |
No |
|
PIC16 (mid-range) |
14-bit |
14 bits |
16383 |
0x0000 – 0x3FFF |
No |
|
PIC16 (enhanced mid-range) |
14-bit |
14 bits |
16383 |
0x0000 – 0x3FFF |
No |
|
PIC18 |
16-bit |
16 bits |
65535 |
0x0000 – 0xFFFF |
Yes |
Quick Summary Table (most common cases)
|
Family group |
Typical word size |
Max value you can store in one program memory word |
Equivalent to storing a full 16-bit number? |
|
PIC10 / baseline PIC12 |
12 bits |
4095 (0xFFF) |
No |
|
PIC14 / PIC16 / enhanced PIC12 |
14 bits |
16383 (0x3FFF) |
No |
|
PIC18 |
16 bits |
65535 (0xFFFF) |
Yes |
Important Notes
- PIC18 is the only 8-bit PIC family where you can directly store any 16-bit value (0–0xFFFF) in a single program memory word location.
- On all earlier families (PIC10, PIC12 baseline, PIC14, PIC16, enhanced mid-range), you must split any value > 0x3FFF (16383) across two words if you need the full 16-bit range.
- The values above apply when storing constants, lookup table entries,
retlwliterals,data/dbdirectives, etc. — i.e., the largest number that fits in one program memory word.
This is an advanced command which should only be used by advanced developers.
For more help, see ProgramErase and ProgramWrite

