To use this file copy and paste this:
// #URL-lib "http://pin1.org/forthlib/flb/Interupts/timer0-example.fth" into BV Terminal 3
or here to download.
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
// Examples of using interrupts with timer 0
// T0start will begin the program
// This code simply causes an interrupt evey 15 seconds and
// prints a message to the console.
// Use LOOK to see the interupt tables before and after using
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
// REQUIRES:
// #URL-lib "http://pin1.org/forthlib/flb/General/soft1.flb" sid=99
// #URL-lib "http://pin1.org/forthlib/flb/General/decompile.flb"
// #URL-lib "http://pin1.org/forthlib/flb/Interupts/interrupt.flb"
// CONSTANTS:
// constants needed for this example
&e0004000 constant T0IR
&e0004004 constant T0TCR
&e0004008 constant T0TC
&e000400c constant T0PR
&e0004014 constant T0MCR
&e0004018 constant T0MR0
Full Contents of File
&e0004000  constant  T0IR
&e0004004  constant  T0TCR
&e0004008  constant  T0TC
&e000400c  constant  T0PR
&e0004014  constant  T0MCR
&e0004018  constant  T0MR0
: setT0
        TIMER0  intSel     
        TIMER0  intEn       
        efiq       
;
: T0int
        1  t0IR  !       
        ."  Interrupt  has  occurred"  cr
        TIMER0  intEn 
;
: T0start
        pclk  1000 
        2  T0TCR  !             
        1  T0TCR  !             
        10000  t0MR0  !       
        3  t0MCR  !             
        setT0                     
       
        s"  T0int"  find  drop     
        TIMER0       
        int>>         
; 
: T0stopTIMER0  intDis  ;
: lookintr.  ;