Important changes to forums and questions
All forums and questions are now archived. To start a new conversation or read the latest updates go to forums.mbed.com.
All forums and questions are now archived. To start a new conversation or read the latest updates go to forums.mbed.com.
So I have this code (smaller part of my program)
#include "mbed.h" volatile uint32_t systick=0; extern "C" void RIT_IRQHandler() { //update counter systick++; //clear flag LPC_RIT->RICTRL |= (1<<0); } int main(void) { //initialize timer LPC_SC->PCONP |= (1<<16); //power up RIT clock LPC_SC->PCLKSEL1 |= (3<<26); //run RIT clock by 12MHz (prescale by 8) LPC_RIT->RICOUNTER = 0; //set counter to zero LPC_RIT->RICOMPVAL = 12000000; //interrupt tick every second LPC_RIT->RICTRL |= (1<<1) | (1<<3); //enable timer clear on match //enable interrupt NVIC_EnableIRQ(RIT_IRQn); while(1) { wait(5.0); printf("%d\r\n", systick); } }interrupt works fine, only problem is, systick is incremented twice.
1st printf - systick=10
2st printf - systick=20
etc...
I don't see any reason why my program is behaving as such