欢迎来到天天文库
浏览记录
ID:12538352
大小:43.50 KB
页数:5页
时间:2018-07-17
《电动车程序助力功能》由会员上传分享,免费在线阅读,更多相关内容在教育资源-天天文库。
1、//****************************************************************************//@Copyright(C)2010-AllRightsReserved//@FilenameMixPower.c//@ProjectBLDC.stvd//----------------------------------------------------------------------------//@ControllerSTM8S903K3////@Com
2、pilerCXSTM8_16K////@Description此ä?函¡¥数ºy包㨹含?助¨²力¢
3、处ä
4、理¤¨ª功
5、能¨¹模¡ê块¨¦////----------------------------------------------------------------------------//EditInformation////@Creatorziyan////@Date2/17/201114:17:32////@Ver////------------------------------------------
6、----------------------------------//History////[Date][Editor][Discription]//////**********************************************************#include"..IncIncludes.h"#ifdef_EN_MIX_POWERvolatileBYTEU8Global_MixPower;#defineSTART_PERIOD235//(INT16U)(350*5)//244,thest
7、artpointofhalfmotordrive:235#defineSTOP_PERIOD250//(INT16U)(375*5)//253,thestoppointofhalfmotordirve:250#defineMIN_PERIOD80//(36*3)//33/*36*//*(48),42for1:1.5speed2005-06-05secondspeedrampcontrol*/#defineMAX_CNTSTOP_PERIOD#defineMIN_CNTMIN_PERIOD#defineMAX_DUTYPWM
8、_PERIOD#defineMIN_DUTY15#defineMAX_MIX_POWERMAX_DUTY#defineMIN_MIX_POWERMIN_DUTY//y=-kx+b#definek(MAX_DUTY-MIN_DUTY)/(START_PERIOD-MIN_PERIOD)//(256-15)/(235-80)=48/31#definebk*START_PERIOD+MIN_DUTY//48/31*235+15=379#defineLIM_PERIOD(STOP_PERIOD+0x05)//(STOP_PERIO
9、D+0x10)static_BoolfPortState;static_BoolfCntStarted;static_BoolfTurnForward;//正y转Áastatic_BoolfMixPowerUpdate;static_BoolfPortStateChanged;staticBYTEU8LowTime;staticBYTEU8AvrPeriod,U8CurrentPeriod,U8LastPeriod;/*****************************************************
10、*************************@fn:voidInitMixPort(void)*@brief:*@Param:nonel*@Return:none*Note:*SubModula:none******************************************************************************/voidInitMixPort(void);voidProcMixPort(void);voidProcMixPower(void);voidInitMixPo
11、rt(void){U8Global_MixPower=0;fPortState=1;fCntStarted=0;fTurnForward=0;U8AvrPeriod=LIM_PERIOD;U8LastPeriod=LIM_PERIOD;}/********************************
此文档下载收益归作者所有