版大以及各位先進大家好:
我遇到呼叫內建數學函數時,編譯會出現下面的錯誤訊息,造成無法組譯。如果刪減幾行,例如不要呼叫 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