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

📄 ect_pwm.h

📁 移植到freescale 9s12系列单片机的uCOSII
💻 H
字号:
/****************************************************************************
*                                             COPYRIGHT (c) MOTOROLA 2003   
* FILE NAME: ect_pwm.h                                                   
*                                                                        
* PURPOSE: Basic header file for PWM from timer demonstration software.     		 							 
*                                                                                                                                                                                          
* AUTHOR: G.More  			LOCATION: EKB   	 LAST EDIT DATE: 25/03/03                                                                           
*
* UPDATE HISTORY                                                            
* REV      AUTHOR       DATE       DESCRIPTION OF CHANGE                    
* ---      ------      ---------   ---------------------                    
* 1.0	   G.More	   25/03/03	   Initial Coding                  	                                        
*                                                                           
******************************************************************************/                                                                        
/*===========================================================================*/
/* Motorola reserves the right to make changes without further notice to any */
/* product herein to improve reliability, function, or design. Motorola does */
/* not assume any  liability arising  out  of the  application or use of any */
/* product,  circuit, or software described herein;  neither  does it convey */
/* any license under its patent rights  nor the  rights of others.  Motorola */
/* products are not designed, intended,  or authorized for use as components */
/* in  systems  intended  for  surgical  implant  into  the  body, or  other */
/* applications intended to support life, or  for any  other application  in */
/* which the failure of the Motorola product  could create a situation where */
/* personal injury or death may occur. Should Buyer purchase or use Motorola */
/* products for any such intended  or unauthorized  application, Buyer shall */
/* indemnify and  hold  Motorola  and its officers, employees, subsidiaries, */
/* affiliates,  and distributors harmless against all claims costs, damages, */
/* and expenses, and reasonable  attorney  fees arising  out of, directly or */
/* indirectly,  any claim of personal injury  or death  associated with such */
/* unintended or unauthorized use, even if such claim alleges that  Motorola */
/* was negligent regarding the  design  or manufacture of the part. Motorola */
/* and the Motorola logo* are registered trademarks of Motorola Ltd.         */
/*****************************************************************************/

#include  <includes.h>

/*
*********************************************************************************************************
*                                            ERROR CODES
*********************************************************************************************************
*/
                           
#define  ECT_PWM_ERR_NONE   0                                           /* No error has occured                                     */
#define  ECT_PWM_ERR_CHA    1                                           /* Error. Invalid ECT channel specified (0-7) or (4-7) only */
#define  ECT_PWM_ERR_FRQ    2                                           /* Error. Desired PWM frequency is not possible             */
#define  ECT_PWM_ERR_RUN    3                                           /* Error. PWM is already running and must be stopped first  */
#define  ECT_PWM_ERR_OFF    4                                           /* Error. PWM is off and was expected to be running         */
#define  ECT_PWM_ERR_RESV   5                                           /* Error. Invalid channel specified. Channel 7 is reserved  */
#define  ECT_PWM_ERR_LAST   6                                           /* Error. Last != ECT_PWM_LAST_LOW or ECT_PWM_LAST_HIGH     */
#define  ECT_PWM_ERR_DUTY   7                                           /* Error. Invalid duty cycle. Must be between 0 and 100     */
#define  ECT_PWM_ERR_POL    8                                           /* Error. Invalid polarity specified. Must be 0 or 1        */

#define  ECT_PWM_POL_LOW    0                                           /* Pin polarity after PWM channel initialization            */
#define  ECT_PWM_POL_HIGH   1                                           /* Pin polarity after PWM channel initialization            */
#define  ECT_PWM_LAST_LOW   0                                           /* Pin polarity after PWM has stopped. See ECT_PWM_Dis()    */
#define  ECT_PWM_LAST_HIGH  1                                           /* Pin polarity after PWM has stopped. See ECT_PWM_Dis()    */

/*
*********************************************************************************************************
*                                            FUNCTION PROTOTYPES
*********************************************************************************************************
*/

CPU_INT08U  ECT_PWM_Init(CPU_INT08U  channel, CPU_INT08U  pol);
CPU_INT08U  ECT_PWM_CfgChannel(CPU_INT08U,CPU_INT08U,CPU_INT16U);
CPU_INT08U  ECT_PWM_Dis(CPU_INT08U  channel, CPU_INT08U last);

/*
*********************************************************************************************************
*                                            CONFIGURATION
*********************************************************************************************************
*/

#define  ECT_PWM_RESV_TC7   1                                           /* If 1, reserve ECT channel 7 for other purposes           */               
                                                                        /* This is to allow a dedicated ECT channel for timers      */
                                                                        /* and prevents the ECT_PWM_ISR() from modifying TC7        */
                                                                        /* related registers. If 0, ECT_PWM_ISR() will check TC7    */
                                                                        /* flag and output mode / level bits and adjust accordingly */

⌨️ 快捷键说明

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