Files

95 lines
2.6 KiB
C
Raw Permalink Normal View History

/*---------------------------------------------------------------------*/
/* --- STC MCU Limited ------------------------------------------------*/
/* --- STC 1T Series MCU Demo Programme -------------------------------*/
/* --- Mobile: (86)13922805190 ----------------------------------------*/
/* --- Fax: 86-0513-55012956,55012947,55012969 ------------------------*/
/* --- Tel: 86-0513-55012928,55012929,55012966 ------------------------*/
/* --- Web: www.STCMCU.com --------------------------------------------*/
/* --- Web: www.STCMCUDATA.com ---------------------------------------*/
/* --- QQ: 800003751 -------------------------------------------------*/
/* <20><><EFBFBD><EFBFBD>Ҫ<EFBFBD>ڳ<EFBFBD><DAB3><EFBFBD><EFBFBD><EFBFBD>ʹ<EFBFBD>ô˴<C3B4><CBB4><EFBFBD>,<2C><><EFBFBD>ڳ<EFBFBD><DAB3><EFBFBD><EFBFBD><EFBFBD>ע<EFBFBD><D7A2>ʹ<EFBFBD><CAB9><EFBFBD><EFBFBD>STC<54><43><EFBFBD><EFBFBD><EFBFBD>ϼ<EFBFBD><CFBC><EFBFBD><EFBFBD><EFBFBD> */
/*---------------------------------------------------------------------*/
#ifndef __PWM15BIT_H
#define __PWM15BIT_H
#include "config.h"
#define PWM0 0
#define PWM1 1
#define PWM2 2
#define PWM3 3
#define PWM4 4
#define PWM5 5
#define PWM00 0
#define PWM01 1
#define PWM02 2
#define PWM03 3
#define PWM04 4
#define PWM05 5
#define PWM06 6
#define PWM07 7
#define PWM10 8
#define PWM11 9
#define PWM12 10
#define PWM13 11
#define PWM14 12
#define PWM15 13
#define PWM16 14
#define PWM17 15
#define PWM20 16
#define PWM21 17
#define PWM22 18
#define PWM23 19
#define PWM24 20
#define PWM25 21
#define PWM26 22
#define PWM27 23
#define PWM30 24
#define PWM31 25
#define PWM32 26
#define PWM33 27
#define PWM34 28
#define PWM35 29
#define PWM36 30
#define PWM37 31
#define PWM40 32
#define PWM41 33
#define PWM42 34
#define PWM43 35
#define PWM44 36
#define PWM45 37
#define PWM46 38
#define PWM47 39
#define PWM50 40
#define PWM51 41
#define PWM52 42
#define PWM53 43
#define PWM54 44
#define PWM55 45
#define PWM56 46
#define PWM57 47
#define PWMn_CLK_SYS 0
#define PWMn_CLK_TM2 1
typedef struct
{
u8 PWM_Enable; //PWMʹ<4D><CAB9>, ENABLE, DISABLE
u8 PWM_Interrupt; //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ж<EFBFBD>ʹ<EFBFBD><CAB9>, ENABLE, DISABLE
u8 PWM_Counter; //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʹ<EFBFBD><CAB9>, ENABLE, DISABLE
u8 PWM_Clock_Sel; //ʱ<><CAB1>Դѡ<D4B4><D1A1>, PWMn_CLK_SYS, PWMn_CLK_TM2
u8 PWM_Clock_PS; //ϵͳʱ<CDB3>ӷ<EFBFBD>Ƶ<EFBFBD><C6B5><EFBFBD><EFBFBD>, 0~15
u16 PWM_Period; //PWM<57><4D><EFBFBD><EFBFBD>, 0~0x7fff
} PWM15_InitTypeDef;
void PWM15_Init(u8 PWM_id, PWM15_InitTypeDef *PWMx);
u8 PWMChannelCtrl(u8 PWM_id, u8 pwm_eno, u8 pwm_ini, u8 pwm_eni, u8 pwm_ent2i, u8 pwm_ent1i);
u8 PWM15Duty(u8 PWM_id,u16 dutyL);
u8 PWMLevelSet(u8 PWM_id, u8 pwm_hldl, u8 pwm_hldh);
u8 qPWM15Duty(u8 PWM_id,u16 dutyL, u16 dutyH);
#endif