We are running a survey to help us improve the experience for all of our members. If you see the survey appear, please take the time to tell us about your experience if you can.
Hi Friends,
presently I'm using the micro controller LPC1114FBD48 of ARM family.
now i'm generating the frequency in the range of 9.6hz to 12hz using timer registers and interrupts. now i had generated the 9.6 hz but remaining frequencies are passing through interrupt.
please guide me to move further and below is my code.
oid TIMER16_0_IRQHandler(void) { if(LPC_TMR16B0->IR & (1<<4)) //capture interrupt { if(LPC_TMR16B0->CCR ==5){ LPC_TMR16B0->TC = 0; //reset timer LPC_TMR16B0->CCR =6; } else{ period_time = LPC_TMR16B0->CR0; //read time LPC_TMR16B0->CCR =5; } LPC_TMR16B0->IR |= (1<<4); //reset capture interrupt } }
int main(void) { SystemInit(); LPC_SYSCON->SYSAHBCLKCTRL |= (1<<7);//enable clock CT16B0 //init io CT16B0_CAP0 LPC_IOCON->PIO0_2 = (1<<1)|(2<<3); //CT16B0_CAP0 & pullupCAP0FE LPC_TMR16B0->CTCR = 0; //use timer mode LPC_TMR16B0->CCR = 5; //rising LPC_TMR16B0->PR = 47; //prescaler 48 NVIC_EnableIRQ(TIMER_16_0_IRQn); //enable interrupt LPC_TMR16B0->TCR = 1; //and run timer LPC_IOCON->PIO1_9 |= (1 << 0); // Pin no 17 = CT16B1_MAT0(checking out put) LPC_TMR16B1->MR0 = 1000;//3500;//11200; // 50% Duty Cycle LPC_TMR16B1 ->MR3 = 2000; LPC_TMR16B1 ->PR=4000; }