Hi,
Below is the code where I'm getting the desired frequency by varying PR and MR3 registers... Like by going through the user manual got to know that FCLKOUT is 48 MHz, so to get the output of 3Hz need to assign values to prescaler & match register respectively i.e., 48 Mhz/4000*4000 = 3Hz.
So now my problem is how to generate the frequency continuously from 11hz to 13hz, or 3hz to 6hz with step variation of 0.5[i.e., 3hz,3.3hz,4hz,4.5hz etc..] Should I use timer for this operation or interrupts. Please do suggest me.
#include <LPC11xx.h> /* LPC11xx Peripheral Registers */ #include "system_LPC11xx.h" int main() { SystemInit(); LPC_SYSCON->SYSAHBCLKCTRL |= (1<<16) |(1<<6) | (1<<8) ; LPC_IOCON ->PIO1_9 |= (1 << 0); //PIN1_9 = CT16B1_MAT0 LPC_TMR16B1 ->MR0 = 1000; //50% Duty Cycle LPC_TMR16B1 ->PR = 2000;//for 12hz freq LPC_TMR16B1 ->MR3 = 2000;//for 12hz freq //Cycle Length LPC_TMR16B1 ->MCR |= (1 << 10); //TC Reset on MR3 Match LPC_TMR16B1 ->PWMC |= (1 << 0); //PWM Mode LPC_TMR16B1 ->TCR |= (1 << 0); //GO }
Regards, Angiey
How to control it by periodic timer interrupt?? Can you please explain..
"Can you please explain.."
Why should people on this forum waste time and explain?
Isn't it good enough that the manufacturer has already explained? Aren't all the reference implementations, the application notes, the datasheets and manuals covering this in great detail already?
If you think it's too much work for you to locate the documentation, then the open question is: mustn't it then be much, much, much too much work for other people on this forum to spend time doing your job?
It is, after all, only you - and maybe your teacher - who cares about your progress...
I'm not wasting your time, I too have gone through the user manual and still studying it to understand to implement it to my application.
So why don't you then ask a question related to what specific part you are stuck with, instead of asking open-ended wild-card questions?
The documentation already contains the information how to set up a periodic interrupt. So where are _you_ stuck, when _you_ try to run your already written code for a periodic interrupt?