freepeople性欧美熟妇, 色戒完整版无删减158分钟hd, 无码精品国产vα在线观看DVD, 丰满少妇伦精品无码专区在线观看,艾栗栗与纹身男宾馆3p50分钟,国产AV片在线观看,黑人与美女高潮,18岁女RAPPERDISSSUBS,国产手机在机看影片

正文內(nèi)容

基于飛思卡爾16位單片機(jī)電磁型智能小車的設(shè)計(jì)-資料下載頁(yè)

2025-06-22 02:25本頁(yè)面
  

【正文】 和實(shí)踐能力,也使我認(rèn)識(shí)到只有通過(guò)不斷的探討改進(jìn)才能真正獲得能力上的提升,在失敗的時(shí)候如果不能克服困難、抵住壓力,那么任何設(shè)計(jì)都進(jìn)毫無(wú)進(jìn)展。 由于時(shí)間的限制,仍有許多地方需要完善。對(duì)于那些不足之處還望老師多多包涵。 附錄 程序代碼void SetMotorVoltage(int nLeftVol, int nRightVol) {short nPeriod。nPeriod = (short)getReg(PWM_PWMCM)。if(nLeftVol 0) {setReg(PWM_PWMVAL0, 0)。nLeftVol = mult(nLeftVol, nPeriod)。setReg(PWM_PWMVAL1, nLeftVol)。} else {nLeftVol = nLeftVol。setReg(PWM_PWMVAL1, 0)。nLeftVol = mult(nLeftVol, nPeriod)。setReg(PWM_PWMVAL0, nLeftVol)。}if(nRightVol 0) {setReg(PWM_PWMVAL3, 0)。nRightVol = mult(nRightVol, nPeriod)。setReg(PWM_PWMVAL2, nRightVol)。} else {setReg(PWM_PWMVAL2, 0)。nRightVol = nRightVol。nRightVol = mult(nRightVol, nPeriod)。setReg(PWM_PWMVAL3, nRightVol)。} } (電機(jī)PWM 輸出)void MotorSpeedOut(void) {int nLeftVal, nRightVal。nLeftVal = g_nLeftMotorOut。nRightVal = g_nRightMotorOut。if(nLeftVal 0) nLeftVal += MOTOR_OUT_DEAD_VAL。else if(nLeftVal 0) nLeftVal = MOTOR_OUT_DEAD_VAL。if(nRightVal 0) nRightVal += MOTOR_OUT_DEAD_VAL。else if(nRightVal 0) nRightVal = MOTOR_OUT_DEAD_VAL。if(nLeftVal MOTOR_OUT_MAX) nLeftVal = MOTOR_OUT_MAX。if(nLeftVal MOTOR_OUT_MIN) nLeftVal = MOTOR_OUT_MIN。if(nRightVal MOTOR_OUT_MAX) nRightVal = MOTOR_OUT_MAX。if(nRightVal MOTOR_OUT_MIN) nRightVal = MOTOR_OUT_MIN。nLeftVal = nLeftVal 4。nRightVal = nRightVal 4。MOTOR_SET(nLeftVal, nRightVal)。 } (電機(jī)速度輸出)void CarVoltageGet(void) {long lnDeltaValue。ADC_GetValue16(g_nCarVoltage)。lnDeltaValue = (int)CV_ACCE_VAL。lnDeltaValue = lnDeltaValue (int)CV_ACCE_OFFSET。g_nCarAcceVal = (int)lnDeltaValue。g_nCarAcceVal = mult_r(g_nCarAcceVal, CV_ACCE_ANGLE_RATIO)。g_nCarGyroVal = (int)CV_GYRO_VAL。g_nCarGyroVal = (int)(g_nCarGyroVal CV_GYRO_ZERO)。g_nCarGyroVal = mult_r(g_nCarGyroVal, CAR_GYRO_RATIO_INT)。g_nCarAngle = (int)(g_lnCarAngleSigma 10)。 //.....lnDeltaValue = g_nCarAcceVal g_nCarAngle。lnDeltaValue = lnDeltaValue * CAR_ACCE_RATIO。g_lnCarAngleSigma += (g_nCarGyroVal + lnDeltaValue)。} (車模傾角計(jì)算)void CarAngleAdjust(void) {int nLeft, nRight。int nSpeed。int nP, nD。nP = g_nCarAngle。nP = (int)mult_r(nP, CAR_AA_P_INT)。nD = g_nCarGyroVal 5。nD = (int)mult_r(nD, CAR_AA_D_INT)。nSpeed = nD + nP。 if(nSpeedMOTOR_SPEED_SET_MAX)nSpeed=MOTOR_SPEED_SET_MAX。else if(nSpeedMOTOR_SPEED_SET_MIN)nSpeed= MOTOR_SPEED_SET_MIN。nLeft = nSpeed + g_nLeftMotorOutSpeed g_nMotorLeftRightDiff。nRight = nSpeed + g_nRightMotorOutSpeed + g_nMotorLeftRightDiff。g_nLeftMotorOut = nLeft 6。g_nRightMotorOut = nRight 6。if(g_nLeftMotorOut MOTOR_OUT_MAX) g_nLeftMotorOut = MOTOR_OUT_MAX。if(g_nLeftMotorOut MOTOR_OUT_MIN) g_nLeftMotorOut = MOTOR_OUT_MIN。if(g_nRightMotorOut MOTOR_OUT_MAX) g_nRightMotorOut = MOTOR_OUT_MAX。if(g_nRightMotorOut MOTOR_OUT_MIN) g_nRightMotorOut = MOTOR_OUT_MIN。MotorSpeedOut()。} (車模直立控制)void MotorSpeedAdjustCal(void) {int nLeftSpeed, nRightSpeed。int nDeltaValue, nP, nI。int nSpeed。nLeftSpeed = (int)g_nLeftMotorSpeedCount。nRightSpeed = (int)g_nRightMotorSpeedCount。nSpeed = (nLeftSpeed + nRightSpeed) / 2。nDeltaValue = g_nMotorSpeedSet nSpeed。nP = mult_r(nDeltaValue, MOTOR_SPEED_P_INT)。nI = mult_r(nDeltaValue, MOTOR_SPEED_I_INT)。g_nMotorOutSpeedOld = g_nMotorOutSpeedNew。g_nMotorOutSpeedKeep = nI。g_nMotorOutSpeedNew = (g_nMotorOutSpeedKeep 3) nP。if(g_nMotorOutSpeedKeep MOTOR_OUT_MAX)g_nMotorOutSpeedKeep = MOTOR_OUT_MAX。if(g_nMotorOutSpeedKeep MOTOR_OUT_MIN)g_nMotorOutSpeedKeep = MOTOR_OUT_MIN。} (車模速度控制)void CalculateMotorOutSpeed(void) {int nValue。nValue = g_nMotorOutSpeedNew g_nMotorOutSpeedOld。nValue = nValue * (g_nCarMotionCount + 1) /(CAR_MOTION_PERIOD 1) + g_nMotorOutSpeedOld。g_nLeftMotorOutSpeed = g_nRightMotorOutSpeed = nValue。}void CarMagneticAdjust(void) {int nP。long lnDelta。int nSigma。lnDelta = g_nCarMagneticRightAverage g_nCarMagneticLeftAverage。nSigma = (g_nCarMagneticLeftAverage / 2) + (g_nCarMagneticRightAverage / 2)。if(nSigma == 0) return。nP = (int)(lnDelta * CMA_P_MAX / nSigma) / 2。g_nMotorLeftRightDiff = nP。} (車模方向控制)void TI1_OnInterrupt(void){unsigned int nLeftMotorSpeed, nRightMotorSpeed。g_nCarSpeedCount ++。if(g_nCarSpeedCount = CAR_SPEED_PERIOD) {g_nCarSpeedCount = 0。GetMotorSpeed(amp。nLeftMotorSpeed, amp。nRightMotorSpeed)。ClearMotorSpeed()。g_nLeftMotorSpeed = (int)nLeftMotorSpeed。g_nRightMotorSpeed = (int)nRightMotorSpeed。if(!MOTOR_LEFT_SPEED_POSITIVE)g_nLeftMotorSpeed = g_nLeftMotorSpeed。if(!MOTOR_RIGHT_SPEED_POSITIVE)g_nRightMotorSpeed = g_nRightMotorSpeed。g_lnCarLeftPosition += g_nLeftMotorSpeed。g_lnCarRightPosition += g_nRightMotorSpeed。g_nLeftMotorSpeedCount += g_nLeftMotorSpeed。g_nRightMotorSpeedCount += g_nRightMotorSpeed。} else if(g_nCarSpeedCount == 1) {ADC_Measure(0)。} else if(g_nCarSpeedCount == 2) {CarVoltageGet()。CarAngleAdjust()。} else if(g_nCarSpeedCount == 3) {g_nCarMotionCount ++。if(g_nCarMotionCount = CAR_MOTION_PERIOD) {g_nCarMotionCount = 0。MotorSpeedAdjust()。g_nLeftMotorSpeedCount = 0。g_nRightMotorSpeedCount = 0。CalculateMotorLeftRightDiff()。CalculateMotorOutSpeed()。} else if(g_nCarSpeedCount == 4) {g_nCarMagneticLeftAverage = (int)CV_MAGNETLEFT_VAL。g_nCarMagneticRightAverage = (int)CV_MAGNETRIGHT_VAL。CarMagneticAdjust()。} 參考文獻(xiàn)[1]邵貝貝單片機(jī)嵌入式應(yīng)用的在線開(kāi)發(fā)方法北京:清華大學(xué)出版社,2004[2]楊國(guó)田,白焰摩托羅拉68HC12系列微控制器原理、應(yīng)用與開(kāi)發(fā)技術(shù)北京:中國(guó)電力出版社,2003[3]童詩(shī)白模擬電子技術(shù)基礎(chǔ)北京:高等教育出版社,2001[4]閻石數(shù)字電子技術(shù)基礎(chǔ)北京:高等教育出版社,1998[5]張宇河,董寧計(jì)算機(jī)控制系統(tǒng)北京:北京理工大學(xué)出版社,2002[6]陶永華,尹怡欣,葛蘆生新型PID控制及其應(yīng)用北京:機(jī)械工業(yè)出版社,1998[7]譚浩強(qiáng)C程序設(shè)計(jì)北京:清華大學(xué)出版社,2001[8]侯國(guó)屏,王坤,葉齊鑫北京:清華大學(xué)出版社,2005[9]HCS12 Serial Communication Interface(SCI) Block Guide [10]MetrowerksIDE Help for Code Warrior Plugin for MotorolaMetrowerks Semiconductor, Inc.,2005[11] 朱衛(wèi)華. 一種微機(jī)與單片機(jī)無(wú)線串行通信的設(shè)計(jì)方法. [D] 南華大學(xué),2002 年
點(diǎn)擊復(fù)制文檔內(nèi)容
規(guī)章制度相關(guān)推薦
文庫(kù)吧 www.dybbs8.com
備案圖鄂ICP備17016276號(hào)-1