This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

auto segment too large

i get the error "main() auto segment too large" for the given program which should be run on atmet 89c51 how to fix it
thanks.........

#include <reg51.h>
void Delay();
char serialsend(char []);

void main ()
{ char z;
char command1[]={"AT+CGATT=1\r"};
char command2[]={"AT+CSTT= \"ufone.pinternet\"\r" };
char command3[]={"AT+CIICR\r"};
char command4[]={"AT+CIFSR\r"};
char command5[]={"AT+CIPSTART=\"TCP\"\"121.52.147.94\"800\r"};
char command6[]={"AT+CIPSEND\r"};
char command7[]={"GPRS is Activated"};
char command8[]={"26"};
TMOD = 0x20;
TH1 = 0xFD;
SCON = 0x50;
TR1 = 1;
serialsend(command1);
Delay();
serialsend(command2);
Delay();
serialsend(command3);
for(z=0; z<3; z++)
{ Delay(); }
serialsend(command4);
Delay();
serialsend(command5);
for(z=0; z<10; z++)
{ Delay();
} serialsend(command6);
for(z=0; z<5; z++)
{ Delay(); }
serialsend(command7);
serialsend(command8);

}
char serialsend(char array[])
{ int i=0;
while(array[i] != '\0')
{ SBUF = array[i];
while(TI == 0);
TI = 0;
i++;
} }

void Delay()
{ unsigned char x;
for(x=0; x<40; x++)
{ TMOD=0x10;
TL1=0xFE;
TH1=0xA5;
TR1=1;
while (TF1==0);
TR1=0;
TF1=0;
} }

Parents
  • "i said it is not the right answer"

    So what, exactly, do you mean by "it" here?

    I told you what I meant by "it" - and I stand by that.

    "have you seen and done the question paper?"

    What question paper?

    "you will fail the exam with your answer"

    Then it is a very stupid exam!

    Constant strings like that most certainly should be placed in CODE space - as explained.

    Note that this is the Keil forum; it is for discussing Keil products - not exam tips - and anyone using Keil C51 in practice would certainly be well-advised to put manifest constants like this in CODE space and not in automatic variables, for the reasons stated.

    http://www.keil.com/support/man/docs/c51/c51_le_pgmmem.htm

Reply
  • "i said it is not the right answer"

    So what, exactly, do you mean by "it" here?

    I told you what I meant by "it" - and I stand by that.

    "have you seen and done the question paper?"

    What question paper?

    "you will fail the exam with your answer"

    Then it is a very stupid exam!

    Constant strings like that most certainly should be placed in CODE space - as explained.

    Note that this is the Keil forum; it is for discussing Keil products - not exam tips - and anyone using Keil C51 in practice would certainly be well-advised to put manifest constants like this in CODE space and not in automatic variables, for the reasons stated.

    http://www.keil.com/support/man/docs/c51/c51_le_pgmmem.htm

Children
  • unless there was some specific detail in the rubric and/or question of which we are not aware.

    But, if that were the case, you should be able to explain it...

  • >>>>>>So what, exactly, do you mean by "it" here?

    reading is more than interpreting individual words. fool.

    >>>>>>What question paper?

    read what is said. fool.

    >>>>>>Then it is a very stupid exam!

    more like you are stupid. fool.

    >>>>>>Constant strings like that most certainly should be placed in CODE space - as explained.

    funniest of the lot is hat one. even fools cant agree. your mate said

    >>>>>>Programming don't have "right answers".

    and you say **** most certainly should ****. fool.

    youll blunder your way out again but it is obvious what you are.

  • "unniest of the lot is hat one. even fools cant agree. your mate said

    >>>>>>Programming don't have "right answers"."

    Correct. Programming have better and worse solution. Your solution is the stupid solution, since it requires the availability of XDATA which is a fail in a processor that doesn't have any XDATA. But then, the olympic candidate also claimed that:
    "its got 4k of perom!!!!!!!!!!!!!!!!!!!!"

    And yes - it is in these 4kB of PEROM (that the Atmel datasheet calls it) that the strings will be stored, whatevery you like. Having them first occupy space in the PEROM and then copied to the 128 bytes if internal RAM have already been found a failure by the OP. Having them copied to nonexisting XDATA, as suggested by you, will just be a different kind of failure.

    So yes - I'm pretty sure sending you to represent us in the OS of stupidity would lead to a great victory.