Hi,
In the playground there is a small library to control the port change interrupts.
http://arduino.cc/playground/Main/PcInt
I can´t seem to grasp why there is the PCint function definition and the SIGNAL functions.
They don´t seem to be necessary?
Is this library usable with the Mega2560?
Regards
I can´t seem to grasp why there is the PCint function definition
Did you miss this:
SIGNAL(PCINT0_vect) {
PCint(0);
}
and this // common code for isr handler. "port" is the PCINT number.
?
Ok, PCint function is called whenever there is a Port Change interruption triggered to clarify to which port and pin changed and consequently, to define which of the subroutines in PCintFunc array is going to be called.
And now i understand that the SIGNAL function defines that the PCint function is going to be called, when a port change interrupt happens.
Where can i find more info about SIGNAL definitions?
Hi,
This does not answer your question, but should help you, the library you are looking at might be out of date, I have used the PCIntChange library which is based on the same work, but is more uptodate, it includes several revisions and bug fixes.
I have a post about the library and how I have used it, these links include a link to the current google code group as well, note, I have not contributed to the library, but consider it very useful and not as well known as it should be -
http://rcarduino.blogspot.com/2012/03/need-more-interrupts-to-read-more.html
http://rcarduino.blogspot.com/2012/04/how-to-read-multiple-rc-channels-draft.html
Duane B
rcarduino.blogspot.com
Hi Duane,
I was reading about your library.
There is no reference to the ATmega2560, does it only supports Atmega 328 ?
Ok
Read the Issues in google code, still doesn´t support Mega 2560.
AWOL can you give me more info about SIGNAL?
Hi,
Just to be clear, its not my library, I just think its very useful and not as well known as it should be.
As for signal, I thought the keyword had been replaced with ISR()
The following are the pin change interrupts from the pinchangeint library -
ISR(PCINT0_vect) {
PCintPort::curr = portB.portInputReg; // version 1.6
portB.PCint();
}
ISR(PCINT1_vect) {
PCintPort::curr = portC.portInputReg; // version 1.6
portC.PCint();
}
ISR(PCINT2_vect){
PCintPort::curr = portD.portInputReg; // version 1.6
portD.PCint();
}
Duane B
rcarduino.blogspot.com