matlab串口读数据显示,用matlab从串口读入数据产生图像进行分析遇到的问题,求大虾帮助!...

本文档介绍了如何使用MATLAB的SERIAL函数创建串口对象,并连接到设备进行通信。创建串口对象时,需指定端口号,如'COM1',并可通过FOPEN函数打开连接。连接后,可以使用fprintf和fscanf与设备交互。注意每次只能有一个串口对象连接到一个端口,并且可以通过FOPEN和FCLOSE来建立和断开连接。
摘要由CSDN通过智能技术生成

该楼层疑似违规已被系统折叠 隐藏此楼查看此楼

%SERIAL Construct serial port object. ( 供你参考 )

%

% S = SERIAL('PORT') constructs a serial port object associated with

% port, PORT. If PORT does not exist or is in use you will not be able

% to connect the serial port object to the device.

%

% In order to communicate with the device, the object must be connected

% to the serial port with the FOPEN function.

%

% When the serial port object is constructed, the object's Status property

% is closed. Once the object is connected to the serial port with the

% FOPEN function, the Status property is configured to open. Only one serial

% port object may be connected to a serial port at a time.

%

% S = SERIAL('PORT','P1',V1,'P2',V2,...) constructs a serial port object

% associated with port, PORT, and with the specified property values. If

% an invalid property name or property value is specified the object will

% not be created.

%

% Note that the property value pairs can be in any format supported by

% the SET function, i.e., param-value string pairs, structures, and

% param-value cell array pairs.

%

% Example:

% % To construct a serial port object:

% s1 = serial('COM1');

% s2 = serial('COM2', 'BaudRate', 1200);

%

% % To connect the serial port object to the serial port:

% fopen(s1)

% fopen(s2)

%

% % To query the device.

% fprintf(s1, '*IDN?');

% idn = fscanf(s1);

%

% % To disconnect the serial port object from the serial port.

% fclose(s1);

% fclose(s2);

%

% See also SERIAL/FOPEN.

%

% MP 7-13-99

% AL 9-4-2009

% Copyright 1999-2009 The MathWorks, Inc.

% $Revision: 1.10.4.13 $ $Date: 2009/10/16 05:01:57 $

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值