Saturday, June 25, 2011

Bit stuffing in data frames[Matlab code]




clc;
clear all;
msg=input('Input Message Binary Bit Stream: ');
count=0;
stuffcount=0;
[M N]=size(msg);
for j=1:N-5+stuffcount
for i=j:j+5
if msg(i)==1
count=count+1;
else
count=0;
break;
end
end
if count==6
msg=[msg(1:j+4) 0 msg(j+5:end)];
count=0;
stuffcount=stuffcount+1;
end
end
fprintf('Stream after the bit is stuffed:');
disp(msg);














No comments:

Google : The top most search engine

Google : MAGIC BOX

nRelate - Posts and Homepage

LinkWithin

Related Posts Plugin for WordPress, Blogger...

Which is the toughest subject ?