I did not learn C in school. I learned Fortran instead. I know how to program this in Fortran, but I am having trouble with IAR C and the Mega 8.
unsigned char A, B, C, D, E;
B = 220;
C = 133;
D = 128;
E = 49;
A = ((B + 1) * 0x0000000B * C) / ((D * 0x001C) - (10640/E));
AVRStudio shows the wrong result for A. The first two multiplications are 16 bit operations. I thought the 32 bit constant would make it do 32 bit operations. I get a truncation error in the second multiplication. I should not have to resort to assembler to do this.
What can I do?