⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 pwm.c

📁 freescale最新的16位单片机
💻 C
字号:
/******************************************************************************
*
* Freescale Semiconductor Inc.
* (c) Copyright 2004-2005 Freescale Semiconductor, Inc.
* ALL RIGHTS RESERVED.
*
***************************************************************************//*!
*
* @file      pwm.c
*
* @author    R89994
* 
* @version   1.0.6.0
* 
* @date      Jul-27-2006
* 
* @brief     Setting of periphery PWM
*
*******************************************************************************/

#include "main.h"
#include "pwm.h"


/******************************************************************************
* Module            : void SetupPWM(void)
* Description       : initialization PWM module
* Global Data       : none
* Static Global Data: none
* Returns           : none
* Arguments         : none
* Special Issues    : none
******************************************************************************/

void SetupPWM(void)
{
    PWMPOL    = 0x20;		    // polarity
    PWMCLK    = 0x00;		    // clock
    PWMPRCLK  = 0x60;	      // clock prescaler
    PWMCAE    = 0x00;       // no center aligned
    PWMCTL    = 0x18;       // control register
    PWMSCLA   = 0x00;       // scale A register
    PWMSCLB   = 0x00;       // scale B register
    PWMSDN    = 0x00;       // shutdown register for channel 7   

    PWME_PWME6 = 1;         // PWM6 Enabled 
    PWME_PWME7 = 1;         // PWM7 Enabled 
      
    PWMCNT6 = 0x00;    
    PWMPER6 = 0xFF;    

    PWMCNT7 = 0x00;    
    PWMPER7 = 0xFF;    
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -