skarthikshines
Member level 5
hi all am using msp430f2618 controller .. in my coding some arithmetic calculations is there that is
lSignal2 = lSig*1410/wSa1+1024;
in this code lsig = -2;
wSa1 =500;
as per the manual calculation the answer should be lSignal2 = 1018 but am getting lSignal2 =-183787 while i debug my code by means of step by step
but if the lsig value is positive means its working properly,
since i declared lSignal2,lSig variables as a "signed long int" and wSa1 as a "unsigned int" variable...
what should i do to rectify this calculation errors???
lSignal2 = lSig*1410/wSa1+1024;
in this code lsig = -2;
wSa1 =500;
as per the manual calculation the answer should be lSignal2 = 1018 but am getting lSignal2 =-183787 while i debug my code by means of step by step
but if the lsig value is positive means its working properly,
since i declared lSignal2,lSig variables as a "signed long int" and wSa1 as a "unsigned int" variable...
what should i do to rectify this calculation errors???