From 2f83a0bea9da444e3d70569eba3d6847ca02be03 Mon Sep 17 00:00:00 2001 From: Dimitri Sokolyuk Date: Fri, 21 Sep 2018 21:59:17 +0200 Subject: ... --- forth/forth/avr/irqAtmega128.fs | 45 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 45 insertions(+) create mode 100644 forth/forth/avr/irqAtmega128.fs (limited to 'forth/forth/avr/irqAtmega128.fs') diff --git a/forth/forth/avr/irqAtmega128.fs b/forth/forth/avr/irqAtmega128.fs new file mode 100644 index 0000000..43e20f9 --- /dev/null +++ b/forth/forth/avr/irqAtmega128.fs @@ -0,0 +1,45 @@ +\ ********************************************************************* +\ Interrupts example for FlashForth * +\ Filename: irq.txt * +\ Date: 04.10.2013 * +\ FF Version: 5.0 * +\ MCU: Atmega128 * +\ Copyright: Mikael Nordman * +\ Author: Mikael Nordman * +\ ********************************************************************* +\ FlashForth is licensed acording to the GNU General Public License* +\ ********************************************************************* +\ Disable interrupt before removing the interrupt code +irqOvf3Dis +-irqOvf3 +marker -irqOvf3 +\ Timer 3 definitions from m128def.inc +$8a constant tccr3b +$7d constant etimsk +#30 constant ovf3Ivec + +\ Counter for timer overflows +variable counter + +\ The interrupt routine +: t3OverflowIsr + 1 counter +! +;i + +: irqOvf3Init + \ Store the interrupt vector + ['] t3OverflowIsr ovf3Ivec int! + \ Activate counter 3 + 1 tccr3b mset + \ Activate timer3 overflow interrupt + 4 etimsk mset +; +: irqOvf3Dis + 4 etimsk mclr +; + +irqOvf3Init + +counter @ u. +#1000 ms +counter @ u. -- cgit v1.2.3