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
Ah, the old Uninitialised Pointer fault. This causes plenty of grief with standard 'C', but C51 adds the complication of the different memory spaces: The 1st byte of a C51 Generic Pointer specifies the memory space. For an uninitialised pointer, this is likely to be zero - which points into IDATA/DATA/BDATA, so you can soon be pointing into the stack! BTW: Unless you really need a Generic Pointers, a Memory-Specific Pointer would be more efficient. See the C51 manual