the same interrupt again. Notice that there is a pre-and post-amble to the ISR that saves the STATUS
and W registers. This is not optional! Because an
interrupt can occur at any time, these two registers
need to be saved and restored or whatever was
happening when the interrupt occurred will be trashed.
In case you wanted to know, Figure 4 shows
what my servo controller looks like. I didn’t have
a light sensor to control the servo so I left my
variable resistor on to pretend that it was light
controlling it. (This sounds like a good Halloween
ornament circuit to me.)
This was a fun set of questions that offer some
more tools for dealing with analog input in assembly.
I had not done this before so it was a learning
experience for me too. The complete source code
for all these projects is available online at www.
servomagazine.com as ADC8pin.zip. Any version
of MPLAB will assemble them. I used MPLAB 8. 36
and checked how my code was working by using
MPSIM to simulate the circuit. Keep those
questions coming to roboto@servomagazine.com. SV
SERVO 12.2009 17