Roberto Gomez

HC08LB8 arithmetic operation

Discussion created by Roberto Gomez on Jun 9, 2006
Latest reply on Jun 15, 2006 by Roberto Gomez
Hello, i am working with a HC08LB8, freq_khz is a number between [40, 120], A_f, B_f are 16bit variables
My code is:
    A_f = (((3 * freq_khz * freq_khz)/50)+6 * freq_khz+8432);
    B_f = (freq_khz * freq_khz)/10;
the opertion:
              A_f = (((3 * freq_khz * freq_khz)/50)+6 *freq_khz+8432);
return a correct result, but in the next line: 
               B_f = (freq_khz * freq_khz)/10;
the result is not the right, i think that the problem is the CCR (Condition Code Register) but i do not know how make for have a correct result.
Thanks you.