using SysTick_Handler in an interrupt

Status
Not open for further replies.

h.galeh

Member level 3
Joined
Apr 16, 2008
Messages
66
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,286
Location
Tehran, Iran, Iran
Visit site
Activity points
1,690
unfortunately Interrupts occur very bad . I use gpio0.0 interrupt to switch led's on and off but switching time is so little . the interrupt occurs multiple times once I connect wire to ground
to solve it I used for(0-> 1000000) but it didn't wait resolve the problem
I used SysTick_Handler too . but Wait() function was infinite time . how should I solve it . tell me whats the problem with my solutions?
Code:
#include "lpc17xx.h"
#include "gpio.h"
#include "lpc17xx_pinsel.h"
uint32_t sysTicks=0;
uint32_t m;
__irq void SysTick_Handler(){
  sysTicks++;
}
void Wait(uint32_t ms){
  uint32_t first=sysTicks;
  while((sysTicks-first)<ms);
}
__irq void EINT3_IRQHandler(){
   GPIOINT->CLR00=1;
   GPIO2->FIOPIN0=~GPIO2->FIOPIN0;
   //for(uint32_t i=0;i<100000;i++);
   Wait(10);
}
void main(){
  SystemInit();
  SystemCoreClockUpdate();
  SysTick_Config(SystemCoreClock/1000);
  GPIO2->FIODIR0=0xff;
  GPIOINT->En0R0=1;
  NVIC_EnableIRQ(EINT3_IRQn);  
  while(1){
 
  }
}
 

Status
Not open for further replies.

Similar threads

Cookies are required to use this site. You must accept them to continue using the site. Learn more…