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 have written a complex program (CAN higher layer protocol driver ),which has many "for" loops and lots of calls.But after ceratin number of calls the stack reaches 37 :1F and then on the program hangs ..I tried defining as much of global variables ,passing less parameters , overlaying etc .. but when theres a "for" loop of just @4 or 5 iterations , the stack problem comes .. what are the possible options to avoid this from happening ? regards sameer
"access only the XDATA .. through ptrs" Are you sure that they're accessing XDATA? - use the debugger to verify that the pointers really are pointing to XDATA. With C51, your pointers need to specify not only the correct address, but also the correct memory space (CODE, DATA, IDATA, PDATA, XDATA). Therefore, if you have a bad pointer it could be pointing to the wrong address, or the wrong memory space, or both!!
Using the simulator, you can check that the stack pointer has the same value before and after each call. If it is not, then the call is at fault and needs to be sorted out.