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

Hi,
I wrote now one task with two BEGIN-UNTIL loops:
a flashing loop and a pause loop (see code below).
The first loop should actually be the pause loop, so that only
when pushing the start button (switch 1 = bitmask 253) the flashing starts.
In the code below this loop is the second loop.
The reason is when I put the pause loop first then
the leds flash only one cycle.
In other words, written as is, the leds start up
flashing and they flash again and again
until I press the stop button (switch 0 = bitmask 254).
Pushing switch 1 (bitmask 253) will restart the flashing
and it will again flash endlessly, until
I press again switch 0, etc.
But when I put the pause loop first, which would be logical,
as the flashing should only begin when pressing
the start button (switch 1 or bitmask 253), then the leds
flash only one cycle, that is each led from led 0 till led 7
flashed once, and then
they stop flashing without me pushing the stop switch (switch 0 = bitmask
254).
One last remark: when the pause loop is second the leds
flash without me having to keep switch 1 pressed.
When the pause loop is first, for having the leds flashing endlessy,
I must keep switch 1 pressed.
Does anyone have an explantion for this
strange behavior?
Thanks in advance,
Viviane Beullens
TARGET
|U| |S| |R| BACKGROUND TESTER
: SEQBITFLASH ( -- ) ACTIVATE
1 BEGIN
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
PIND C@ 254 =
UNTIL
BEGIN PAUSE
PIND C@ 253 =
UNTIL
AGAIN ; \ ACTION TESTER
: /TESTER ( -- )
$FF DDRB C! $FF PORTB C!
TESTER BUILD TESTER SEQBITFLASH ;
----------------------------------------------------------------------
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 Thu Aug 14 2003 - 06:13:10 PDT
This archive was generated by hypermail 2.2.0 : Mon Dec 01 2008 - 03:04:48 PST