Page 1 of 1

What am I missing?

Posted: 19 July 2006, 8:37 AM
by DH*
This is my first stab at multitasking. My task stack is 50 bytes.

Just before starting my main loop I start the task with...

Code: Select all

    CallTask TTLTask, TTLStack


The task is...

Code: Select all

Sub TTLTask()

  Call WaitForInterrupt(zxPinChange, INT0)     	'pin16 = ZC
  cnt = cnt + 1
     
End Sub
Pin16 has a square wave ZC from a TW523.

No matter how long the app runs, cnt never exceeds 1, indicating the task only gets called once.

Do I need to wrap the task procedure in a Do:Loop?

Re: What am I missing?

Posted: 19 July 2006, 8:54 AM
by mikep
dhouston wrote:

Code: Select all

Sub TTLTask()

  Call WaitForInterrupt(zxPinChange, INT0)     	'pin16 = ZC
  cnt = cnt + 1
     
End Sub
The End Sub effectively ends the task. So yes you do need some kind of loop if you want the task to do more work.

Re: What am I missing?

Posted: 19 July 2006, 10:33 AM
by DH*
mikep wrote:The End Sub effectively ends the task. So yes you do need some kind of loop if you want the task to do more work.
Thanks - it works as expected with a loop.