shaz
Member level 4
Dear all
the code m sending is of thermocouple linearization equation written by me in keil-c51 languague .i want to make this code size more shorter although its working .how can i do this .please help me
thnx
the code m sending is of thermocouple linearization equation written by me in keil-c51 languague .i want to make this code size more shorter although its working .how can i do this .please help me
Code:
////////////////// Raise-To-Power /////////////////////
double rtp(float rtp_base, int rtp_power){
int i;
double rtp_result;
rtp_result = 1;
for(i=1;i<=rtp_power;i++){
rtp_result= rtp_result * rtp_base;
}
return(rtp_result);
}
//////////////////////////////////////////////////////
//linearization equation
y = 0 + 2.508355e1*V1 +7.860106e-2*rtp(V1,2) - 2.503131e-1*rtp(V1,3) + 8.315270e-2*rtp(V1,4) -1.228034e-2*rtp(V1,5) + 9.804036e-4*rtp(V1,6) -4.413030e-5*rtp(V1,7) +1.057734e-6*rtp(V1,8)-1.052755e-8*rtp(V1,9);
lcd_init();
lcd_com(0x01); //Clear Display
lcd_com(0X0C); //Display ON, Cursor
lcd_com(0x80);
lcd_puts("Temp= ");
sprintf (buf, "%d", y);
lcd_puts(buf);