- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi Sir ,
In the project attched , the clock frequency is 4MHz .If I want change the frequency from 4MHz to 1MHz using code ,not the component,how
shall I do ?
Thanks.
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi Xiaoping,
I have created a simple project to test the function, and add it in attached. The project only shows you how to change the TCPWM component clock.
Hope it can be helpful for you.
#include "project.h"
int main(void)
{
CyGlobalIntEnable; /* Enable global interrupts. */
/* Place your initialization/startup code here (e.g. MyInst_Start()) */
TIMER_Start();
for(;;)
{
CyDelay(1000);
TIMER_Stop();
wodada_Stop();
//wodada_SetDividerRegister(1000,0); //把TCPWM模块的clock从4KHz 改成16KHz.
CY_SET_REG32(CYREG_PERI_DIV_16_CTL0,0x3E800);
wodada_Start();
TIMER_Start();
while(1);
// wodada_StartEx();
/* Place your application code here. */
}
}
只要你原来可以让timer 跑起来,现在改变clock,只要配置寄存器:CYREG_PERI_DIV_16_CTL0
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi Xiaoping,
You add an empty project here.
Please attached it again.
Could you comment which clock you want to modify and tell us why you want to do it?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi Xiaoping,
I have created a simple project to test the function, and add it in attached. The project only shows you how to change the TCPWM component clock.
Hope it can be helpful for you.
#include "project.h"
int main(void)
{
CyGlobalIntEnable; /* Enable global interrupts. */
/* Place your initialization/startup code here (e.g. MyInst_Start()) */
TIMER_Start();
for(;;)
{
CyDelay(1000);
TIMER_Stop();
wodada_Stop();
//wodada_SetDividerRegister(1000,0); //把TCPWM模块的clock从4KHz 改成16KHz.
CY_SET_REG32(CYREG_PERI_DIV_16_CTL0,0x3E800);
wodada_Start();
TIMER_Start();
while(1);
// wodada_StartEx();
/* Place your application code here. */
}
}
只要你原来可以让timer 跑起来,现在改变clock,只要配置寄存器:CYREG_PERI_DIV_16_CTL0