필터 지우기
필터 지우기

universal control unit serial port connection

조회 수: 1 (최근 30일)
David Hollinger
David Hollinger 2017년 8월 1일
답변: Rock Rocky 2017년 8월 6일
Hello,
I have a universal control unit and want to use information from v3d to MATLAB to send to the control box. The control box has C2 vibration motors that can fire based on the downloaded user interface. The serial port is 'COM3'. I have tried connecting MATLAB to the serial('COM3') by using
s = serial('COM3');
fopen(s);
fprintf(s,'*IDN?');
out = fscanf(s);
fclose(s);
delete(s);
clear s;
but I get the following error:
Error using serial/fopen (line 72)
Open failed: Cannot connect to the COM3 port. Possible reasons are another
application is connected to the port or the port does not exist.
Also, s.status returns as 'closed' but I want to know how to have the serial port 'open' to send MATLAB commands for the vibration motors to fire given a certain quantity in v3d.
Does anyone know what is going on here and how I can connect to the control unit?

답변 (2개)

Rohan Kale
Rohan Kale 2017년 8월 5일
Use instrfind() function to find out the status of the current port that you want to connect to. That will do.

Rock Rocky
Rock Rocky 2017년 8월 6일
The port you are using (COM3) is busy because it is connected to another application. try to check a free port and use it instead of COM3. This will solve your problem.

카테고리

Help CenterFile Exchange에서 Motor Drives에 대해 자세히 알아보기

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by