function [ msg ] = prijemprevodnik(delka)
%PRIJEMPREVODNIK Summary of this function goes here
%   Detailed explanation goes here
% if ~(exist('delka'))
%     delka=500;end
msg=[];

s=instrfind;
if isempty(s)||(strcmp(s.Status,'closed'))
delete(instrfind);
s = serial('COM4');
%set(s,'BaudRate',125000);
set(s,'BaudRate',500000);
set(s,'Terminator','');
set(s,'InputBufferSize',20048);
try
fopen(s);
catch chyba
    disp(chyba.identifier)
    delete(instrfind);
    return
end
end
s=s(1);


pocet=s.BytesAvailable;
if exist('delka')
pocet=min(pocet,delka);
end

if pocet
msg=char(fread(s,pocet)');
end

end
