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

TASK HALT - problem

From: Viviane.Beullens <Viviane.Beullens_at_swing.be>
Date: Sun, 10 Aug 2003 14:49:17 +0200

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.

If I change my sequentail leds flashing program
as suggested by E. Rather then the vectored execution
problem is solved, but this doesn't solve my problem which
is to halt the task when pressing a button.
Further whether TASK BUILD is in START or not doesn't make
any difference. From outside the task a task can always
be halted with TASK HALT but not from within the task itself.

New code:

TARGET

|U| |S| |R| BACKGROUND TESTER

: MYSTART TESTER BUILD ;
: MYSTOP TESTER HALT ;

 
CREATE BUTTONS 8 CELLS ALLOT
' MYSTOP BUTTONS ! \ in cell 0

: 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

' SEQBITFLASH BUTTONS CELL + ! \ in cell 1

: nothing ;

: /TESTER ( -- ) MYSTART
    $FF DDRB C! \ Set PORTB as OUTPUT
    $FF PORTB C! \ set leds off at start up
    TESTER ACTIVATE
          
       BEGIN PAUSE
           PIND C@ 127 = IF MYSTOP ELSE
                               SEQBITFLASH
                         THEN
       AGAIN ;

{ ---- ALTERNATIVE and assuming MYSTART is in GO in App.f
---------------------

: /TESTER ( -- )
    $FF DDRB C! \ Set PORTB as OUTPUT
    $FF PORTB C! \ set leds off at start up
    TESTER ACTIVATE
          
       BEGIN PAUSE
           PIND C@
            CASE
            127 OF BUTTONS + @EXECUTE ENDOF
            191 OF 1 CELLS BUTTONS + @EXECUTE ENDOF
         nothing ENDCASE
       AGAIN ;
---------------------------------------------- }

Thanks in advance for any info,
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
----------------------------------------------------------------------
Received on Sun Aug 10 2003 - 05:53:21 PDT

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