Thread Subject: check serial ports via matlab

Subject: check serial ports via matlab

From: jacob lalaounis

Date: 27 Oct, 2009 13:06:19

Message: 1 of 2

Hello,

I would like to send data from a serial port to another serial port.
I would like to check this by sending data and check what i get through matlab.
How is this possible??

Thank you in advance
Jacob

Subject: check serial ports via matlab

From: Trent Jarvi

Date: 27 Oct, 2009 14:34:12

Message: 2 of 2


"jacob lalaounis" <lalaounisjacob@gmail.com> wrote in message
news:hc6r8b$qie$1@fred.mathworks.com...
> Hello,
>
> I would like to send data from a serial port to another serial port.
> I would like to check this by sending data and check what i get through
> matlab.
> How is this possible??

Hi Jacob,

The basics are as follows:

s=serial('com1','BaudRate', 9600 );
inspect(s);
fopen(s);
if( s.BytesAvailable > 0 )
    data = fread( s, s.BytesAvailable );
end
fwrite(s,'Hello World!');
fclose(s);
delete(s);
clear s;

The following link provides documentation for using serial ports in MATLAB.

http://www.mathworks.com/access/helpdesk/help/techdoc/matlab_external/f38496.html

Tags for this Thread

Add a New Tag:

Separated by commas
Ex.: root locus, bode

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

rssFeed for this Thread

Contact us at files@mathworks.com