Multiplication of two integer gives wrong value (ATMEL ATmega32A) -
the data , uart data added here.i can't understand what's problem..i tried different kinda solutions changing data types,values,prints...
i'm using atmega32a programmed usbasp.
here code: https://hastebin.com/soqexihoni.cs here uart com. log: https://hastebin.com/muwekuniva.hs
another version change data type of variables. 'temp' variable changed.i read it.but problem still goes on.. " temp = (5*data*100)/1024; " doesn't give logical result..
thanks every comment (y)
you have careful data types , how write code. code (5*data*100)/1024
performs operation in integer , then, converts in float because temp
float.
you try like:
temp = ((float)5 * (float)data * (float)100) / (float)1024;
it might on top cast variables, principle.
Comments
Post a Comment