Matlab Serial Problems - Programmers Heaven

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!


Welcome to the new platform of Programmer's Heaven! We apologize for the inconvenience caused, if you visited us from a broken link of the previous version. The main reason to move to a new platform is to provide more effective and collaborative experience to you all. Please feel free to experience the new platform and use its exciting features. Contact us for any issue that you need to get clarified. We are more than happy to help you.

Matlab Serial Problems

dsmith890dsmith890 Posts: 1Member
MATLAB Version r2010a
Platform OSX 10.6.3
USB-Serial Drivers: Prolific PL2303

I'm trying to use MATLAB to connect to the Terminal Node Controller (TNC) build into my Kenwood D710 radio. I know the USB-Serial Driver is working because I can make the connection with QuickTerm (Hyperterminal type program for OSX) using the following port settings:

Baud Rate: 19200
Data Bits: 8 Bits
Stop Bit(s): 1 Bit
No Parity
Flow Control: No Flow Control

In MATLAB I try:
s1 = serial('/dev/tty.usbserial', 'Terminator', 13, 'StopBits', 1, 'Parity', 'none', 'BaudRate', 19200, 'FlowControl', 'none');
% command to display information with fprintf
fprintf(s1, 'DISP');
% command to display information with fwrite - same as above with explicit terminator
fwrite(s1, ['DISP' 13]);

% I included both of the above to demonstrate that they return the same result - see
% below

clear s1

This results in no returned information. fscanf returns: "Warning: A timeout occurred before the Terminator was reached."

What is happening is that the s1.BytesAvailable field is always empty. Matlab is never receiving data.

Here's the strange part. When I open QuickTerm after this connection the TNC has clearly received the command and displays the result in the QuickTerm window. Why can't MATLAB see the data when the TNC is trying to send it?

I'm pulling my hair out here, and I really hope this is a stupid question with an easy answer - any help would be greatly appreciated.

Sign In or Register to comment.