We are running a survey to help us improve the experience for all of our members. If you see the survey appear, please take the time to tell us about your experience if you can.
Hi all,
I am new to using KEIL compiler. I am trying to compile a code and got this error. Can anyone explain what this error statement means? Anything to do with code banking?
Thanks alot!
Do not use function pointers in C51 until you have carefully read the following and fully understood the issues:
sompler and better Do not use function pointers in C51
That something can be done, does not necessarily make it the right approach
Erik
Hi Andy, Erik
Thanks for the articles and advice....
after much reading, I came to a conclusion what causes the problem. Would like to share here and seek your opinion also.
In my code,
unsigned short (*test) (unsigned long A1, unsigned short B1);
From one of the article on "parameters and registers", the first parameter, A1 is passed in registers R4 to R7 while second parameter, B1 is passed in registers R4 & R5. Is this causing the error? Thank you once again.
Go back to the original error message, and read it again literally:
"parameters do not fit into registers"
What is that telling you?
Now look at what you just wrote:
"the first parameter, A1 is passed in registers R4 to R7 while second parameter, B1 is passed in registers R4 & R5."
How many times have you just said that R4 & R5 are being used?
Can this possibly work?
Again, function pointers in C51 need a thorough understanding of the issues - you don't seem to have mastered this yet, so they are probably best avoided for now.
Or, take Erik's approach: Just avoid them. Period.