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
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
----------------------------------------------------------------------
Received on Sun Aug 10 2003 - 07:49:08 PDT
Subscribe to our e-mail list service. It's free for all SwiftForth and SwiftX users!
This archive was generated 08-Feb-2012. Archive updated nightly.