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

error message "clock is not working"

Hi,

I am trying to use large memory model" with AT89C51RD2. I have written a simple UART code and trying to debug the code with the simulator. Once, the code enter into the ISR the following error message comes up "Clock is not working"

And when using small memory model the error didn't pop up.
Could anyone pleas let me know what is the reason behind this error message when using the large memory model.

Parents Reply Children
  • Using large memory model with AT89C51RD2 works well. But the issue occurs when I include MODDP2 along with large memory model.

    When I am trying to include MODDP2 along with large memory model the above mentioned issue occurs. The issue occurs only when I add the following line in the code.

    #pragma moddp2
    

    Hence, I suspect that there is some issues in using MODDP2. Please help me to find the issue.

  • Using large memory model with AT89C51RD2 works well.
    If you consider a considerable waste of code space and CPU cycles "working well", maybe.

    Oh, and the actual cause of your problem is precisely that #pragma moddp2. That's the wrong switch for the CPU you're working with. For this one it should be "modp2" (only one 'd'). And generally you shouldn't put that option into the source anyway, but rather set the global switch in the project settings' "Target" page: "Use multiple DPTR registers", instead.

    The reason this failed so interestingly is that enabling the wrong switch along with large model caused the compiler to generate extended interrupt entry code for that other CPU, which needs preconditions that your code, being for a different processor, doesn't establish.

  • Thank you very for pointing the mistake and detailed explanation.

    This solution fixed the issue