PDA

View Full Version : bytes reservation (numbers of elements)



mat janssen
- 21st September 2006, 21:55
I use a PIC16F676 which has 368 bytes of ram.
I want to reserve 255 bytes of ram places for one name;
BUFFERS VAR BYTE [255]
Now i get an error while compiling the program.
The book says Max numbers of elements 96* and *= Processor dependant.
Why do I get an error still ??

keithdoxey
- 21st September 2006, 22:24
The book also says

"Arrays must fit entirely within one RAM bank on most PICmicros. They may not span RAM banks on 14-bit or 17Cxxx devices. (Arrays may span banks on 18Cxxx devices. Byte- and word-sized arrays are only limited in length by the amount of memory.) The compiler will assure that arrays will fit in memory before successfully compiling."

I am not familiar with the PIC 16F676 so decided to look up the datasheet
http://ww1.microchip.com/downloads/en/DeviceDoc/40039c.pdf

At the bottom of page three it says "SRAM 64 bytes EEPROM 128 bytes"

Have you quoted the correct processor number ?

I was unable to create a large array on a 16F processor despite having enough memory but on an 18F it worked just fine :)

SteveB
- 21st September 2006, 22:25
I use a PIC16F676 which has 368 bytes of ram.

Not sure where you got 368 from, but the datasheet and Microchip's web site list it as 64 bytes of ram.

Steve B

keithdoxey
- 21st September 2006, 22:32
Have you quoted the correct processor number ?

Hmmm, on a hunch I looked at the 16F767 which does have 368 bytes of RAM
http://ww1.microchip.com/downloads/en/DeviceDoc/30498c.pdf

Page 18 however reveals this is 96 bytes in each of Banks 0,2,3 and 80 bytes in Bank 1 so 96 bytes would be the maximum and you would probably have to specify a bank to ensure it fitted.

mat janssen
- 22nd September 2006, 07:04
It was an typing error I use the 16F876 and it has also 368 bytes of ram.
But I understand that I cross the bank.
Thanks, I know now what I must to do.