Attempting to enable the external interrupt on a ATmega328P via the following lines:
LDI R16, (1 << ISC00) | (1 << ISC01)
LDI R17, (1 << INT0)
STS EICRA, R16
STS EIMSK, R17
SEI
during my reset subroutine.
The idea is to have INT0 trigger a external interrupt upon a rising edge (i.e. from button press). The appropriate JMP
instruction has been placed withing the interrupt vector table at 0x0002
.
During debugging in Atmel Studio 6 using the simulator, not only does no interrupt run when I toggle the INT0 pin, whilst manually stepping over instructions I found that the EIMSK
register isn't being updated and that the instruction STS EIMSK, R17
seems to be doing completely nothing despite R17 being set to 0x01 just prior execution of that instruction.
Quite a noob at AVR assembly, is this an issue with my code or something in atmel studio.
STS
toOUT
and see how it goes. – PeterJOUT
instruction so thats a no go for me (tried it anyway, studio threw an error). – initramfs