Go Down

Topic: Arduino nano 328 hardware bug? (SPI & INT0) (Read 8 times) previous topic - next topic


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 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?

#define _sclk 13
 #define _miso 12
 #define _mosi 11
 #define _cs 10
 #define _dc 9
 #define _rst 8
 #define ZC1 2
 #define ZC2 3
 //uint8_t _cs, _dc, _rst, _mosi, _miso, _sclk,
 // uint8_t mosipinmask, clkpinmask, cspinmask, dcpinmask;
 // volatile uint8_t *mosiport, *clkport, *dcport, *rsport, *csport;
 unsigned char zc1Value,zc2Value,oldZc1Value,oldZc2Value;
 void PCI_ZC1()
 void setup() {
 // put your setup code here, to run once:
 pinMode(ZC1,INPUT); //no pullup
 pinMode(_rst, OUTPUT);
 digitalWrite(_rst, LOW);
 pinMode(_dc, OUTPUT);
 pinMode(_cs, OUTPUT);

 //SPCR |= _BV(SPE);

void loop() {
 // put your main code here, to run repeatedly:


Go Up

Please enter a valid email to subscribe

Confirm your email address

We need to confirm your email address.
To complete the subscription, please click the link in the email we just sent you.

Thank you for subscribing!

via Egeo 16
Torino, 10131