2015-10-02 08:08 AM
I want to count pulses generated from a reed switch. The switch has three outputs connected to WKUP1, WKUP2 and PCO of the STM32L100RB. I need an example or suggestions on how to achieve this. Kindly assist.
2015-10-02 10:36 AM
Take a look at the EXTI examples where the pins could generate interrupts. Might need to consider debouncing
STM32L1xx_StdPeriph_Lib_V1.2.0\Project\STM32L1xx_StdPeriph_Examples\EXTI\EXTI_Example\main.c2015-10-05 12:46 AM
Thanks Clive1.
2015-10-05 12:56 AM
2015-10-05 09:29 AM
Pretty sure the newer version has the same examples, I just went through the most recent library I had unpacked.
2016-01-21 04:59 AM
Hello Clive1,
Please see the attachment for my implementation. I set up two interrupts for the signal lines. One on GPIO PA0 connected to EXTI_Line0. The second on GPIO PC13 connected to EXTI_Line However, the first interrupt is working fine, but the second isn't. I want to be able to get input from both signal lines. how can I achieve this? ________________ Attachments : Switch_Interrupt_Implementation.docx : https://st--c.eu10.content.force.com/sfc/dist/version/download/?oid=00Db0000000YtG6&ids=0680X000006I0Tm&d=%2Fa%2F0X0000000biD%2F60tvLLytkJ8zmjsOqI5cYTAJbucx465frvnpUExwYOc&asPdf=false2016-01-21 09:29 AM
Probably want a more complete/consistent use of defines, or create a pin structure holding all the details,
void EXTI15_10_IRQHandler(void) {
if (EXTI_GetITStatus(EXTI_Line13) != RESET) {
if (GPIO_ReadOutputDataBit(GPIOA, GPIO_Pin_9)) // <<< SURELY THIS SHOULD BE PC.13 ???
{
GPIO_ResetBits(GPIOA, GPIO_Pin_9);
delay (500);
GPIO_SetBits(GPIOA, GPIO_Pin_9);
delay (500);
}
EXTI_ClearITPendingBit(EXTI_Line13);
}
}
2016-01-23 08:01 AM
2016-01-23 09:21 AM
And have we confirmed that the GPIOs transition as expected if you just loop polling the pins, and outputting via LEDs?