⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 readpacketterminator.m

📁 基于串行接口的GPS驱动程序
💻 M
字号:
function cksum = ReadPacketTerminator(gps)
% ReadPacketTerminator Read the three byte sequence terminating a packet
global pid_dle_byte;
global pid_etx_byte;
   
% Read checksum byte. If it is equal to DLE, read (and discard) the
% following DLE.
cksum = fread(gps, 1);
if (pid_dle_byte == cksum)
    d = fread(gps, 1);
    if (pid_dle_byte ~= d)
        error(['CKSUM == DLE, but DLE not repeated.']);
    end
end

% Read the DLE and ETX that terminate this packet
byte = fread(gps, 1);
if (pid_dle_byte ~= byte)
    ExpectedDataError(byte, pid_dle_byte);
end
byte = fread(gps, 1);
if (byte ~= pid_etx_byte)
    ExpectedDataError(byte, pid_etx_byte);
end
          
      
    

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -