interrupts

Questions about the BASICtools and MakeItC
Post Reply
YahooArchive
Posts: 1463
Joined: Fri Oct 19, 2012 5:11 am

interrupts

Post by YahooArchive » Thu Oct 25, 2012 2:45 pm

I am attempting to use ARMbasic to implement a phase locked loop to
precisely control the relative speeds of two motors. The timing is
critical and so I performed a simple test of latency for ARMbasic:


FOR X=1 to 10000
T1=*$E0024004
T2=*$E0024004
if t1<>t2 then
print t2-t1
endif
next

This program reads the RTC clock register with two consecutive
instructions and then sees if the RTC has changed. What I found is
that sometimes up to 2 RTC clock ticks (min of 30 microseconds, max
of 90 microseconds) has elapsed between the two reads of the RTC
clock. This is a problem that might produce a "hiccup" in my motor
control which is undesirable.

What kind of interrupts or garbage collections are being serviced that
might cause this latency increase, and can these be postponed or
eliminated by disabling interrupts, avoiding certain instructions,
etc? I would like to use ARMbasic rather than C because I believe it
will be easier for others who have to use the equipment I am
constructing to maintain the software, but I will resort to C if the
latency issues can not be resolved.

Also, can I change the RTC clock setting to use the PCLK prescaler
safely without disrupting ARMbasic, and can I change the RTC to use a
divider that produced a RTC clock tick rate much faster than 32.768
kHz? I would like to do the following:

*$E0024008 = *$E0024008 and $EF
*$E0024080 = 50
*$E0024084 = 0

This way I could use the RTC clock as a means to produce a higher
resolution "Time stamp" of incoming events.

Thank you!

Dan



Post Reply