lgeorge123
Joined: 05 Dec 2004 Posts: 31
|
ccs int32 calculation |
Posted: Wed Mar 18, 2009 7:30 am |
|
|
I have a prgram to calculate some variables.
Code: | int16 cal_x_min,cal_x_max,cal_y_min,cal_y_max,x_coord,y_coord;
int32 x_coord320,y_coord240
cal_x_min=0x0123;
cal_x_max=0x0034;
cal_y_min=0x0567;
cal_y_max=0x0456;
x_coord=cal_x_min-0x0007;
y_coord=cal_y_min-0x0001;
x_coord320 = (x_coord * 320) / (cal_x_min - cal_x_max);
y_coord240 = ((y_coord *240) - 240) / (cal_y_min - cal_y_max); |
using the above calculation the result is wrong (x_coord320 and y_coord240) , can somebody give me some suggestions ???? |
|