2015-05-22 09:54 AM
Hello i have some problem withSTM8S003k3 and IR recieve protocol. I set EXTI PORTB interrupt by RISE and FALL:
GPIO_DeInit(GPIOB);
GPIO_Init(GPIOB, GPIO_PIN_2, GPIO_MODE_IN_FL_IT);
disableInterrupts();
EXTI_DeInit();
EXTI_SetExtIntSensitivity(EXTI_PORT_GPIOB, EXTI_SENSITIVITY_RISE_FALL);
enableInterrupts();
So and interrupt routine looks like this:
INTERRUPT_HANDLER(EXTI_PORTB_IRQHandler, 4)
{
if
(IRLength==0)
{
TIM2_Cmd(ENABLE);
IRLength=1;
}
if
(IRLength==0xFFFF)
{
IRLength=0;
}
if
((IRLength>1)&&(IRLength!=0xFFFF))
{
TIM2_Cmd(DISABLE);
IRLength=0xFFFF;
}
}
The problem is that MCU after passing interrupt routine one time at once enter to it again without return to main( ); procedure. On this pin i hooked up TSSOP4840 IR reciever with pullup 10k to VCC 5V. And it is not IR reciever problem because i tryed make ''0'' to pull pin down to the ground with tweezers , and double entering repeats at this time too. Please help me with advice.