移动电源频率设置
//PWM配置 300k 0x00 0xef
#define PWM_X_PERDH 0x00
#define PWM_X_PERDL 0xef
#define PWM_X_PERDH_PHASEDELY 0x00
#define PWM_X_PERDL_PHASEDELY 0xef
//300k频率下的值str
#define CHARGE_FULL_MAX_SCALE 226
#define CHARGE12V_START_SCALE 184
#define CHARGE12V_MAX_SCALE 184
#define CHARGE12V_MINI_SCALE 155
#define CHARGE12V_DEADLINE 5
#define CHARGE9V_START_SCALE 173
#define CHARGE9V_MAX_SCALE 173
#define CHARGE9V_MINI_SCALE 120
#define CHARGE9V_DEADLINE 5
#define CHARGE5V_START_SCALE 88
#define CHARGE5V_MAX_SCALE 88
#define CHARGE5V_MINI_SCALE 7
#define CHARGE5V_DEADLINE 5
#define DISCHARGE_START_SCALE 22
#define DISCHARGE_MAX_SCALE 150
#define DISCHARGE_MINI_SCALE 22
#define DISCHARGE_DEADLINE 17
//end
//
//PWM配置 100k 0x02 0xcf -
#define PWM_X_PERDH 0x02
#define PWM_X_PERDL 0xcf
#define PWM_X_PERDH_PHASEDELY 0x00
#define PWM_X_PERDL_PHASEDELY 0xef
/*//100kHz周期值719下对应的占空比
#define CHARGE_FULL_MAX_SCALE 681
#define CHARGE12V_START_SCALE 555 //逐渐减小
#define CHARGE12V_MAX_SCALE 555 //
#define CHARGE12V_MINI_SCALE 465
#define CHARGE12V_DEADLINE 15
#define CHARGE9V_START_SCALE 520 //逐渐减小
#define CHARGE9V_MAX_SCALE 520 //
#define CHARGE9V_MINI_SCALE 360
#define CHARGE9V_DEADLINE 15
#define CHARGE5V_START_SCALE 266
#define CHARGE5V_MAX_SCALE 266 //
#define CHARGE5V_MINI_SCALE 21
#define CHARGE5V_DEADLINE 15
#define DISCHARGE_START_SCALE 66//逐渐增大
#define DISCHARGE_MAX_SCALE 450
#define DISCHARGE_MINI_SCALE 65
#define DISCHARGE_DEADLINE 50
//ovp设置 1/6比例
//过压保护 充电13V PA0输入
OVPEN = 0x0f;//pwm0 A,B两路硬件刹车打开+3个滤波
OVPMUX = 0x37;//外部参考电压+比较点 对应13V
//过压保护 充电10V PA0输入
OVPEN = 0x0f;//pwm0 A,B两路硬件刹车打开+3个滤波
OVPMUX = 0x2A;//外部参考电压+比较点 对应10V
//过压保护 放电6V PA0输入
OVPEN = 0x0f;//pwm0 A,B两路硬件刹车打开+3个滤波
OVPMUX = 0x19;//外部参考电压+比较点 对应6V