Skip to main content
Visitor II
June 13, 2009
Question

How can define Global Variables number more than 256?

  • June 13, 2009
  • 3 replies
  • 907 views
Posted on June 13, 2009 at 06:26

How can define Global Variables number more than 256?

    This topic has been closed for replies.

    3 replies

    wolverAuthor
    Visitor II
    May 17, 2011
    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

    Visitor II
    May 17, 2011
    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.

    wolverAuthor
    Visitor II
    May 17, 2011
    Posted on May 17, 2011 at 15:03

    Hi Jatin

    Thank you! :)

    best Regards

    wolver

    2009-6-13