DSPRelated.com
Forums

MATLAB Serial Port I/O For Filtering

Started by kerasus November 26, 2007
Hi guys,

I've designed an IIR filter in MATLAB. I used the filter values to write a
code for Atmega8. What i used for filter input is the output of a digital
sensor. The filter is working pretty good in MATLAB but the filter code
for Atmega8 gives a pure sinusoidal output (I couldn't do that if they
would ask me to do). I couldn't find the cause of the problem, so I want
to filter the output of the digital sensor in MATLAB to see whether my
code is correct or wrong. But now I need to get the serial port datas into
MATLAB. Do anyone knows how to do that? 

To make it clear: My MCU will send 16bit values and an "enter" after each
value to serial port with a baud rate of 57600. The MATLAB will take these
values and filter them simultaneously. What I need to know is how to take
serial port values into MATLAB. Hope to get an answer here.

Regards
Mursel
kerasus wrote:
> Hi guys, > > I've designed an IIR filter in MATLAB. I used the filter values to write a > code for Atmega8. What i used for filter input is the output of a digital > sensor. The filter is working pretty good in MATLAB but the filter code > for Atmega8 gives a pure sinusoidal output (I couldn't do that if they > would ask me to do). I couldn't find the cause of the problem, so I want > to filter the output of the digital sensor in MATLAB to see whether my > code is correct or wrong. But now I need to get the serial port datas into > MATLAB. Do anyone knows how to do that? > > To make it clear: My MCU will send 16bit values and an "enter" after each > value to serial port with a baud rate of 57600. The MATLAB will take these > values and filter them simultaneously. What I need to know is how to take > serial port values into MATLAB. Hope to get an answer here. > > Regards > Mursel
Are these 16-bit values in the form of text? How about capturing a string of them into a text file, then reading that file with MATLAB? I've seen MATLAB do this directly, but I haven't done it myself -- I assume there are library routines to do it, but I'm not that much of a MATLAB guru. -- Tim Wescott Wescott Design Services http://www.wescottdesign.com Do you need to implement control loops in software? "Applied Control Theory for Embedded Systems" gives you just what it says. See details at http://www.wescottdesign.com/actfes/actfes.html