cancel
Showing results for 
Search instead for 
Did you mean: 

How can define Global Variables number more than 256?

wolver
Associate II
Posted on June 13, 2009 at 06:26

How can define Global Variables number more than 256?

3 REPLIES 3
wolver
Associate II
Posted on May 17, 2011 at 15:03

Hi

I can not compilier programm as follows:

unsigned char buf1[200];

unsigned char buf2[200];

int main(void)

{

unsigned char i;

for (i = 0; i < 200; i++)

{

buf1[i] = buf2[i];

}

while (1);

}

#error clnk Release\test.lkf:1 segment .ubsct size overflow (150)

How can I do?

Best Regards

wolver

2006-6-13

jatin
Associate II
Posted on May 17, 2011 at 15:03

Hi Wolver,

You have to declare as follows:

unsigned char buf1[200];

@near unsigned char buf2[200];

In short memory model by default, the variables are placed in the zero page area (0x00 - 0xff). But in your case, there are 400 variables. So there is an overflow for the variables which are not fitting in the zero page. So you have to use @near identifier to declare some variables in the RAM area starting from 0x100.

wolver
Associate II
Posted on May 17, 2011 at 15:03

Hi Jatin

Thank you! 🙂

best Regards

wolver

2009-6-13