universal control unit serial port connection
1 回表示 (過去 30 日間)
古いコメントを表示
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?
0 件のコメント
回答 (2 件)
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.
0 件のコメント
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.
0 件のコメント
参考
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!