dear friends i need one help,
i am new to c language, this is a part of one big program,,
using 10bit ADC, 8 bit MCU,vcc 3.3V,MY boss told me to study this program,almost i understand other codes,this portion the bitwise shift i understand but why we have to shift1,4,7,8 like that,and what is 15 in (Iin+15 )i could'nt understand this,
Iin is input current ,unsigned int ,this Iin is using for power calculation and SCI section. pls any one explain this portion,I'll be very grateful for your help
thank you.
i am new to c language, this is a part of one big program,,
using 10bit ADC, 8 bit MCU,vcc 3.3V,MY boss told me to study this program,almost i understand other codes,this portion the bitwise shift i understand but why we have to shift1,4,7,8 like that,and what is 15 in (Iin+15 )i could'nt understand this,
Iin is input current ,unsigned int ,this Iin is using for power calculation and SCI section. pls any one explain this portion,I'll be very grateful for your help
thank you.
Code:
Iin = RMS_Value; // resolution :0.015625A
if(Iin < 300) //7A ,300*3.3/1023 = 0.9677v(mcu i/p)
{
Itemp = RMS_Value>>1; // 1 1000 0000
Iin = Iin+Itemp; // 300+480 =
Itemp = RMS_Value>>4;
Iin = Iin+Itemp;
Itemp = RMS_Value>>7;
Iin = Iin+Itemp;
Itemp = RMS_Value>>8;
Iin = Iin+Itemp;
Iin = Iin + 15;
}
else
{
Itemp = RMS_Value>>1;
Iin = Iin+Itemp;
Itemp = RMS_Value>>3;
Iin = Iin+Itemp;
Itemp = RMS_Value>>4;
Iin = Iin+Itemp;
Itemp = RMS_Value>>5;
Iin = Iin+Itemp;
Itemp = RMS_Value>>7;
Iin = Iin+Itemp;
Iin = Iin - 25;
}