matlab 串口通信问题(待解决)
(2009-09-25 22:01:26)
标签:
杂谈
% Move stage back program
instrreset;
clear all;close all
%global s;
s=serial('COM1','terminator','LF','BAUDRATE',9600)
%stage=serial('COM1')
%stage=serial('COM2','BAUDRATE',19200);
%s=serial('COM1','terminator','CR/LF');
%s.InputBufferSize=100
%s.OutputBufferSize=100
fopen(s)
%s.BaudRate =9600
s.DataBits=8;
s.Parity = 'none';
s.StopBits=1;
% Set Stage Paramter
% TotalLength=107.16;
% in mm
% TotalSteps=6495279;
% number
% StepLength=TotalLength/TotalSteps;
% Set Zero Point Position
%ZeroPointPositionStep=3015844;
% in step number
%ZeroPosition=0.0000165*3015844;
% in mm
% Set distance form the zero point
% Set Value in mm
%DistancefromZero=29;
% in mm
%StartScanPosition=round((ZeroPosition+DistancefromZero)/0.0000165);
%fprintf(stage,num2str(StartScanPosition));
%fprintf(stage,'num2str(StartScanPosition')
fprintf(s,'Q');
pause(1)
re=fscanf(s)
fclose(s);
运行结果
Warning: A timeout occurred before the Terminator was reached.
re =
''
分享:
喜欢
0
赠金笔
加载中,请稍候......
评论加载中,请稍候...
发评论
登录名: 密码: 找回密码 注册记住登录状态
昵 称:
评论并转载此博文
发评论
以上网友发言只代表其个人观点,不代表新浪网的观点或立场。