Hello ![]()
I have some question about interrupt function.
Is it possible to use one pin making two different interrupt?
For examplem,
attachInterrupt(0, A, RISING);
attachInterrupt(0, B, FALLING);
....
void A()
{
bla~bla~
}
void B()
{
}
Hello ![]()
I have some question about interrupt function.
Is it possible to use one pin making two different interrupt?
For examplem,
attachInterrupt(0, A, RISING);
attachInterrupt(0, B, FALLING);
....
void A()
{
bla~bla~
}
void B()
{
}
Is it possible to use one pin making two different interrupt?
Why do you want to do it, considering that you could use CHANGE as the interrupt trigger and test the state of the interrupt pin in the ISR.
Is it possible to use one pin making two different interrupt?
No.
You could connect one input to the two external interrupt pins and set up a separate ISR for each.
Whether that would be a sensible thing to do is a different matter. You have not told us what you are trying to achieve.
...R
OH, I want control BLDC motor and that interrupt signal is three hall sensors. I want make 6 state to use 6 interrupt.
For example, Hall sensor A Rising interrupt and Falling interrupt make 2 state of motor.
ysj94755:
OH, I want control BLDC motor and that interrupt signal is three hall sensors. I want make 6 state to use 6 interrupt.
For example, Hall sensor A Rising interrupt and Falling interrupt make 2 state of motor.
Why not connect each sensor to a separate pin and use pinChange interrupts. Or use a Mega which has more external interrupts.
...R
OH, I want control BLDC motor and that interrupt signal is three hall sensors. I want make 6 state to use 6 interrupt.
For example, Hall sensor A Rising interrupt and Falling interrupt make 2 state of motor.
You may find this reference interesting.
You'll need to use 3 interrupt pins, unless you're looking to combine the sensor signals into 1 signal. This could be done using a 3-input XOR gate, producing a squarewave with 6 state changes per 360°.