Dwayne Dietrich

newbie, trouble with RTI

Discussion created by Dwayne Dietrich Employee on Jan 29, 2006
This message contains an entire topic ported from a separate forum. The original message and all replies are in this single message. We have seeded this new forum with selected information that we expect will be of value to you as you search for answers to your questions.

Date: Mon Mar 7, 2005 7:56pm
Subject: newbie, trouble with RTI
    using mc9312c32 on techarts 12max nanocore board. compiling in
codewarrion, writing to chip with ubug12 serial comm. I am trying to
use a real time interrupt to sample 256 data points for fft. The
relevent code follows - i have omitted most of my program as it is
getting quite lengthy.
movb #$00, DPOINT
ldx #DATA
movb #%01110000, ATDCTL
movb #%00110000, RTICTL
bset CRGFLG, #%10000000
cmpa #$FF
beq FFT
ldaa ATDDR1H
staa 1,x+
bclr CRGFLG, #%10000000
; Interrupt Vectors
Org Vreset
fdb ResetFunc
ORG Vrti
rest of program runs fine - as soon as i enter 'GETDATA:' controller
seems to lock up - any thoughts?
Date: Mon Mar 7, 2005 9:46pm 
    In your GETDATA: label you incorrectly attempt to start the RTI by
setting bit 7 of CRGFLG hi. It believe you actually need to set bit
7 of CRGINT hi to kick start the RTI.
At the end of your RTI interrupt you need to write 128 to CRGFLG to
reset the interrupt flag. You are now clearing that bit.

Date: Mon Mar 7, 2005 10:11pm 
    I appreciate your review - i have corrected these mistakes - however,
my code still seems to get stuck in the DLOOP: without any interrupts
occuring, any ideas?

Date: Mon Mar 7, 2005 10:33pm
    Sorry, was just looking a RTI issues before.
In your RTI interrupt it looks like x is free in increment far
outside your intended data structure, mowing down everything in its
path. Remember that the RTI never stops, even though other parts of
your software stop gathering data. DLOOP stays inside the 256
element range because it's a byte and rolls around inside your data
structure, but x is 16 bits. You need to rethink the relationship
between the RTI and your "foreground" routines.

Date: Tue Mar 8, 2005 10:31am
    this makes sense - that's why my first instruction upon leaving DLOOP
(which i hadn't shown previously) is to disable RTI.
thanks everyone for the help - i'll see if i can get this going

Date: Wed Mar 9, 2005 9:57pm

    Real time interrupts are working great now- thanks to all for the
suggestions and the help!

Date: Mon Mar 7, 2005 11:30pm
    >> > movb #%00110000, RTICTL
You didn't enable RTI. Bits 6:4 and 3:0 of RTICTL should be non zero