Diminishing stack
Posted: 25 May 2010, 14:29 PM
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
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