• slider image 442
  • slider image 483
  • slider image 484
  • slider image 485
  • slider image 486
  • slider image 487
  • slider image 488
  • slider image 491
:::


Browsing this Thread:   1 Anonymous Users




« 1 (2)


呼叫過多數學函數導致 RAM overflow 請問如何解決?
#1
資深會員
資深會員


查看用戶資訊
版大以及各位先進大家好:

我遇到呼叫內建數學函數時,編譯會出現下面的錯誤訊息,造成無法組譯。如果刪減幾行,例如不要呼叫 sqrt() 和 atan() 其中一個函數的話,就可以通過組譯,可是我的程式一定要進行程式中的三種運算才行,請問要如何避免錯誤訊息而可以組譯成功?謝謝。

補充一下,下面的程式如果直接用一個新的程式來編譯當然可以成功,但是我的程式已經寫蠻大了(4K),16F917有8K容量。

錯誤訊息:
Error[477] : fixup overflow in expression (location 0x1586 (0x1570+22), size 2, value 0x800)

Advisory[1207] : some of the command line options you are using are now obsolete
Advisory[1208] : use --help option or refer to the user manual for option details


#include <math.h>
#include <errno.h>

bank2 unsigned long Im_Reg;    
bank2 unsigned long VZ_Reg;    
bank2 unsigned int Impedance_5KHZ;
bank2 unsigned int Impedance_50KHZ;
bank2 unsigned long VR_ACC;

bank2 double data_in;
bank2 double Result;
bank2 double sqrt_in;
bank2 double sqrt_root;

void main(void){
  
//---計算A平方減B平方後除99
  
VZ_Reg=Impedance_5KHZ;//計算A平方
  
VZ_Reg*=VZ_Reg;
  
Im_Reg=Impedance_50KHZ;//計算B平方
  
Im_Reg*=Im_Reg;
  
VR_ACC=VZ_Reg-Im_Reg;//A平方減B平方
  
VR_ACC/=99;        //除以99
  //---開根號計算
  
sqrt_in=100;
  
sqrt_root sqrt(sqrt_in);//呼叫開方運算函數
  //---相位角計算
  
data_in=0.2;
  
Result atan(data_in) / PI 180;//呼叫反三角函數
//main

發表於: 2008/3/31 11:33
Twitter Facebook Google Plus Linkedin Del.icio.us Digg Reddit Mr. Wong 頂部







You can view topic.
不可以 發起新主題
You cannot reply to posts.
You cannot edit your posts.
You cannot delete your posts.
You cannot add new polls.
You cannot vote in polls.
You cannot attach files to posts.
You cannot post without approval.
You cannot use topic type.
You cannot use HTML syntax.
You cannot use signature.
You cannot create PDF files.
You cannot get print page.

[進階搜尋]


:::

Microchip連結

https://www.facebook.com/microchiptechnologytaiwan/
http://www.microchip.com.tw/modules/tad_uploader/index.php?of_cat_sn=13
https://mu.microchip.com/page/tmu
http://elearning.microchip.com.tw/modules/tad_link/index.php?cate_sn=1
https://page.microchip.com/APAC-PrefCenters-TW.html
http://www.microchip.com/
http://www.microchip.com/treelink
http://www.microchipdirect.com/
http://www.microchip.com.cn/newcommunity/index.php?m=Video&a=index&id=103
http://www.microchip.com.tw/modules/tad_uploader/index.php?of_cat_sn=2
http://www.microchip.com.tw/Data_CD/eLearning/index.html
http://www.microchip.com.tw/RTC/RTC_DVD/
https://www.microchip.com/development-tools/
https://www.youtube.com/user/MicrochipTechnology
[ more... ]

教育訓練中心

!開發工具購買
辦法說明 [業界客戶] [教育單位]
----------------------------------
!校園樣品申請
辦法說明 [教師資格] [學生資格]
----------------------------------