#include "stm8s.h"
#include "hall.h"
#include "OLED12864.h"
#define STM8_FREQ_MHZ 16
#define PWM_FREQUENCY 16000
static const u16 hArrPwmVal = ((u16)((STM8_FREQ_MHZ * (u32)1000000)/PWM_FREQUENCY));
//PWM信号周期
//hArrPwmVal=1000
#define MINPWMPERCENT 10
#define MAXPWMPERCENT 90
#define MINVALUE MINPWMPERCENT*10
//hArrPwmVal=1000
//MINPWMPERCENT*hArrPwmVal/100简化为MINPWMPERCENT*10
#define MAXVALUE MAXPWMPERCENT*10
//MAXPWMPERCENT*hArrPwmVal/100简化MAXPWMPERCENT*10
unsigned char ADChan=0;
//0-9:采集电位器,10-19:采集电流
#define MCUVref 5000
//参考电压,mV为单位
#define RS (float)1
//电流的采样电阻,以欧为单位
#define AP 4
//电流放大增益
#define CC (float)MCUVref/1024/AP/RS
//电流计算常数,计算结果以MA为单位
unsigned int DIin=0;
//电流偏置转换值
#define ISh 180
//ma为单位,过流停机保护值
#define NumErr 30
//连续3次过流,作停机保护
unsigned char ErCount=0;//过流次数计算
此帖出自
小平头技术问答
开个玩笑,2^10 10位AD
一周热门 更多>