Mysterious serial port error message
- From: "Walter Goedecke" <wgoedeck@xxxxxxx>
- Date: Sat, 2 Aug 2008 01:41:02 +0000 (UTC)
I'm trying to write ASCII text to a serial port by MatLab.
I'm writing text to COM8, which is virtually connected to
COM9 by a virtual communications port emulator, MixW serial
port adaptor. I'm monitoring COM9 by hyperterminal. The code
I'm using is:
instrreset; %Disconnect and delete all instrument objects.
s = serial('COM8');
set(s, 'BaudRate', 4800); %NMEA packet
fopen(s)
fprintf(s, 'ASCII text\n');
fclose(s);
delete(s)
clear s
When I execute the code, I do transmit the text to COM8, and
I do see the text on COM9 by hyperterminal, but I do get the
error message:
"??? Error using ==> serial.fprintf
An error occurred during writing.
Error in ==> Nav at 105
fprintf(s, 'ASCII text\n');"
The program can't be run again, and MatLab will not respond;
in fact, I must close MatLab by the Windows task monitor.
My question is, what does the error message mean, and why
would the device write command work in spite of this error?
Also, could I place an error trap that merely side-steps the
error, so that the program can properly close the port, such
as a try/catch trap?
Thanks
.
- Follow-Ups:
- Re: Mysterious serial port error message
- From: Trent Jarvi
- Re: Mysterious serial port error message
- From: Donn Shull
- Re: Mysterious serial port error message
- Prev by Date: Re: calculation of multiple slopes
- Next by Date: Re: How can I get textscan to *read* blank lines?
- Previous by thread: calculation of multiple slopes
- Next by thread: Re: Mysterious serial port error message
- Index(es):
Relevant Pages
|