i am facing a wierd problem.. My MCU P89V51RD2BN resets during Execution... i am a college student and a beginner Here so i dont know the Advanced Programming methods i would also inform that..
i have a recursive function , a warning is issued by the compiler for the same. but....
earlier this was not a problem but since i have modified some of the Sub-Routines for 16Bit Data this Problem has come up, i need those functions to be 16 bit because of the limitation of the ALU i was earlier using 8bit and leaving most of the Task to Assumption which i cannot do so now..
i would also state that the Problem occurs in a fumction at a point when i call 2 functions in the same code, these themselves call around 5 sub-routines each but that wasnt a problem earlier (before i used the 16bit return type sub-routines).
now i found something in the manual stating reentrant Functions, but i really dont know how to use it
i used it like this
void Home_Screen_Instance() reentrant { ------------ } Do i need to use the keyword "reentrant" in the Function Decleration too? but that didnt help either but the compilers shows an error Home_Screen_Instance : redefinition. Target Not Created
this was the first of a kind problem that i encountered, my MCU is resetting itself for sure(i checked that with a dummy subroutine of blinking LED) and it is not because of the watchdog timer, i am sure about that too..
so whats the Problem here?
is the Stack overflowing??? or there is any other reason behind this? should i revert back to the 8bit versions of my subroutine (without any other choice)? is it because of the recursive nature of the function H0me_screen_instance?
Related Data:
The Program is Display intensive, i mean there are a lot of Strings to be displayed and they are stored beforehand in XDATA, message shown during sucessfull compilation, (still resets) Program Size: data 9.4 xdata 252 code 9514 creating hex-----blah blah blah---- 0 Error(s) 65 Warning(s)
thank you for your time erik!
i found out during the development that 8051 was not a good choice while performing 16bit operations and other Processor Heavy operation... However its simplicity made it the first choice for me..also its the first microcontroller ive tried...
and as far as the Problem goes it has been rectified...
Turns out it was one of the most common mistkes of all "a typo" i had changed the function name in the definition but not in the decleration, i corrected it and it worked but it still shows the warning about the recursive functions and all... and i still cant use the Reentrant Keyword
anyways what would you suggest me for the next MCU platform after 8051 AVR,MSP430,PIC,Freescale HSC012,STM32 or ARM. im just a student so would prefer easy availability of tutorilas and support forums etc, along with cheap development boards
WHY do you need reentrant/recursive functions neither are a good match for the '51 technology.
Erik
View all questions in Keil forum