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

📄 pwm_a.c

📁 菲斯卡尔无传感器无刷控制方案。具体说明文档和程序都在压缩包内。
💻 C
字号:
/** ###################################################################
**     THIS BEAN MODULE IS GENERATED BY THE TOOL. DO NOT MODIFY IT.
**     Filename  : PWM_A.C
**     Project   : bldc_zc_8013
**     Processor : 56F8013VFAE
**     Beantype  : Init_PWM
**     Version   : Bean 01.199, Driver 01.14, CPU db: 2.87.068
**     Compiler  : Metrowerks DSP C Compiler
**     Date/Time : 23.5.2005, 11:21
**     Abstract  :
**         This "Init_PWM" Peripheral Inspector implements the
**         Puls Width Modulator module (PWM), basic initialization
**         and settings.
**     Settings  :
**         PWM module                  : PWM_Timer
**
**         Clock setting
**             PWM prescaler           : 1
**             Counter modulo          : 1600
**             Dead time value         : 32
**             Reload frequency        : 1
**             PWM frequency           : 20 kHz
**             PWM period              : 50 us
**             PWM deadtime            : 1 us
**
**         Interrupts
**             Reload interrupt        : Enabled
**             ISR name                : IsrPWMReload
**             Interrupt name          : INT_PWM_Reload
**             Priority                : 1

**
**             ISR name                : IsrPWMFault
**             Interrupt name          : INT_PWM_Fault
**             Priority                : 1
**
**         HW acceleration             : Enabled
**             Load mode               : Write to value reg 0 also writes 1-5
**             Swap PWM channels 0 & 1 : no
**             Swap PWM channels 2 & 3 : no
**             Swap PWM channels 4 & 5 : no
**
**         Correction
**             Method                  : Manual correction or no correction
**             Internal current ctrl.0 : IS pin
**             Internal current ctrl.1 : IS pin
**             Internal current ctrl.2 : IS pin
**
**         Channel settings
**             Alignment               : Edge-aligned mode
**             Channels 0-1
**               Mode of PWM           : Independent
**               Top output polarity   : Positive
**               Bottom output polar.  : Positive
**             Channels 2-3
**               Mode of PWM channels  : Independent
**               Top output polarity   : Positive
**               Bottom output polar.  : Positive
**             Channels 4-5
**               Mode of PWM channels  : Independent
**               Top output polarity   : Positive
**               Bottom output polar.  : Positive
**
**         Write protect               : no
**         Output pads                 : Disabled
**         Half cycle reload           : no
**
**         Channel 0
**             PWM Pin                 : GPIOA0_PWM0
**             Enable software control : no
**             Channel masked          : no
**
**         Channel 1
**             PWM Pin                 : GPIOA1_PWM1
**             Enable software control : no
**             Channel masked          : no
**
**         Channel 2
**             PWM Pin                 : GPIOA2_PWM2
**             Enable software control : no
**             Channel masked          : no
**
**         Channel 3
**             PWM Pin                 : GPIOA3_PWM3
**             Enable software control : no
**             Channel masked          : no
**
**         Channel 4
**             PWM Pin                 : GPIOA4_PWM4_FAULT1_T2
**             Enable software control : no
**             Channel masked          : no
**
**         Channel 5
**             PWM Pin                 : GPIOA5_PWM5_FAULT2_T3
**             Enable software control : no
**             Channel masked          : no
**     Contents  :
**         Init - void PWM_A_Init(void);
**
**     (c) Copyright UNIS, spol. s r.o. 1997-2004
**     UNIS, spol. s r.o.
**     Jundrovska 33
**     624 00 Brno
**     Czech Republic
**     http      : www.processorexpert.com
**     mail      : info@processorexpert.com
** ###################################################################*/

/* MODULE PWM_A. */

#include "PWM_A.h"

/*
** ###################################################################
**
**  The following method(s) must be implemented by the user in one
**  of the following modules:
**
**    #pragma interrupt
**    void IsrPWMReload(void)
**
**    #pragma interrupt
**    void IsrPWMFault(void)
**
**  Modules:
**       bldc_zc_8013
**
** ###################################################################
*/

/*
** ===================================================================
**     Method      :  PWM_A_Init (bean Init_PWM)
**
**     Description :
**         This method initializes registers of the PWM module
**         according to this Peripheral Initialization Bean settings.
**         Call this method in the user code to initialize the
**         module. By default, the method is called by PE
**         automatically; see "Call Init method" property of the
**         bean for more details.
**     Parameters  : None
**     Returns     : Nothing
** ===================================================================
*/
void PWM_A_Init(void)
{
  /* PWM_PMFCTL: ??=0,??=0,??=0,??=0,??=0,??=0,??=0,??=0,FIE3=0,FMODE3=0,FIE2=0,FMODE2=0,FIE1=0,FMODE1=0,FIE0=1,FMODE0=0 */
  setReg16(PWM_PMFCTL,C_PWM_A_reg_PWM_PMFCTL); 
  /* PWM_PWMCM: ??=0,CM=0x0640 */
  setReg16(PWM_PWMCM,C_PWM_A_reg_PWM_PWMCM); 
  /* PWM_PWMVAL0: VAL=0 */
  setReg16(PWM_PWMVAL0,C_PWM_A_reg_PWM_PWMVAL0); 
  /* PWM_PWMVAL1: VAL=0 */
  setReg16(PWM_PWMVAL1,C_PWM_A_reg_PWM_PWMVAL1); 
  /* PWM_PWMVAL2: VAL=0 */
  setReg16(PWM_PWMVAL2,C_PWM_A_reg_PWM_PWMVAL2); 
  /* PWM_PWMVAL3: VAL=0 */
  setReg16(PWM_PWMVAL3,C_PWM_A_reg_PWM_PWMVAL3); 
  /* PWM_PWMVAL4: VAL=0 */
  setReg16(PWM_PWMVAL4,C_PWM_A_reg_PWM_PWMVAL4); 
  /* PWM_PWMVAL5: VAL=0 */
  setReg16(PWM_PWMVAL5,C_PWM_A_reg_PWM_PWMVAL5); 
  /* PWM_PMDISMAP1: DISMAP=0 */
  setReg16(PWM_PMDISMAP1,C_PWM_A_reg_PWM_PMDISMAP1); 
  /* PWM_PMDISMAP2: ??=0,??=0,??=0,??=0,??=0,??=0,??=0,??=0,DISMAP=0 */
  setReg16(PWM_PMDISMAP2,C_PWM_A_reg_PWM_PMDISMAP2); 
  /* PWM_PMDEADTM0: ??=0,??=0,??=0,??=0,PWMDT0=0x20 */
  setReg16(PWM_PMDEADTM0,C_PWM_A_reg_PWM_PMDEADTM0); 
  /* PWM_PMDEADTM1: ??=0,??=0,??=0,??=0,PWMDT1=0x20 */
  setReg16(PWM_PMDEADTM1,C_PWM_A_reg_PWM_PMDEADTM1); 
  setRegBitVal(PWM_PMCCR,ENHA ,C_PWM_A_reg_PWM_PMCCR_bit_ENHA ); /* Enable HW Acceleration */
  /* PWM_PMCCR: ENHA=1,nBX=1,MSK=0,??=0,??=0,VLMODE=1,??=0,SWP45=0,SWP23=0,SWP01=0 */
  setReg16(PWM_PMCCR,C_PWM_A_reg_PWM_PMCCR); 
  /* PWM_PMCFG: ??=0,DBG_EN=0,WAIT_EN=0,EDG=1,??=0,TOPNEG45=0,TOPNEG23=0,TOPNEG01=0,??=0,BOTNEG45=0,BOTNEG23=0,BOTNEG01=0,INDEP45=1,INDEP23=1,INDEP01=1,WP=0 */
  setReg16(PWM_PMCFG,C_PWM_A_reg_PWM_PMCFG); 
  /* PWM_PMOUT: PAD_EN=0,??=0,OUTCTL=0,??=0,??=0,OUT=0 */
  setReg16(PWM_PMOUT,C_PWM_A_reg_PWM_PMOUT); 
  /* PWM_PMSRC: ??=0,??=0,CINV5=0,CINV4=0,CINV3=0,CINV2=0,CINV1=0,CINV0=0,SRC2=0,SRC1=0,SRC0=0 */
  setReg16(PWM_PMSRC,C_PWM_A_reg_PWM_PMSRC); 
  /* PWM_PMCTL: LDFQ=0,HALF=0,IPOL2=0,IPOL1=0,IPOL0=0,PRSC=0,PWMRIE=1,PWMF=0,??=0,??=0,LDOK=0,PWMEN=0 */
  setReg16(PWM_PMCTL,C_PWM_A_reg_PWM_PMCTL); 
  setRegBitVal(PWM_PMCTL,LDOK,C_PWM_A_reg_PWM_PMCTL_bit_LDOK); /* set LDOK bit */
  setRegBitVal(PWM_PMCTL,PWMEN,C_PWM_A_reg_PWM_PMCTL_bit_PWMEN); /* set PWMEN bit */
}

/* END PWM_A. */

/*
** ###################################################################
**
**     This file was created by UNIS Processor Expert 2.96 [03.65]
**     for the Freescale 56800 series of microcontrollers.
**
** ###################################################################
*/

⌨️ 快捷键说明

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