I've read the interrupt, SPI and timer0 chapters over and over again, but I can't seem to get any interrupts to trigger.
I'm probably still missing something but I can't figure out what it is.
I've also added two 'debug' outputs:
- RA4 toggles in the main loop
- RA5 toggles in the interrupt
RA4 toggles without issue, but RA5 never changes state, which means that no interrupt is triggered.
I actually don't need the timer0, just the two SPI. That was just to test if the interrupt worked with a simple 8 bit timer, but like I said it doesn't work.
The code can be found in here :
https://gist.github.com/pyroesp/b088bb76131b981d15bf9718ccc29edcThe interrupt setup starts at line 220.
More info:
- internal 32MHz
- 3.5VDC powered
- SPI1 slave mode set to RC0, RC1, RC2 (SS, CLK, SDI)
- SPI2 slave mode set to RA0, RA1, RA2 (SS, CLK, SDI)
- SPI clock = 250kHz
- Timer0 set to 8 bit mode : interrupt triggers when TMR0L == TMR0H
- TMR0H set to 30; arbitrary number. I just wanted to see RA5 output toggle.
I've tried searching for interrupt example codes for the 16F18325, but I didn't find any so I couldn't compare.
I also tried the MPLAB Code Config tool but I couldn't see what the difference was between their generated code and mine.
Any help is greatly appreciated.