Hi,
Yes, Noel and Elizabeth, you were right.
The actions with ACTIVATE were not treated well in my code
and probably it worked only by chance. But it explained
probably why it didn't work with buttons - which is what I
will try to do in the next step.
Meanwhile FYI I give you the correct code as suggested by both of you.
The easiest solution actually was to factor out
the actions, so that
: SEQBITFLASH .. code ... ;
became
: SEQBITFLASH ACTIVATE BEGIN PAUSE ... code ... AGAIN ;
After this is done, this action can be assigned to a TASK, so:
TASK SEQBITFLASH
And this can then be done as often as needed.
The complete code is below. It works fine. When it'll be rewritten
with buttons I'll post it. Of course, all of your good advice
will still be welcome.
Thanks to both of you.
Viviane Beullens
TARGET
|U| |S| |R| BACKGROUND TESTER
|U| |S| |R| BACKGROUND TESTER2
: SEQBITFLASH ( -- ) ACTIVATE
1
BEGIN PAUSE
PORTB C@ 2DUP SWAP - AND
PORTB C! 100 MS 2*
PORTB C@ 127 = IF DROP 1 CR
THEN
255 PORTB C! 100 MS
AGAIN ; \ To assign to TESTER
: READSWITCHES ACTIVATE BEGIN PAUSE
PIND C@ 254 =
IF TESTER HALT
ELSE PIND C@ 253 =
IF TESTER SEQBITFLASH
THEN
THEN AGAIN ; \ To assign to TESTER2
: /TESTER ( -- )
$FF DDRB C! \ Set PORTB as OUTPUT
$FF PORTB C! \ set leds off at start up
TESTER BUILD TESTER
SEQBITFLASH ;
: /TESTER2 ( -- )
TESTER2 BUILD TESTER2 READSWITCHES ;
----------------------------------------------------------------------
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 Mon Aug 11 2003 - 06:40:07 PDT
Subscribe to our e-mail list service. It's free for all SwiftForth and SwiftX users!
This archive was generated 09-Feb-2012. Archive updated nightly.