2010-09-09 05:18 AM
EXTI on PortA (PA1 & PA2) Interrupt routine
2011-05-17 06:10 AM
look at
http://62.193.238.133/mcu/modules.php?name=mcu&file=familiesdocs&fam=113&doc=76
http://62.193.238.133/mcu/modules.php?name=mcu&file=familiesdocs&fam=113&doc=76
STM8S FWLIB : EXTI examplebrazov2
2011-05-17 06:10 AM
Hi,
i already checked this example.
i do not understand how i can filter the source pin which initiated the interrupt.
the interrupt routine says:
{
if ((GPIO_ReadInputData(JOYSTICK_PORT) & JOYSTICK_LEFT_PIN) == 0x00)
{
GPIO_WriteReverse(LEDS_PORT, LED1_PIN);
}
if ((GPIO_ReadInputData(JOYSTICK_PORT) & JOYSTICK_RIGHT_PIN) == 0x00)
{
GPIO_WriteReverse(LEDS_PORT, LED2_PIN);
}
if ((GPIO_ReadInputData(JOYSTICK_PORT) & JOYSTICK_UP_PIN) == 0x00)
{
GPIO_WriteReverse(LEDS_PORT, LED3_PIN);
}
if ((GPIO_ReadInputData(JOYSTICK_PORT) & JOYSTICK_DOWN_PIN) == 0x00)
{
GPIO_WriteReverse(LEDS_PORT, LED4_PIN);
}
}
....
ReadInputData reads the complete port value, but i want to detect on 2 pins of the same port rising and falling edges independently.
for example: in my routine if one of the pins goes high (the other is low) it fires my interrupt routine and then i check with ReadInpuData the value. But if the other is high and the pin goes high, it will perform two actions if i would do something with ReadInputData and this ''if''-structure.
Now i'm using PortB for my second input to get really different interrupt sources which i can handle.
But i think there should be a more convenient way to do this only with one port.
2011-05-17 06:10 AM
you need to do an xor on the port x register at every interrupt in order to discriminate the interrupt source.
2011-05-17 06:10 AM
Hi,
that sounds easy, but which register xor with what?
i can't find a register which gives me the information in the manual!
thanks