2016-08-30 326 views
1

我嘗試重新編譯使用PinChangeInt的舊版arduino草圖。編譯器報告以下錯誤:Arduino PinChangeInt.h產生編譯器錯誤

Arduino: 1.6.9 (Windows 7), TD: 1.29, Board: "Arduino/Genuino Micro" 

In file included from D:\home\arnold\development\arduino\drone\serial_comm\Rx\Rx.ino:50:0: 

C:\packages\arduino\libraries\PinChangeInt/PinChangeInt.h:328:32: error: 'PCMSK1' was not declared in this scope 
PCintPort portC=PCintPort(3, 1,PCMSK1); // port PC==3 (also in pins_arduino.c, Arduino version 022) 

C:\packages\arduino\libraries\PinChangeInt/PinChangeInt.h:331:32: error: 'PCMSK2' was not declared in this scope 
PCintPort portD=PCintPort(4, 2,PCMSK2); // port PD==4 

exit status 1 
Error compiling for board Arduino/Genuino Micro. 

有沒有人知道這裏有什麼問題,以及如何修復這些錯誤?使用Arduino的版本1.6.9,PinChangeInt的版本是2402

回答

1

Arduino MicroATMega32U4被使用,它僅支持PORTBPCMSK0。其他端口不具備此功能。請參閱:ATMega32U4 datasheet

您還可以使用attachInterrupt來處理外部中斷。所以,你必須第八位PCINT0源(與所有的人一個ISR處理程序)和五個外部中斷源(每個都有自己的ISR處理)引腳01237(HW引腳:PD0 - PD3PE6) 。

+0

謝謝!我正在調查它。如果有效,我會將這個答案標記爲正確。 – Arnold

+0

我知道attachInterrupt,但我被轉向PinChangeInt由http://playground.arduino.cc/Code/ReadReceiver,因爲attachInterrupt只讀取高或低信號,而解碼PWM信號顯然需要變化的信號。這工作正常,直到我不得不再次翻譯代碼,我已經從1.0.5升級到1.6.9。我實現了你的建議,但隨着其他錯誤彈出,我必須確保所有的代碼編譯之前,我確信它一切正常:-) – Arnold

+0

它的工作原理,謝謝! PinChangeInt庫提供了已註釋掉的語句來排除端口。我排除了除portB之外的所有端口,並且這樣做了。 – Arnold