I have generated bits of sequence, i reshaped it and it should be appended with the CRC? How to program?
1 view (last 30 days)
Show older comments
close all;
clear all;
clc;
Data_gen = randint(1,11,255);
D=dec2bin(Data_gen);
conv_in=[];
for index =1:11
conv_in=[conv_in double(D(index,:))-48];
end
data=conv_in;
y=reshape(data,8,[]).';
z=[y zeros(11,2)];
for ii=1:11
b=z(ii,:);
c=b;
G1 = [1,0,1];
mL = length(c);
gL = length(G1);
count = 0;
while((mL-count) >= gL)
msg9 = c(1:gL);
rem = mod((msg9 + G1),2);
c(1:gL) = rem;
j=1;
shft = 0;
while(j<=gL)
if(rem(j)~=0)
break;
else shft = j
j = j + 1;
end
end
count = count + shft;
c(1:shft) = [];
end
j = 0;
value = 0;
chksuml = length(c);
disp(c);
disp(chksuml);
for j = 1:chksuml; % convert binary to decimal
if(c(j) == 1)
value = value + (2^(chksuml-j));
end
end
dec2hex(value);
dimension = [0 1];
size = 8;
B = padarray(c,size*dimension,'pre');
r=[];
r=or(c,B);
end
0 Comments
Answers (0)
See Also
Categories
Find more on MATLAB Compiler in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!