Open chjchoi opened 7 years ago
Hi @chjchoi :wave: Do you still experience this issue? In any case SPI and INT handling should not interfere with one another. One thing that's problematic for sure with your code is that
a) you do not initialize state
, e.g. state = 0
. and
b) you use a boolean !
operator on a unsigned char
type.
I'd suggest to modify your code like that
boolean state = false;
...
state=!state;
digitalWrite(LED_BUILTIN,state);
...
I have experienced some problem. On the Arduino nano Atmega328, INT0 and SPI can't do their jobs concurrently.
1) I have made the toggle wave (8.3333mSec Period) externally and input it into the pin 2
2) I have made a test code for that as belows if I have blocked the code line //SPCR |= _BV(SPE); then INT0 interrupt handler "void PCI_ZC1()" called and 8.333mSec period LED Toggling can be shown by oscilloscope. but if // is removed.. There is no LED Toggling on Oscilloscope...
Does SPE bit of SPCR determs the INT0 or BUILTIN LED or function digitalWrite()?