//****Sample motor speed command
//nVelocityReading=*((Uint16 *)&AdcMirror+ADCsequencerA+ADC_velCmd);
//Lowpass filer of y(n)=(k-1)/K*y(n-1)+x(n) --> y(n)=k*x(n) at steady state
lVelocity = (lVelocity*(nVelocityFltVal1-1))/nVelocityFltVal1 + nVelocityReading;
nVelocityCMD = lVelocity/nVelocityFltVal1*(nVelocity_Max-nVelocity_Min)/nVelocity_scal+nVelocity_Min; //Obtained filtered velocity command with offset ???????????
#if !velCmdsrc
nVelocityCMD = nVelocityCAN/2; //for debugging,also disable the assign line in isr
#endif
nVelocityCMD = lVelocity/nVelocityFltVal1*(nVelocity_Max-nVelocity_Min)/nVelocity_scal+nVelocity_Min; //Obtained filtered velocity command with offset
这是个什么函数呀 |