Sign in

username:

password:



Not a member?

Search hc11



Search tips

Subscribe to hc11



Ads

Discussion Groups

Technical discussions about Freescale Microcontrollers: M68HC11. (Freescale Semiconductor is a Subsidiary of Motorola).

ISR - bal_gill21 - Dec 12 13:01:00 2004


Hi all,
I am trying to create an interrupt every 32.77ms for the first time.
To do this I have set the RTRO1 & RTR0 in the PACTL register to 1, so
the interrupt rate gets set to 32.77ms. I've set the RTII flag in
TMSK2 to 1 to enable interrupt. My ISR resets the RTIF flag by
writing a 1 to it every time the interupt is carried out.
My ISR is below. It compiles fine but my development board refuses to
let me debug it. Is there something i've missed out? Thanks in advance

ISR
ldx $D0A6
dex
stx $D0a5
ldab #%01000000
stab TFLG2 ;reset the TFLG2 RTIF flag
beq storage

RETURN RTI





(You need to be a member of hc11 -- send a blank email to hc11-subscribe@yahoogroups.com )


Re: ISR - Jim Dodd - Dec 12 13:32:00 2004


--- bal_gill21 <> wrote:
>
> Hi all,
> I am trying to create an interrupt every 32.77ms for the first time.
> To do this I have set the RTRO1 & RTR0 in the PACTL register to 1, so
> the interrupt rate gets set to 32.77ms. I've set the RTII flag in
> TMSK2 to 1 to enable interrupt. My ISR resets the RTIF flag by
> writing a 1 to it every time the interupt is carried out.
> My ISR is below. It compiles fine but my development board refuses to
> let me debug it. Is there something i've missed out? Thanks in advance
>
> ISR
> ldx $D0A6
> dex
> stx $D0a5
> ldab #%01000000
> stab TFLG2 ;reset the TFLG2 RTIF flag
> beq storage
>
> RETURN RTI Many development boards handle debugging by using interrupts themselves. You
may be prevented from stepping through an interrupt by your development
environment. Try setting a flag inside the interrupt that can be examined once
the interrupt has fired and returned (if it returns:-).

Your "beq storage" doesn't go where we can see it. Beware of doing nasty things
there that are wrecking your development environment. Also, make sure you are
using RTI in the "storage" routine, or branching back to your RETURN label.

Regards,

Jim Dodd
Onset Computer Corp.

__________________________________





(You need to be a member of hc11 -- send a blank email to hc11-subscribe@yahoogroups.com )

Re: ISR - David Kelly - Dec 12 18:29:00 2004


On Dec 12, 2004, at 12:01 PM, bal_gill21 wrote:

> My ISR is below. It compiles fine but my development board refuses to
> let me debug it. Is there something i've missed out? Thanks in advance

So your development board/environment won't trace thru the interrupt
yet the IRQ is still running. Do you find the value at 0xd0a5 is one
less than the value at 0xd0a6? If so then the IRQ is running.

Nohau is what I've used on HC11. IIRC there is an option for tracing
thru interrupts vs letting them run at full speed in the background.
However one can set a breakpoint in the IRQ, then single step from
there.

Not totally related to the subject, but something I do a lot is create
"software timers" using a single periodic interrupt. Just allocate a
variable to be decremented each time but only if it is non-zero.
Something like this:

if( blink_timer )
blink_timer--;

Outside of the IRQ I know I've set blink_timer so if I ever find it to
be zero then I know its time to do the blink thing.

--
David Kelly N4HHE,
========================================================================
Whom computers would destroy, they must first drive mad.




(You need to be a member of hc11 -- send a blank email to hc11-subscribe@yahoogroups.com )