Troubleshooting bluetooth over serial

조회 수: 3 (최근 30일)
Raymond Chiu
Raymond Chiu 2015년 10월 26일
The exercise is to retrieve the model number of a Bluetooth device.
Win10 Bluetooth connection:
Not sure why serial port object s7 fails to fopen. Any actionable suggestions or diagnostic questions are appreciated.
>> s6 = serial('COM6', 'BaudRate', 9600);
>> s7 = serial('COM7', 'BaudRate', 9600);
>> s6
Serial Port Object : Serial-COM6
Communication Settings
Port: COM6
BaudRate: 9600
Terminator: 'LF'
Communication State
Status: closed
RecordStatus: off
Read/Write State
TransferStatus: idle
BytesAvailable: 0
ValuesReceived: 0
ValuesSent: 0
>> s7
Serial Port Object : Serial-COM7
Communication Settings
Port: COM7
BaudRate: 9600
Terminator: 'LF'
Communication State
Status: closed
RecordStatus: off
Read/Write State
TransferStatus: idle
BytesAvailable: 0
ValuesReceived: 0
ValuesSent: 0
>> fopen(s6)
>> fopen(s7)
Error using serial/fopen (line 72)
Open failed: Port: COM7 is not available. Available ports: COM3.
Use INSTRFIND to determine if other instrument objects are connected to the requested device.
>> fopen(s7)
Error using serial/fopen (line 72)
Open failed: Port: COM7 is not available. Available ports: COM3.
Use INSTRFIND to determine if other instrument objects are connected to the requested device.
>> s6
Serial Port Object : Serial-COM6
Communication Settings
Port: COM6
BaudRate: 9600
Terminator: 'LF'
Communication State
Status: open
RecordStatus: off
Read/Write State
TransferStatus: idle
BytesAvailable: 0
ValuesReceived: 0
ValuesSent: 0
>> s6
Serial Port Object : Serial-COM6
Communication Settings
Port: COM6
BaudRate: 9600
Terminator: 'LF'
Communication State
Status: open
RecordStatus: off
Read/Write State
TransferStatus: idle
BytesAvailable: 0
ValuesReceived: 0
ValuesSent: 0
>> fprintf(s6, '*IDN?')
Error using serial/fprintf (line 144)
Unexpected error: A timeout occurred during the write operation..
>> fopen(s7)
Error using serial/fopen (line 72)
Open failed: Port: COM7 is not available. Available ports: COM3.
Use INSTRFIND to determine if other instrument objects are connected to the requested device.

답변 (0개)

카테고리

Help CenterFile Exchange에서 System-Level Simulation에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by