Re: A92: How to use auto-int's?


[Prev][Next][Index][Thread]

Re: A92: How to use auto-int's?



Niklas Brunlid wrote:

> What is the correct way to use auto-ints instead of delay loops?
>
> I've tried setting 600017 to some random values from 01 to FF. It gets
>
> equally slow with all of them!

    Hmmm.. I'd sugest NOT using Auto-Ints to perform delay loops.  For
one thing they slow the entire system down, not just one short delay
like a delay loop would.  If you really MUST use a delay loop, then
write a REALLY short assembly call, turn off interrupts (move #$2700 to
the SR), place your address into the auto-int you want to hook, then
turn interrupts back on.  I suggest restoring the old auto-int when
you're done.. they're kinda vital to the TI-OS.
    My guess is that your auto-int was too long and so no matter how
long the 'delay' was which you entered into 600017, your routine took
too long to complete.  Also, be sure that the interrupt which is
controlled by the timer at 600017 is the one you're replacing.  Then,
for slower operation use a higher value (closser to FF), and faster
operation would use a lower value (closer to 01) - since the delay is
generated by how often your auto-int is called, not by the amount of
time the timer is set for.
    Another way to use the timer would be:  set a global  flag to 0,
install your interrupt and set the timer, then wait for the flag to
change to some other value before continuing.  The interrupt would
consist of simply setting that flag to some value other than zero.
Immediately after the flag changes, you would uninstall the interrupt
(or just turn interrupts off).   Using this method is more like a
regular delay loop, where it only affects the program speed when it's
called - but you need to know more about the system to get it to work.

Hope that helps some..

--Bryan
bcturner@eos.ncsu.edu



References: