Warning: Unexpected Warning: A timeout occurred before the Terminator was reached.
2 views (last 30 days)
Show older comments
Hello everyone,
I know this is stupid question but I am really new to these things.I would like to build a communication between stepping motor and computer by MATLAB(using MODBUS(RS485)) and according to motor user manual I have to send some quaries to the motor and after that ı have to see that the motor will operate.Here is my code when I run it.It comes me like Warning: Unexpected Warning: A timeout occurred before the Terminator was reached. Why am I getting this warning and why cant the motor operate ? Thank you
clear all close all instrreset clc; disp('BEGIN PROGRAM'); %% Instrument Connection
% Find a serial port object. obj1 = instrfind('Type', 'serial', 'Port', 'COM6', 'Tag', '','Terminator','CR');
% Create the serial port object if it does not exist % otherwise use the object that was found. if isempty(obj1) obj1 = serial('COM6'); else fclose(obj1); obj1 = obj1(1); end
% Configure instrument object, obj1. set(obj1, 'BaudRate', 115200); set(obj1, 'Parity', 'even'); set(obj1, 'Timeout', 10.0);
%% Disconnect and Clean Up
% Disconnect from instrument object, obj1. fclose(obj1);
%% Instrument Connection
% Connect to instrument object, obj1. fopen(obj1);
%% Instrument Configuration and Control
% Communicating with instrument object, obj1. fwrite(obj1, '1 16 24 0 0 2 4 0 0 0 2 216 110'); fgetl(obj1); fwrite(obj1, '1 16 24 2 0 2 4 0 0 33 52 193 241'); fgetl(obj1); fwrite(obj1, '1 16 24 4 0 2 4 0 0 7 208 91 240'); fgetl(obj1); fwrite(obj1, '1 16 24 6 0 2 4 0 0 5 220 219 76'); fgetl(obj1); fwrite(obj1, '1 16 24 8 0 2 4 0 0 5 220 90 192'); fgetl(obj1); fwrite(obj1, '1 16 0 124 0 2 4 0 0 0 8 245 24'); fgetl(obj1); fwrite(obj1, '1 16 0 124 0 2 4 0 0 0 0 244 222'); fgetl(obj1);
fclose(obj1); delete(obj1); clear obj1 disp('STOP')
BEGIN PROGRAM Warning: Unexpected Warning: A timeout occurred before the Terminator was reached. Warning: Unexpected Warning: A timeout occurred before the Terminator was reached. Warning: Unexpected Warning: A timeout occurred before the Terminator was reached. Warning: Unexpected Warning: A timeout occurred before the Terminator was reached. Warning: Unexpected Warning: A timeout occurred before the Terminator was reached. Warning: Unexpected Warning: A timeout occurred before the Terminator was reached. Warning: Unexpected Warning: A timeout occurred before the Terminator was reached. STOP >
0 Comments
Answers (0)
See Also
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!