embedded systems developers tools, cross compilers
  Home  |   SwiftX Archive  |   SwiftForth Archive  |

Re: TASK HALT with another task

From: Noel Henson <noel_at_noels-lab.com>
Date: Sun, 10 Aug 2003 08:03:45 -0700

Viviane,

One teensy bug in what you provided below....

On Sunday 10 August 2003 07:45 am, you wrote:
> Hi,
>
> >On Sunday 10 August 2003 07:29 am, you wrote:
> >> I've embedded comments below....
> >>
> >> On Sunday 10 August 2003 05:49 am, you wrote:
> >> > Hi,
> >> >
> >> > It seems to me the fundamental problem is
> >> > a task can't be halted once it is activated,
> >> > at least not from within itself.
> >>
> >> A task could execute the top instruction within itself to stop.
> >
> >That should read:
> >
> > A task could execute the STOP instruction within itself to stop.
>
> Thanks for your suggestions. I also think it would be good a task could
> stop itself, but as yet I didn't succeed in writing the code.
> I'll study your code carefully.
> Your suggestions came just as I finished nearly
> solving the problem with creating another task for the
> START and HALT. The aim is to change the IF - ELSE - THEN
> sturtures with buttons (thus with a table and so on),
> but that's again a bit more complicated.
>
> Here is the code with two tasks and IF ELSE THEN structures.
> This code works nice, except the leds flash from start up on.
>
> TARGET
>
> |U| |S| |R| BACKGROUND TESTER
> |
> |U| |S| |R| BACKGROUND TESTER2
> |
> : READSWITCHES
>
> PIND C@ 254 =
> IF TESTER HALT
> ELSE PIND C@ 253 =
> IF TESTER ACTIVATE

You can't have an activate without anything following it. Where is your
endless loop? I think you mean:
> IF TESTER ACTIVATE SEQBITFLASH

> THEN
> THEN ;
>
> : SEQBITFLASH ( -- )
>
> 1
> BEGIN
> PORTB C@ 2DUP SWAP - AND
> PORTB C! 100 MS 2*
> PORTB C@ 127 = IF DROP 1
> THEN
> 255 PORTB C! 100 MS
> AGAIN ; \ For in task
>
> : /TESTER ( -- )
>
> $FF DDRB C! \ Set PORTB as OUTPUT
> $FF PORTB C! \ set leds off at start up
> TESTER BUILD TESTER ACTIVATE
> BEGIN PAUSE
> SEQBITFLASH
> AGAIN ;
>
> : /TESTER2 ( -- )
>
> TESTER2 BUILD TESTER2 ACTIVATE
> BEGIN PAUSE READSWITCHES
> AGAIN ;
>
>
>
> Best greetings,
> Viviane Beullens
>
>
>
>
> ----------------------------------------------------------------------
> swiftx_at_forth.com The SwiftX programming discussion email list
> To unsubscribe, send subject "unsubscribe" to swiftx-request_at_forth.com
> For list command help, send subject "help" to swiftx-request_at_forth.com
> Message archives are located at http://www.forth.com/archive/swiftx
> ----------------------------------------------------------------------
> This list is a forum for SwiftX users. For product support and bug
> reports, please send email to support_at_forth.com
> ----------------------------------------------------------------------

----------------------------------------------------------------------
swiftx_at_forth.com The SwiftX programming discussion email list
To unsubscribe, send subject "unsubscribe" to swiftx-request_at_forth.com
For list command help, send subject "help" to swiftx-request_at_forth.com
Message archives are located at http://www.forth.com/archive/swiftx
----------------------------------------------------------------------
This list is a forum for SwiftX users. For product support and bug
reports, please send email to support_at_forth.com
----------------------------------------------------------------------
Received on Sun Aug 10 2003 - 08:04:05 PDT

This archive was generated by hypermail 2.2.0 : Mon Dec 01 2008 - 03:04:47 PST