Thread Subject: How can I read data on serial port in real time?

Subject: How can I read data on serial port in real time?

From: Dipti Dabholkar

Date: 6 May, 2009 22:53:02

Message: 1 of 3

Hi all!!!

    I am using serial port to get the data from the sensor nodes. I am using MATLAB 2008 serial port commands to open and read the data from serial port. I am able to open to serial port and able to read data here. I have set a specific 'TimeOut' period. My code is running for that much time collecting the data in InputBuffer and after that time elapse it shows me the output. But what I wish to do is, I want to know is there any way by which I can store one data packet received on serial port and display it while serial port is reading another packet. Can I do this?

Also,I am able to see the data but when I compared this data using another program 'TerminalRS232' it differs in value! I am not getting why the data which I am receiving on serial port is altered and displaying something else.

Can anyone help me with this problem???

Thanks

Subject: How can I read data on serial port asynchronously?

From: Trent Jarvi

Date: 8 May, 2009 15:30:02

Message: 2 of 3


"Dipti Dabholkar" <dips.dabholkar@gmail.com> wrote in message
news:gtt4ce$6fm$1@fred.mathworks.com...
> Hi all!!!
>
> I am using serial port to get the data from the sensor nodes. I am
> using MATLAB 2008 serial port commands to open and read the data from
> serial port. I am able to open to serial port and able to read data here.
> I have set a specific 'TimeOut' period. My code is running for that much
> time collecting the data in InputBuffer and after that time elapse it
> shows me the output. But what I wish to do is, I want to know is there any
> way by which I can store one data packet received on serial port and
> display it while serial port is reading another packet. Can I do this?
>
> Also,I am able to see the data but when I compared this data using another
> program 'TerminalRS232' it differs in value! I am not getting why the data
> which I am receiving on serial port is altered and displaying something
> else.
>
> Can anyone help me with this problem???
>

Hi Dipti,

I changed the subject slightly because what you describe is actually called
asynchronous communication. I'll even avoid talking about asynchronous
communication since I think what you need is a callback function. You can
look at the async documentation but I suspect you will find it isn't exactly
what you want.

http://www.mathworks.com/access/helpdesk/help/toolbox/instrument/f20-97405.html#f20-97648

Take a look at the serial BytesAvailableFcn. You can set the callback to
update the 'display' with the current data when it is available. This
allows you to continue on in your M-code without waiting for the port.

http://www.mathworks.com/access/helpdesk/help/toolbox/instrument/f20-73779.html#f20-94401

Subject: How can I read data on serial port in real time?

From: Lenin Tuppari

Date: 8 Feb, 2012 02:22:11

Message: 3 of 3

Hii dipti can you pls share some info on reading data from serial port,i am stuck with the same problem.i want to read a sensor data continuously from serial port in matlab.
thanks,bye











"Dipti Dabholkar" <dips.dabholkar@gmail.com> wrote in message <gtt4ce$6fm$1@fred.mathworks.com>...
> Hi all!!!
>
> I am using serial port to get the data from the sensor nodes. I am using MATLAB 2008 serial port commands to open and read the data from serial port. I am able to open to serial port and able to read data here. I have set a specific 'TimeOut' period. My code is running for that much time collecting the data in InputBuffer and after that time elapse it shows me the output. But what I wish to do is, I want to know is there any way by which I can store one data packet received on serial port and display it while serial port is reading another packet. Can I do this?
>
> Also,I am able to see the data but when I compared this data using another program 'TerminalRS232' it differs in value! I am not getting why the data which I am receiving on serial port is altered and displaying something else.
>
> Can anyone help me with this problem???
>
> Thanks

Tags for this Thread

Everyone's Tags:

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.

Tag Activity for This Thread
Tag Applied By Date/Time
read from seria... Dipti Dabholkar 6 May, 2009 18:54:02
sensors Dipti Dabholkar 6 May, 2009 18:54:02
rssFeed for this Thread

Contact us at files@mathworks.com