This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

External Interrupt & RTX-166 problems

Hello!
I'm using DIPmodule-164 (C164) + RTX-166.
And I have strange problem with external interrupt.
You can see two examples below.
First is working fine, but second one cause system to crash (it might crash after 10 seconds or after 10 minutes..) And even internal watchdog didn't reboot system after that.

Do you have any ideas what might be wrong?


volatile unsigned int rtc_ticks_count;
volatile unsigned int rtc_all_ticks_count;

//----------------------------------------
// 1st - external interrupt EX3IN
//----------------------------------------
void itr_interrupt (void) interrupt 27 using MY_BANK0{
  IEN = 0;
  LED_DO3 = ~LED_DO3;
  rtc_ticks_count++;
  rtc_all_ticks_count++;
  if (rtc_ticks_count == 5){
    rtc_ticks_count = 0;
    printf ("interrupt!\n");
    LED_DO2 = ~LED_DO2;
  }
  IEN = 1;
}


//------------------------------------
// 2nd - external interrupt EX3IN (RTX task)
//------------------------------------
static void RTC_interrupt_listener (void) _task_ TASK_RTC_INT_LISTENER _priority_ 4 using aaaaa
{
  unsigned char c;
  unsigned char tmp_byte;

// attach serial interrupt to itself
  if (os_attach_interrupt(os_running_task_id(), 27) != 0){
	printf ("error initial interrupt\n");
  }
  for(;;){
    os_wait_interrupt(NILCARD);
    LED_DO3 = ~LED_DO3;
    rtc_ticks_count++;
    rtc_all_ticks_count++;
    if (rtc_ticks_count == 5){
      rtc_ticks_count = 0;
      printf ("interrupt!\n");
      LED_DO2 = ~LED_DO2;
    }
  }
}

BR,
Ilya

0