Multitasking and use of Pow() function

Started by Santhosh Jayarajan March 2, 2009
Group,
I have noticed that when I use the Pow() statement in a task the task locks and the program stops running.
Here are the details:
I have used a Sharp distance sensor and as a part of the sub I use a Pow() statement to get the actual distance.This sub I use as a task to be scanned every 10 msec.
When the Pow () or ^ statement is executed the program locks and the microcontroller has to be reset.When this statement is removed everything is fine.
Anyone with the same problem?Any Solutions?

Santhosh Jayarajan



> ... scanned every 10 msec.

Assign enough stack for the task? Does it run if you slow that rate down?
Tom
Group,
I used a 30 byte stack.Slowing down did not help.This problem is not seen when I use /,*,+,-.Only seen when Pow() or ^ is used.
Is 30 byte stack adequate?Other task(there are 5) do not have any such problems.

Santhosh Jayarajan

--- On Mon, 3/2/09, Tom Becker wrote:
From: Tom Becker
Subject: Re: [BasicX] Multitasking and use of Pow() function
To: b...
Date: Monday, March 2, 2009, 8:50 AM

> ... scanned every 10 msec.

Assign enough stack for the task? Does it run if you slow that rate down?

Tom



> ... I used a 30 byte stack.

There is a good chance that's insufficient. Try increasing it, first
generously; if your code starts working, then trim it back until you run
into trouble again. If you can locate it, Mike Perks' bxDism will help,
probably exactly, determine the stack requirements of your code.

Tom
Tom,
Thanks for the support.Let me try your suggestions.
Santhosh
MALAYSIA

Santhosh Jayarajan

--- On Mon, 3/2/09, Tom Becker wrote:
From: Tom Becker
Subject: Re: [BasicX] Multitasking and use of Pow() function
To: b...
Date: Monday, March 2, 2009, 5:20 PM

> ... I used a 30 byte stack.

There is a good chance that's insufficient. Try increasing it, first

generously; if your code starts working, then trim it back until you run

into trouble again. If you can locate it, Mike Perks' bxDism will help,

probably exactly, determine the stack requirements of your code.

Tom