PDA

View Full Version : PIC16 Max Array Size



MikeWinston
- 25th February 2012, 16:44
PBP Manual says max word array elements for PIC16 device is 48. I receive "unable to fit variable" compilation error if I try to put more than 40.
I would like to keep the pin count of device to 14 so thats why I am not going with a PIC18.

Here is entire program:
Q1 var word[48]
Main:
goto Main
end

Is the manual incorrect?

MPlab v8.83
PBP v3.0.4
device PIC16F1825

b.t.w.
Just purchased PBP3. So far I like the improvements. Good to know this development tool is moving forward.

Mike -

ScaleRobotics
- 25th February 2012, 17:17
The manual is right. But, you have to read the fine print :)

Under the asterisk, it says that for PIC16 devices, the array must fit in one RAM bank. If you look at the data sheet for the PIC16F1825 it talks about each bank. Although it has 128 bytes in each bank, only 80 of those are for General Purpose RAM. I believe that is why the largest array you can have on this chip, is an array of 40 words.

3.2 Data Memory Organization
The data memory is partitioned in 32 memory banks
with 128 bytes in a bank. Each bank consists of
(Figure 3-2):
• 12 core registers
• 20 Special Function Registers (SFR)
• Up to 80 bytes of General Purpose RAM (GPR)
• 16 bytes of common RAM

MikeWinston
- 25th February 2012, 17:30
Ahh I see your right. My mistake. I should have not assumed 128 bytes. Sorry about that.
Thanks ScaleRobotics.