Re: 利用LCD 秀轉速(變數)
|
||||
---|---|---|---|---|
版主
|
參照:
Speed[0]=(j000000+'0'); 改用 putsLCD(Speed) ; putrsLCD( ) 是指向 ROM Data 的,照理說在編譯時就會出現型態不符的警告才對,請在檢查 Build All 後的結果。
發表於: 2007/11/29 12:01
|
|||
|
利用LCD 秀轉速(變數)
|
||||
---|---|---|---|---|
新會員
|
個位先進:ActualSpeed是一個變數隨HALL SENSER而變化,我想要把ActualSpeed秀在LCD上面可是以下所寫的程式在LCD上確不會有任何變動,出現其怪的代碼。
不知道是那邊有設錯....是指令有問題嗎??? unsigned int ActualSpeed //ActualSpeed 是變數 char Speed[]={0,0,0,0,0,0}; char j0; char j00; char j000; char j0000; char j00000; char j000000; j000000=ActualSpeed/100000; j00000=(ActualSpeed-j000000*1000000)/10000; j0000=(ActualSpeed-j000000*1000000-j00000*100000)/1000 ; j000=(ActualSpeed-j000000*1000000-j00000*100000-j0000*10000)/100; j00=(ActualSpeed-j000000*1000000-j00000*100000-j0000*10000-j000*1000)/10; j0=(ActualSpeed-j000000*1000000-j00000*100000-j0000*10000-j000*1000-j00*100); Speed[0]=(j000000+'0'); Speed[1]=(j00000+'0'); Speed[2]=(j0000+'0'); Speed[3]=(j000+'0'); Speed[4]=(j00+'0'); Speed[5]=(j0+'0'); setcurLCD(0,1) ; putrsLCD(Speed); 在setcurLCD(0,1)出現其怪的代碼~~而ActualSpeed不會隨HALL SENSER而變化,不知道是不是程式的寫法有問題 還是有奇他秀轉數的方式!!!! 請各位先進~~~指教!!!!!
發表於: 2007/11/28 13:15
|
|||
|
Re: 關於AN957裡面的問題
|
||||
---|---|---|---|---|
資深會員
|
ActualSpeed = SPEEDMULT/timer3avg;
AcutalSpeed 由 timer3 的值換算而來 timer3avg 指加權平均值, 前平均值加新值除以2 timer3avg = ((timer3avg + timer3value) >> 1); 展開後為 Timer3[n]/2+ Timer3[n-1]/4 + Timer3[n-2]/8 + .... ============================ SPEEDMULT 是轉換系數 須根據 system clock 和 timer3 clock , motor pole number來求得 #define SPEEDMULT 2343750 -- SensoredBLDC.h system clock: Fin = 8Mhz -- SensoredBLDC.h timer3 clock: T3CON = 0x0030; // timer3 internal Tcy/256 clock -- init.c // AN957 speed S = 60/(P/2*T) rpm P: the number of poles of the motor. T: the time(seconds) for one electrical cycle 須從 Fin, timer3 求出 S: ActualSpeed ============================ DesiredSpeed = ADC1BUF0 * POTMULT; // value for speed control #define POTMULT 4 // pot to speed ratio 1023* POTMULT 馬達的最大轉速, POTMULT 設越大最大轉速越高
發表於: 2007/11/23 17:54
|
|||
|
Re: 關於AN957裡面的問題
|
||||
---|---|---|---|---|
新會員
|
~~~~有人會嗎嗎嗎?????????????/
看不太懂!!
發表於: 2007/11/21 8:08
|
|||
|
關於AN957裡面的問題
|
||||
---|---|---|---|---|
新會員
|
個位先進:
void CalculateDC(void) ActualSpeed = SPEEDMULT/timer3avg; DesiredSpeed = DesiredSpeed*POTMULT(什麼意思); SpeedError = DesiredSpeed - ActualSpeed ActualSpeed(實際轉速)他算出來的單為應該是RPM DesiredSpeed(理想轉速)為什麼可以寫成 ADCBUF0*4-------ADCBUF0是10BIT是AD裡面的暫存器 可看成1023*4=4092-------那這單位又可以看成是RPM嗎?? 那他算出來的單為又是什麼為什麼可以在SpeedError相減 在PI控制那區塊看不太懂所以上來問問麻煩各位先進 小馬車留...11/20
發表於: 2007/11/20 15:00
|
|||
|