📄 adc_pwm_module.c
字号:
#include "Adc_Pwm_Module.h"
OS_STK AppTaskAudioInOutStk[256]; // The TaskStack for the PwmTask
//static uint32 da = 0;
extern int index_cpt;
/****************************************************
Fuction: initialize the Pwm1 Control Register
NOTE: There are at least two Errors in the pwm.h
One is "#define MCF_PWM_PWMDTY1 (*(vuint8 *)(&__IPSBAR[0x1B0019]))"
the right Address is (*(vuint8 *)(&__IPSBAR[0x1B0015]))
Two is "#define MCF_PWM_PWMCNT1 (*(vuint8 *)(&__IPSBAR[0x1B000D]))"
the right Address is (*(vuint8 *)(&__IPSBAR[0x1B001D]))
*****************************************************/
void ADC_InitPwmRegister()
{
printf("Begin to Initializing PWM1 Register\n");
//deal with PWM1
MCF_GPIO_DDRTD = MCF_GPIO_DDRTD_DDRTD0; // Set the direction of PTD0 output
MCF_GPIO_PTDPAR |= MCF_GPIO_PTDPAR_PTDPAR0;// Select the IO function as pwm1
MCF_PWM_PWME &= ~MCF_PWM_PWME_PWME1; // Disable the Pwm Chanl 1
MCF_PWM_PWMPOL |= MCF_PWM_PWMPOL_PPOL1; // Begin low level
/************************************************************************/
//change PWM frequency here. now the frequency is 160kHz
//refer to "MCF5213 ColdFire
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -