Don
I have some code (a task) that read GPS data at 57600 on a zx24p using com2. Its configured to send 4 RMC records a second at the moment. The first part of the code waits for a satellite lock before carrying on.
The block of code that reads the data loops round if there is no lock. I am getting a program hang after a period of a few secs. If i double the stack size the code runs for longer. At the moment I have a 1000 byte stack which allows the code to run long enough to get a lock but clearly there is something amiss.
Strangely once a lock is acheived the same block of code works fine. By inserting debug.print system.taskheadroom, i can see in 'no lock mode' the usable stack is decreasing by 2 bytes every loop.
The code is pretty straight forward, the only 'naughty' is a goto that jumps out of the middle of a select case block when waiting for a lock. What do you think is causing my issue ? What sort of coding causes this ?
thanks
Diminishing stack
Re: Diminishing stack
It is important to note that System.TaskHeadRoom does not tell you the amount of stack space that is left at any point in time. Rather, it indicates the most stack space that was used up to the point when the headroom value was taken.FFMan wrote:Strangely once a lock is acheived the same block of code works fine. By inserting debug.print system.taskheadroom, i can see in 'no lock mode' the usable stack is decreasing by 2 bytes every loop.
It could be related to the way that you coded the routines but it could also be an issue with the code generated by the compiler. There is really no way to determine the cause without seeing the code. If you'd rather not post it here, zip up all of the source files and the project file and email it to me.FFMan wrote:What sort of coding causes this ?
- Don Kinzer