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; } }
The above posted code at thread: http://www.keil.com/forum/21274/
contains a "valid" public IP address pointing to PERN, Dara, Pakistan and the rest info is showed here: www.iplocationfinder.com/121.52.147.94
When you presenet parts of code for discussion, it is wise to show demo data and not to present real data like the mentioned IP.
If the issues about code segment for strings is fixed and the T1 mis-re-initialization is fixed also, then this piece of code can start working.
thx for all the comments and specially to harash jameel. going large fixed the error but it will not run. i will use a better processor with external memory. i will not want the messages in code becoz they will change later. i ask you a question you did not think. can i change code in running? no. plz concentrate on the problem only. and the ip address is my network!
Well, lucky you if you managed an a++ on your exam, since your answers here indicates that you must have been more than a little bit lucky.
Programming don't have "right answers". Programming have better and worse solutions to problems. If you had a teacher that thought "large" was the "right answer", then that teacher did not manage a grade a++ first time, second time or any time.
Your "right answer" is to use wires to get the exhaust pipe to hang on to the car.
Your "right answer" is to fit additional lights to your car with duct tape.
Any teacher with a slight bit of skill would think it a better answer to have the strings only in the code segment, than to have the strings first copied into individual RAM variables before being used. Especially since RAM is often a very tight resource in embedded processors.
Any student with a slight bit of skill should see the same. And - if needed - point out to that teacher that there are better ways to do things.
And a skilled developer would also recognize that in case the strings needs to be modified before being sent, it would be enough with one (1) single RAM buffer for formatting the next command to send. After that command has been sent, that single buffer will be available for reuse, for formatting the next command, if needed.
Skill, in programming, isn't to learn 10 "absolute truths". Skill, in programming, is to be able to understand problems and analyze the consequences of different alternative solutions. Such analysis would quickly show the advantage of keeping just a single copy of the strings - the copy that the compiler/linker is forced to store in the code, since any data in RAM is lost when the power is removed and have to be recreated somehow. Either by making a copy from code, or by having the code build the strings, character by character by sprintf(), strcpy(), individual character assignments or similar.
Your case will not be stronger because you press and hold your !!!!!!!!!!!!!!!!! button. "large" is still not a good solution to this specific problem, even if it can be used as a rough work-around in case the specific processor used happens to have XDATA space available.
Some day, when you have made your income for a number of years writing software - especially embedded software - you might have a different view on things.
The above code is a trivial piece of code. So trivial that it (if it was correct) could be seen as a little code example created between two phone calls just to display a concept. Real-life code is seldom so trivial. Even small embedded projects may have 10k+ lines of code. And since the complexity grows with the amount of code, it is important that every part of the code is written with care. And using good practices. But good practices needs to be used already from the start. Good practices is to know the disadvantages with "large". And to know the disadvantages with making useless copies of data. And the need to value RAM. And to recognize the difference in access costs between DATA and XDATA and hence manually decide what information to place in cheap or expensive RAM.
So back to you - are you a professional, as you claim? Then your main goal should be a strong want to improve. And a good way to improve is to ask "why" if you see something you don't recognize or understand. Instead of responding back with a rather childish "did you read anything?????"
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...
i got a grade a++ first time!!!!!!!!!!! in typing exclamation points?
and so what, folowing this (and other) forum for years it has become obvious that some "educational institutions" will graduate people that do not know which end of a resistor is up.
Anyhow, whatever the quality of the institution,the graduates are worthless the day they hit the street. NOTHING but real life experience will 'teach' the individual how to do right with a specific problem.
I have interviewed recent graduates and their lack of "real" knowledge is amazing.
Erik
PS. I recall other discussions where some individual threw education against experience and lost.
Well, I actually think some schools - or some specific teachers - can manage quite well to teach not only facts, but to only help people to learn how to search for information, and how to analyze problems and make own deductions.
Alas, it is way harder to teach people good methodology than it is to teach then specific facts. Even harder, when some students prefer to learn hard facts that they can just memorize than to try to pick up the underlying reasons for these facts and see a need for viewing problems with open eyes.
hey mates.
is there an act stupid event in the olympics.
you guys would win the gold for sure.
hahahahahahahahahahahahahahahahahaha!!!!!!!!!!!!!!!!!!!!!!
>>>>>>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.
"you guys would win the gold for sure."
Yes we would. All we need to do is send you to represent us. It would be a walkover victory.
"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.
Only if you don't participate.
Behaviour like yours is usually typical of 5-year-olds. Your behaviour is about as far from the "professional" you claimed yourself to be as it is possible.
The only thing you've succeeded at here so far is to present yourself as a complete and utter imbecile. Good luck at digging your way out of that hole again, ever.
hahaha.
the fools keep appearing. and they still cant agree.
so i said
>>>>>>is there an act stupid event in the olympics.
>>>>>>you guys would win the gold for sure.
and two answers
>>>>>>All we need to do is send you to represent us.
and
>>>>>>Only if you don't participate.
priceless!!!!!!!!!!!!!!!!!!
So logic isn't your strong point - we made the same conclusion but expressed differently.
I think this is the best argument for NOT using 'large' I have seen.
>>>>>>we made the same conclusion but expressed differently.
what??????? you say i must be there and youd win. your friend says i must not be there and youd win.
those two ****** are ****** opposites.
but either way youd win the act stupid event in the olympics!!!!!
sure you and your mate will try to bluff your way out and you and your friend will claim you are all clever and im a fool. your defence just makes you look more like what you are.
hahahahahaha
My note: With you representing us, we, as a group (of let's say the worlds programmers) would win because no one can beat you at "most stupid".
Hans-Bernhard Broeker's note: The only way we (anyone but you) can win, is if we don't need to compete with you. Because no one can beat you at "most stupid".
I must assume that you are a troll. But trolls are normally way more clever.
If you are a troll, then you are a person who intentionally try to fool other people into selecting a very stupid solution.
If you aren't a troll, then god bless your poor parents.
you say i must be there and youd win.
Actually, no, that's not what Per said. What Per said is that the only way we'd be stupider than the competition was if we let you compete for our team --- not against us.
Let me remind of your own advice from earlier in this thread, regarding that there's more to understanding than reading individual words. It might have served you well to heed your own advice just this once. But of course you didn't.
>>>>>Actually, no, that's not what Per said. What Per said is that the only way we'd be stupider than the competition was if we let you compete for our team --- not against us.
are you for real??????
we agree on something. and now go back and see what you said. clue for you,,,,,,, read **** all **** of it,,,,,, carefully,,,,, you know,,,,, more than individual words!!!!!!!!!!
i **** knew **** youd try to bluff out of it.
im bored with trying to teach stones to cook chicken. i will way no more except,,,,,,
priceless.
of course i meant to say
im bored with trying to teach stones to cook chicken. i will say no more except,,,,,,
we agree on something.
No, we don't. And if you honestly thought we did, then your understanding of English, logic or both must be even worse than we already suspected --- which would be quite some achievement.
i will way no more
That's the first good idea you've had in days. If only I could believe you would actually do that.
>>>>>>No, we don't.
you let off again!!!!!!!!!!!!!!!!!! you cant stop your self can you!!!!!!!!!!!!!!!!!!
so if you say something and i say i agree then you think we dont agree.
well matey,,,,,, your understanding of english, logic or both is definitely different to mine.
funny how you choose to say what you did and did not choose to comment upon and may be even correct the contradiction with what you and your mate wrote,,,, oh,,,,, you cant,,,, because youd have to admit you got something very wrong,,,,,,,,, my dear old english speaking chum.
the very end from me in this thread. enjoy your life of denial.
Since what you agreed to is different from what I said: yes, of course I told you you're wrong. I won't let you, of all people, be the judge of the meaning of my words.
may be even correct the contradiction with what you and your mate wrote
Given there is no such contradiction, there is nothing to correct.
,,,, oh,,,,, you cant,,,, because youd have to admit you got something very wrong
Again, no, nothing to correct.
Actually, you've made quite a show out of proving both Per and me right with every new outburst of yours. Yes, you would win that Olympic competition way ahead of anyone else who participated in this thread --- although there are some other self-proclaimed professional geniuses around here who might give you a run for you money. So the only way "we" could possibly win that medal is if you were on our team, or if you didn't participate.
the very end from me in this thread.
You promised that before. And failed to follow your own advice --- again.
Here's to hoping that you abide by your promise this time.
>>>>>>I won't let you, of all people, be the judge of the meaning of my words.
so what you really say is that what you mean can be different to what you write. is the english for this referred to as some thing like bull excrement????????
nice confession chum.,
so what you really say is that what you mean can be different to what you write.
No. What I'm really saying is that you've demonstrated that you're incapable (or maybe just offensively unwilling) of making the step from what people write to what people mean.
If you look back over this thread, you'll find that basically every single time you gave us your interpretation of somebody else's words, you've been told you got it wrong. It's about time you learned something from that experience.
nice confession
No.
The only confession here is an implicit one by you: you've outed yourself to be a liar. You've promised twice now that you would stop writing here (not counting one pointless repetition), and broken that promise both times, so you've been lying to us. Well, either that or you don't even understand your own writing.
>>>>>>What I'm really saying is that you've demonstrated that you're incapable (or maybe just offensively unwilling) of making the step from what people write to what people mean.
coming from you and the irrational reasoning that is a real compliment. thank you matey.
and finally i did not lie....... i see your messages before...... you like to pressure for arguments??????????? you pressured here and i succumbed. so blame yourself..... oh no,,,, you are incapable.......
coming from you and the irrational reasoning
Your belief that you would recognize irrational reasoning is incorrect. The flaw in your deduction of this belief is the implied assumption that your own way of reasoning were rational. Too bad it's not.
and finally i did not lie..
So you make promises you don't intend to keep, and that's not a lie? Not even when you do it again directly after having been made aware of the first violation? Interesting.
i see your messages before.
Before ... what?
you like to pressure for arguments???????????
How is it pressure when I congratulate you on your decision to shut up, both times?
But I'll admit that my hope you would keep those promises really was not very strong. If you want to take that as me having set you a trap, so be it. Even then it sure wasn't a very subtle trap, by any means, so maybe you should not be quite so proud of having fallen for it.
you pressured here and i succumbed.
So, to feed you back your own words, which maybe you'll understand a bit better: you cant stop your self can you!!!!!!!!!!!!!!!!!! So, like I observed before, you're none too good at following your own advice.
That said, I'm done with you. And unlike you, I mean it.
EOD.
irrefutable points: 1) messages whether code, data or xdata WILL be in code. 2) using "large' makes code larger and slower 3) using "large' requires he prescence of "dptr acessible" RAM
View all questions in Keil forum