Index: Interrupt-1.fs =================================================================== --- Interrupt-1.fs (Revision 1930) +++ Interrupt-1.fs (Arbeitskopie) @@ -1,44 +1,37 @@ -\ simple interrupt demonstration -\ runs a ticker with timer 0, -\ implemented in pure forth -\ tested on an Atmega16, others -\ use different addresses -\ -\ Timer 0 overflow, interrupt -\ number for Atmega16 +\ Einfacher Timerinterrupt +\ benutzt den Timer0 + +\ Timer 0 overflow interrupt +\ Die Nummer gilt für den Atmega16 $12 constant TIMER0_OVFAddr -\ initialize the frequency: -\ CPU frequency / 1024, overflow interrupt -\ every 256 timer ticks. +\ Randdaten +\ CPU-Takt / 1024, overflow interrupt +\ alle 256 timer ticks. \ 16MHz -> 64 ticks/sec \ 8MHz -> 32 ticks/sec -\ variable tick -\ just increment the tick variable +\ einfach nur hochzählen : timer-int-isr 1 tick +! ; +\ Den Timer0 programmieren und +\ tick zurücksetzen : timer-init - 5 TCCR0 c! \ check data sheet + 5 TCCR0 c! \ Siehe Datasheet ['] timer-int-isr TIMER0_OVFAddr int! 0 tick ! ; -\ turn on the timer, needs timer-init -\ already in place +\ Ticker einschalten : +timer 1 TIMSK c! ; -\ stops the timer +\ Ticker ausschalten : -timer 0 TIMSK c! ; - -\ test the timer interupt with repeated -\ TIMER0_OVFAddr int-trap tick @ . -\ it should increment tick by 1 Index: Interrupt-2.fs =================================================================== --- Interrupt-2.fs (Revision 1930) +++ Interrupt-2.fs (Arbeitskopie) @@ -1,16 +1,14 @@ -\ from the vce benchmark suite, modified -\ executes the word with the execution -\ token 'xt' n-times +\ Von der VCE 2011 Benchmark Suite angepasst +\ Führt das Wort XT n-mal aus + : benchme ( xt n -- ) - dup >r \ save number of iterations + dup >r \ Anzahl sichern +timer-init +timer - tick @ - \ execute word. word must have a - \ neutral stack effect + tick @ swap 0 do dup execute loop - drop \ remove the xt + drop \ XT entfernen tick @ swap - - cr r> . ." Iterations." . ." timer ticks" cr + cr r> . ." Iterations." u. ." timer ticks" cr ;