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

A useful application

From: Viviane.Beullens <Viviane.Beullens_at_swing.be>
Date: Sun, 17 Aug 2003 17:43:50 +0200

Hi,

Below is a useful application with several tasks and buttons.

Bug reports are welcome.

Best greetings,
Viviane Beullens

\ Application with several tasks and buttons
\ Make a file named BUTTON.f
\ Add in App.f : INCLUDE BUTTON followed by
\ : GO /DEFAULT /TESTER /TESTER2 /STOPALL /BUTTON DEBUG-LOOP ;
      

TARGET
|U| |S| |R| BACKGROUND DEFAULT
|U| |S| |R| BACKGROUND STOPALL
|U| |S| |R| BACKGROUND TESTER
|U| |S| |R| BACKGROUND TESTER2
|U| |S| |R| BACKGROUND BUTTON

VARIABLE ONE

: DEFAULTACT ACTIVATE BEGIN
               PAUSE PIND C@ <> 255 UNTIL ; \ ACTION DEFAULT

: SEQBITFLASHACT ( -- ) ACTIVATE
    1 ONE !
    BEGIN PAUSE
              ONE @
              PORTB C@ 2DUP SWAP - AND
              PORTB C! 100 MS 2* ONE !
              PORTB C@ 127 = IF 1 ONE !
                              THEN
                255 PORTB C! 100 MS
        AGAIN ; \ ACTION TESTER
                   

: TESTER2ACT ACTIVATE
    BEGIN PAUSE $00 PORTB C! 100 MS $FF PORTB C! 100 MS
            AGAIN ; \ ACTION TESTER2

: STOPALLACT ACTIVATE BEGIN PAUSE TESTER HALT TESTER2 HALT AGAIN ;
              \ action STOPALL

: DODEFAULT DEFAULT DEFAULTACT ;
: DOSEQBITFLASH TESTER SEQBITFLASHACT ;
: DOFLASH TESTER2 TESTER2ACT ;
: DOSTOP STOPALL STOPALLACT ;

CREATE BUTTONS ' DODEFAULT , ' DOSEQBITFLASH , ' DOFLASH , ' DOSTOP ,

: DOBUTTON ACTIVATE
      BEGIN PAUSE
           PIND C@
             CASE
       254 OF 3 CELLS BUTTONS + @EXECUTE ENDOF
       253 OF 1 CELLS BUTTONS + @EXECUTE ENDOF
       251 OF 2 CELLS BUTTONS + @EXECUTE ENDOF
   \ 247 OF 3 ENDOF
   \ 239 OF 4 ENDOF
   \ 223 OF 5 ENDOF
   \ 191 OF 6 ENDOF
   \ 127 OF 7 ENDOF
     0 CELLS BUTTONS + @EXECUTE
           ENDCASE
        AGAIN ; \ action BUTTON

 

: /TESTER ( -- )
    TESTER BUILD ;

: /TESTER2 TESTER2 BUILD ;

: /DEFAULT
   DEFAULT BUILD ;

: /STOPALL STOPALL BUILD ;

: /BUTTON
         $FF DDRB C! \ Set PORTB as OUTPUT
         $FF PORTB C! \ Set PORTB OFF at start up
        BUTTON BUILD BUTTON DOBUTTON ;

----------------------------------------------------------------------
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 17 2003 - 08:48:10 PDT

This archive was generated by hypermail 2.2.0 : Fri Dec 05 2008 - 03:04:22 PST