Are interrupts enabled during setup()?

This is probably a silly question, but I could find no answers: are interrupts enabled during setup()? Are they as soon as I call attachInterrupt()?

Interrupts are not disabled while setup is running, and the timer0 overflow interrupt is in fact executing every millisecond during setup to keep time for millis() and delay();

Serial data transfer, analog read, SPI, I2C, and many other commonplace things use interrupts - and as I'm sure you're aware, these work correctly during setup, proving that interrupts are enabled.

Thanks a lot!

No not really! Some of the interrupts are running all the time, BUT the external interrupts that you can access via attachinterrupt() do not run until you call attachinterrupt().

DO NOT use nointerrupts() and interrrupts() to control what the external interrupts are doing as interrupts/nointerrupts affects ALL the interrupts on the Arduino.

Mark

SukkoPera:
This is probably a silly question, but I could find no answers: are interrupts enabled during setup()? Are they as soon as I call attachInterrupt()?

Your question is a bit unclear. There are a lot more interrupts than the ones you deal with by using attachInterrupt.

As holmes4 pointed out, the interrupt associated with attachInterrupt will not be active until you call attachInterrupt. However other interrupts (in particular the timer interrupt for Timer 0) will already be active.

[quote author=Nick Gammon date=1437170741 link=msg=2320243]the interrupt associated with attachInterrupt will not be active until you call attachInterrupt. However other interrupts (in particular the timer interrupt for Timer 0) will already be active.
[/quote]

This is exactly what I needed to know, thanks!