lpcware

How to generate the frequency from 9hz to 12 hz with the step size of 0.1hz

Discussion created by lpcware Employee on Jun 15, 2016
Latest reply on Jun 18, 2016 by lpcware
Content originally posted in LPCWare by angiey on Tue Mar 15 05:06:21 MST 2016
Hello Everyone!!

I'm using LPC1114 development board, so as of now getting 1hz frequency,
Below is the part of the code:
By varying the prescaler register, i'm getting different frequency by increasing
the prescaler with step size of 50[i.e., 12000,12050,12100 etc].

But how to continuously get the frequency from 9 hz to 11hz with a step of 1hz with some time delay??
Kindly guide me how to proceed.

#include "LPC11xx.h"          
#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 = 2000;                   //50% Duty Cycle
LPC_TMR16B1 ->PR = 12000;
LPC_TMR16B1 ->MR3 = 4000;                   //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
}


Thanks,
Angiey.

Outcomes