![]() | ||
| Home | SwiftX Archive | SwiftForth Archive | |

Hi ,
>> > > A task could execute the STOP instruction within itself to stop.
>
>Yes, that is how a task deactivates itself. However, once STOPped
>it cannot start up again on its own; it needs to be started by another
>task.
I though this was only for a task with transitient behavior.
>>...
>> > : 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 ;
>
>Noel is right, ACTIVATE needs to be followed by the code the
>task is supposed to execute.
The code as I wrote is with two tasks works and works well(see below).
As soon as I add something after TESTER ACTIVATE
in the REASSWITCHES word, then it doesn't work anymore.
Why then does it work so good? I can't be by chance, can it?
It does exactly what I want, that is flashing stops
when pressing switch 0 and restarts
when pressing switch 1.
I don't even have to keep the
switch buttons pressed.
The only thing I didn't succeed in doing is
to start up the the tester task with the SEQBITFLASH
without flashing.
Is there not a trick to do it working
with the the code I have already? (see below).
Replacing the IF-THEN structures by vectored
execution is also error prone and though I
tried it out, it doesn't work as well as this
code with two tasks.
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
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 ;
Thanks in advance,
Viviane
----------------------------------------------------------------------
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 - 12:11:03 PDT
This archive was generated by hypermail 2.2.0 : Thu Nov 20 2008 - 03:04:46 PST