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

📄 opengps.m

📁 基于串行接口的GPS驱动程序
💻 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 + -