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

Automatic RESET during operation

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)

Parents Reply Children
  • yeah... i didnt realize that was actually taking extra work all the time, i really didnt require BreakC... ill define a constant for that, it would atleast reduce the number of parameters

    here i got another problem, the code in between the Stars is being bypassed completely,
    i didnt understand it first but then i started inserting dummy routines in between codes and found out that the code (in Bold) is being completely bypassed every time.

    Home_Screen() //Draws the Home Screen
    Keypad_Instance() //Has been already posted in this thread
    Check_Lock1() //Checks if the code entered is correct or not and opens the lock if true

    void Start()
    {
             Lock_State = Closed;
            do
            {
                    Home_Screen();
             while(Keypad_Input() == False);// Wait for a key to be pressed.
    //*******************************************************************************************
          while(Lock_State == Closed)
             {
                            Lock_Screen();
                            Keypad_Instance(5,2,8,0,'C'); // 5 character password at pos 2,8, Hidden and 'C' is the break Character
    
    
                             Check_Lock1();   //Check the Password, if true then Lock_State=Open
                            if(Lock_State == Open)// Lock is Open
                                      break;
                            else
                            {
                                    LCD_Cursor_XY(3,7);
                                    LCD_Text("RETRY !!!");  //on entering Wrong Password
                            }
             }
                    Main_Menu1_Instance();
    //*********************************************************************************************
     }while(1);
    }
    

    i didnt get it, why is this not working,
    Note: i tried implemnting the Code in italics in a do-While loop, but the same problem creeped up,
    this was not a problem when i had those recursive functions LOL ;P!!