Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

Getting Data from serial port in MATLAB

Status
Not open for further replies.

habibparacha

Junior Member level 2
Joined
Oct 25, 2010
Messages
24
Helped
1
Reputation
2
Reaction score
1
Trophy points
1,283
Activity points
1,482
Hi,

My problem is that I am sending an analog signal into the AVR and converting it into Digital and than sending it through the serial port by using Tx/Rx of AVR.
I want to get this data into MATLAB simulink with the help of Instrument control tool box.

My Question is how this serial data will again be combined in order to show the original waveform on the graph?
Like if I am giving a sinusoidal input to AVR than how to reconstruct that sinusoid in the MATLAB? and Will this data acquired will be in real time or not?

My second question is I want to have the frequencies of 1Hz to 20Hz which filter shall I be using in simulink than Analog or Discrete filter.

Any help would be appreciated.
 

Serial Communication is not at all difficult..
You just have to create a serial port object

Just see this site.. Have an example of Controlling Servo Motor Using MATLAB using Serial Communication

Servo Motor Control Using MATLAB - MATLAB ACADEMY


Simple Code to Communicate serially
Code:
s = serial('COM1','BaudRate',9600,'TimeOut',3);
fopen(handles.s);
[rec count msg] = fgets(s); %instead of this line you can use [B][I]rec = fgets(s)[/I][/B] to receive data from serial port
%To send Data
fprintf(handles.s,'%s','Your Name or anything u want');

And then you can use this to plot anything in MATLAB
Hope this help
 

Does this data we get is in real time or not or will it be for some time only. Like a simulation that runs upto a particular time?
 

You can acquire data and Plot it in real time using MATLAB..
Few Days Back i had made a project which acquire data from 60 Sensors and Plot the Temperature Vs Time in real time...
But the Problem is that My system is not so much fast.. That's why my system hangs many times...
But there is no loss in data...

You can try it.. i am sure it will work
 
Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top