Code:
#include<pic.h>
void main()
{
int a[60];// array size
TRISB=0X00;
PORTB=0X00;
}
in my program i want two arrays of size [100]. is it possible?
Unfortunately, Not utilizing the PIC16F877A. Unless the arrays are Constant, which would be stored in FLASH Program Memory rather than SRAM.
As I mentioned before, the PIC16F877A only has 368 bytes of SRAM, divided into four separate banks as shown below highlighted in RED:
Reference: PIC16F87XA Datasheet, Section: 2.2 Data Memory Organization, Page: 16
2.2 Data Memory Organization
The data memory is partitioned into multiple banks
which contain the General Purpose Registers and the
Special Function Registers. Bits RP1 (Status<6>) and
RP0 (Status<5>) are the bank select bits.
Each bank extends up to 7Fh (128 bytes). The lower
locations of each bank are reserved for the Special
Function Registers. Above the Special Function Registers
are General Purpose Registers, implemented as
static RAM. All implemented banks contain Special
Function Registers. Some frequently used Special
Function Registers from one bank may be mirrored in
another bank for code reduction and quicker access.
The largest single available block of SRAM is only 96 bytes located in bank 0, which is why an array of integers, consisting of 45 elements, requiring 90 bytes of storage is possible, however an array of 60 elements requiring 120 bytes of storage is NOT possible.
You would need to upgrade to another PIC, possibly the PIC18F family to accommodate arrays requiring 200 bytes of storage each or more.
Also when coding for the Hi-Tech series of compilers, use the following:
Rather than:
BigDog