There's a lot going on here:
The A/D samples at 1600Hz (from the timer, from the 12MHz internal oscillator). The A/D interrupt routine processes the samples.
The routine called "Averages" runs on every mains zero crossing, and there is a breakpoint at the beginning of the routine.
It therefore follows that the A/D interrupt routine should have run 16 times since the Averages routine ran last time.
The A/D interrupt routine counter is in R2, and it is saved every time Averages is run. The results are shown in the memory pane at the right. In nearly every case the number is 16 (0x10), occasionally it is 15 and occasionally it is 17, which is to be expected.
However, the value in R2 when the breakpoint halts the processor is never 16, it is usually between 2 and 5. This suggests to be that the A/D interrupt routine has been called several times between the breakpoint being reached and the registers being displayed on the screen
Is this correct? How can I see the values of the registers at the exact instant that the program counter reaches the breakpoint?
