📄 opengps.m
字号:
function [gps, pid, version, text, protocols] = OpenGPS(port)
global pid_product_rqst
% Initialize global constants
constants;
%try
gps = serial(port);
fopen(gps);
set(gps, 'BaudRate', 9600, 'DataBits', 8, 'Parity', 'none', 'StopBits', 1);
% Initiate product data protocol, which queries for device
% identifier, firmware version, and optional descriptive text
% strings.
WritePacket(gps, pid_product_rqst, 0);
data = ReadProductDataType(gps);
pid = data{1};
version = data{2};
if (~isempty(data{3}))
text = data(3:end);
end
% Most devices follow the product data protocol with the protocol
% capability protocol, which describes the protocols that the GPS
% device supports.
protocols = ReadProtocols(gps);
% catch
% disp(lasterr);
% fclose(gps);
% delete(gps);
% end
%
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -