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

Hello,
I'm using a ATmega64 with SwiftX (AVR).
The goal is to wake MSTIMER task every 1 ms. The task is still small
for debugging purposes, will eventually become a timing wheel.
But I can't get to wake the task through high-level forth, because it
corrupts the system (why?)
And my attempts of waking the task through assembler wouldn't work either.
Does anybody have such an 'interrupt task wake-up' source code?
Thanks in advance,
Frank Boon
Metatronics
VARIABLE MSEC
|U| |S| |R| BACKGROUND MSTIMER
: MS_TASK ( task-addr -- )
ACTIVATE
BEGIN
STOP
MSEC @ 1 + MSEC !
AGAIN
;
: MS_WAKE ( -- )
WAKE MSTIMER @ C!
;
LABEL <MSTIMER> \ WAKE UP TIMER
R0 PUSH
SREG R0 IN R0 PUSH
ZH PUSH ZL PUSH SH PUSH SL PUSH TH PUSH TL PUSH
R17 PUSH R16 PUSH
' MS_WAKE RCALL
R16 POP R17 POP
TL POP TH POP SL POP SH POP ZL POP ZH POP
R0 POP R0 SREG OUT
R0 POP
RETI
END-CODE
<MSTIMER> OC0addr INTERRUPT
: SETUP_MSTIMER
MSTIMER BUILD MSTIMER MS_TASK
\ setup timer of 1 ms
$0C TCCR0 C!
$FA OCR0 C!
$00 ASSR C!
TIMSK C@ $02 OR TIMSK C! \ ENABLE INTERRUPT
;
----------------------------------------------------------------------
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 Sat Sep 18 2004 - 09:50:24 PDT
This archive was generated by hypermail 2.2.0 : Thu Nov 20 2008 - 03:04:47 PST