adc_pwm_module.c
来自「zigbee 飞思卡尔 音频传输 基于ucos的所有源码」· C语言 代码 · 共 31 行
C
31 行
#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 + =
减小字号Ctrl + -
显示快捷键?