Hi all,
I have to interface an IC which is giving serial output bitwise from a single pin this pin is directly connected to a microcontroller i have to read this single pin to an unsigned int.
i have written a function something like that but its not working.
unsigned int read_val()
{
unsigned char i;
unsigned int data=0;//initially zero
for(i=0;i<=15;i++)
{
data<<=1;
if(PINB==1)
{data|=1;}
else
{
data|=0;
}
}
return data;
}
So the output of that function should be if pin is toggling as 1110110001100110
then data should contain data=0X EC66.
Thanks.