8051-ELL库  beta 1.1.6
8051-ELL library API Document Center
STC8x_MPWM.h 文件参考
#include "ELL_CORE.h"
#include "STC8Gx_REG.h"
STC8x_MPWM.h 的引用(Include)关系图:
此图展示该文件直接或间接的被哪些文件引用了:

浏览源代码.

宏定义

#define PER_LIB_MCU_MUODEL   STC8Gx
 如果没有定义这个宏,默认为STC8Ax。 If the mirco is undefined,select to STC8Ax 更多...
 
#define PER_LIB_MPWM_CTRL   1
 如果没有定义这个宏,默认为0。 If the mirco is undefined,select to "0" 更多...
 
#define PER_LIB_MPWM_INIT_CTRL   1
 如果没有定义这个宏,默认为0。 If the mirco is undefined,select to "0" 更多...
 
#define PER_LIB_MPWM_NVIC_CTRL   1
 如果没有定义这个宏,默认为0。 If the mirco is undefined,select to "0" 更多...
 
#define PER_LIB_MPWM_WORK_CTRL   1
 如果没有定义这个宏,默认为0。 If the mirco is undefined,select to "0" 更多...
 

枚举

enum  MPWMCLKSrc_Type {
  MPWM_SCLK_DIV_1 = 0x00 , MPWM_SCLK_DIV_2 = 0x01 , MPWM_SCLK_DIV_3 = 0x02 , MPWM_SCLK_DIV_4 = 0x03 ,
  MPWM_SCLK_DIV_5 = 0x04 , MPWM_SCLK_DIV_6 = 0x05 , MPWM_SCLK_DIV_7 = 0x06 , MPWM_SCLK_DIV_8 = 0x07 ,
  MPWM_SCLK_DIV_9 = 0x08 , MPWM_SCLK_DIV_10 = 0x09 , MPWM_SCLK_DIV_11 = 0x0A , MPWM_SCLK_DIV_12 = 0x0B ,
  MPWM_SCLK_DIV_13 = 0x0C , MPWM_SCLK_DIV_14 = 0x0D , MPWM_SCLK_DIV_15 = 0x0E , MPWM_SCLK_DIV_16 = 0x0F ,
  MPWM_TIMER2_PULSE = 0x1F
}
 MPWM系统时钟选择枚举体。 更多...
 
enum  MPWMStartLevel_Type { MPWM_Start_Low_Level = 0x00 , MPWM_Start_High_Level = 0x01 }
 
enum  MPWMPort_Type {
  MPWM_Port_0 = 0x00 , MPWM_Port_1 = 0x01 , MPWM_Port_2 = 0x02 , MPWM_Port_3 = 0x03 ,
  MPWM_Port_4 = 0x04 , MPWM_Port_5 = 0x05
}
 
enum  MPWMChannel_Type {
  MPWM_Channel_0 = 0x00 , MPWM_Channel_1 = 0x01 , MPWM_Channel_2 = 0x02 , MPWM_Channel_3 = 0x03 ,
  MPWM_Channel_4 = 0x04 , MPWM_Channel_5 = 0x05 , MPWM_Channel_6 = 0x06 , MPWM_Channel_7 = 0x07
}
 

函数

FSCSTATE MPWMn_Port_Init (MPWMPort_Type port, MPWMCLKSrc_Type clkSrc, uint16_t period)
 PWM端口初始化函数。Init PWM port function. 更多...
 
FSCSTATE MPWMn_Channel_Init (MPWMPort_Type port, MPWMChannel_Type ch, MPWMStartLevel_Type level, uint16_t fValue, uint16_t sValue, BOOL run)
 PWM通道初始化函数。Init PWM channel function. 更多...
 
FSCSTATE MPWMn_Run (MPWMPort_Type port)
 指定PWM端口开始工作。Run specified PWM port. 更多...
 
FSCSTATE MPWMn_Stop (MPWMPort_Type port)
 指定PWM端口停止工作。Stop specified PWM port working. 更多...
 

宏定义说明

◆ PER_LIB_MCU_MUODEL

#define PER_LIB_MCU_MUODEL   STC8Gx

如果没有定义这个宏,默认为STC8Ax。 If the mirco is undefined,select to STC8Ax

◆ PER_LIB_MPWM_CTRL

#define PER_LIB_MPWM_CTRL   1

如果没有定义这个宏,默认为0。 If the mirco is undefined,select to "0"

◆ PER_LIB_MPWM_INIT_CTRL

#define PER_LIB_MPWM_INIT_CTRL   1

如果没有定义这个宏,默认为0。 If the mirco is undefined,select to "0"

◆ PER_LIB_MPWM_NVIC_CTRL

#define PER_LIB_MPWM_NVIC_CTRL   1

如果没有定义这个宏,默认为0。 If the mirco is undefined,select to "0"

◆ PER_LIB_MPWM_WORK_CTRL

#define PER_LIB_MPWM_WORK_CTRL   1

如果没有定义这个宏,默认为0。 If the mirco is undefined,select to "0"

枚举类型说明

◆ MPWMChannel_Type

枚举值
MPWM_Channel_0 
MPWM_Channel_1 
MPWM_Channel_2 
MPWM_Channel_3 
MPWM_Channel_4 
MPWM_Channel_5 
MPWM_Channel_6 
MPWM_Channel_7 

◆ MPWMCLKSrc_Type

MPWM系统时钟选择枚举体。

PWM clock source Enumerator.

枚举值
MPWM_SCLK_DIV_1 
MPWM_SCLK_DIV_2 
MPWM_SCLK_DIV_3 
MPWM_SCLK_DIV_4 
MPWM_SCLK_DIV_5 
MPWM_SCLK_DIV_6 
MPWM_SCLK_DIV_7 
MPWM_SCLK_DIV_8 
MPWM_SCLK_DIV_9 
MPWM_SCLK_DIV_10 
MPWM_SCLK_DIV_11 
MPWM_SCLK_DIV_12 
MPWM_SCLK_DIV_13 
MPWM_SCLK_DIV_14 
MPWM_SCLK_DIV_15 
MPWM_SCLK_DIV_16 
MPWM_TIMER2_PULSE 

◆ MPWMPort_Type

枚举值
MPWM_Port_0 
MPWM_Port_1 
MPWM_Port_2 
MPWM_Port_3 
MPWM_Port_4 
MPWM_Port_5 

◆ MPWMStartLevel_Type

枚举值
MPWM_Start_Low_Level 
MPWM_Start_High_Level 

函数说明

◆ MPWMn_Channel_Init()

FSCSTATE MPWMn_Channel_Init ( MPWMPort_Type  port,
MPWMChannel_Type  ch,
MPWMStartLevel_Type  level,
uint16_t  fValue,
uint16_t  sValue,
BOOL  run 
)

PWM通道初始化函数。Init PWM channel function.

初始化指定端口(0-5)的指定通道(0-7)。Init the specified port's channel (port from 0 to 5, channel from 0 to 7)

参数
[in]portPWM端口枚举体。PWM port enumerator.
[in]chPWM通道枚举体。PWM channel enumerator.
[in]levelPWM开始电平。PWM start level.
[in]fValue第一个电平翻转点。The value of the first reversal point.
[in]sValue第二个电平翻转点。The value of the second reversal point.
[in]run运行控制位。Run control bit.
返回
FSC_SUCCESS 返回成功。Return to success.
FSC_FAIL 返回失败。Return to fail.

◆ MPWMn_Port_Init()

FSCSTATE MPWMn_Port_Init ( MPWMPort_Type  port,
MPWMCLKSrc_Type  clkSrc,
uint16_t  period 
)

PWM端口初始化函数。Init PWM port function.

初始化指定端口(0-5)。Init the specified PWM port. (from 0 to 5)

参数
[in]portPWM端口枚举体。PWM port enumerator.
[in]clkSrcPWM时钟源。PWM clock source.
[in]periodPWM周期值(计数器重装载值)。PWM period value (counter reload value)
返回
FSC_SUCCESS 返回成功。Return to success.
FSC_FAIL 返回失败。Return to fail.

◆ MPWMn_Run()

FSCSTATE MPWMn_Run ( MPWMPort_Type  port)

指定PWM端口开始工作。Run specified PWM port.

指定PWM端口开始工作,输出PWM波形。Run specified PWM port. (Start PWM signal outputs)

参数
[in]portPWM端口枚举体。PWM port enumerator.
返回
FSC_SUCCESS 返回成功。Return to success.
FSC_FAIL 返回失败。Return to fail.

◆ MPWMn_Stop()

FSCSTATE MPWMn_Stop ( MPWMPort_Type  port)

指定PWM端口停止工作。Stop specified PWM port working.

指定PWM端口停止工作,停止输出PWM波形。Stop specified PWM port. (Stop PWM signal outputs)

参数
[in]portPWM端口枚举体。PWM port enumerator.
返回
FSC_SUCCESS 返回成功。Return to success.
FSC_FAIL 返回失败。Return to fail.