- This topic has 0 replies, 1 voice, and was last updated 9 years ago by .
Viewing 1 post (of 1 total)
Viewing 1 post (of 1 total)
- You must be logged in to reply to this topic.
|
Microcontroller › 8051 › Required information regarding frequency generation in LPC11xx
Hi All!!
As i'm very new to embedded domain of ARM lpc11xx, i'm going through
all the basics and the examples of the controller.
I need to generate 9hz for particular time duration[say for 20 secs/min],
and another freq of 12hz for 25secs/min.
Below is the part of the code where i'm getting the variable frequency of
9.4hz,7.6hz,12hz, whereas I have only assigned [1/1000us = 1khz],
void timer16_0_init(uint32_t delayInMs) //for frequency part
{
volatile unsigned int i;
LPC_SYSCON->SYSAHBCLKCTRL |= (1 << 7); //enables clock for 16-bit counter/timer 0
LPC_SYSCON->SYSAHBCLKCTRL |= (1 << ; //enables clock for 16-bit counter/timer 1
//PIO0_8
LPC_IOCON->PIO0_8 &= ~((1<<10)|(1<<5)|(3<<3)|(7<<0));
LPC_IOCON->PIO0_8 |= ((2<<3)|(2<<0));
LPC_TMR32B0->MR0 = 50 * ((SystemCoreClock/(LPC_TMR32B0->PR+1))/100);
LPC_TMR16B0->PR = 00;
LPC_TMR16B0->MR3 = 1000;//freq is generated at this point of match register
LPC_TMR16B0->MR0 = LPC_TMR16B0->MR3/4; //MAT0 1/4 low, 3/4 high
LPC_TMR16B0->PWMC = ((1<<0)|(1<<1));
LPC_TMR16B0->TCR = 1; //start timer 0//clock runs & tim dec
}
Kindly give me some hint on how to set the time duration for particular frequencies.
Thank you.