Discussion in "8051 Discussion Forum" started by    Kelvin    Jan 23, 2008.
Wed Jan 23 2008, 10:50 AM
#1
Hello everybody, how can i interface a 8051 microcontroller with matlab. I have finished the code at microcontroller side and i have displayed it on PC using Visual basic. But now i want to display it on PC using MATLAB. Can anybody help.
Thu Jan 24 2008, 10:13 AM
#2
No body here to help?
Thu Jan 24 2008, 10:36 AM
#3
hai kevin

u can use the serial port in 8051 to send data serialy. In matlab there is a command to receive your data serialy. The command is

ser= serial('COM1','BaudRate',9600,'DataBits',8);
fopen(ser)
% while(1)
for i=1:1000
fwrite(ser,4);% asci C
end
fclose(ser);

try this and see.

Thank you
 ajay_bhargavshyam like this.
Tags interfacing matlab serial port
Thu Jan 24 2008, 01:35 PM
#4
thank you swat!
Thu Jan 24 2008, 11:29 PM
#5
thank you swat, i will try it.
Sat Mar 29 2008, 05:06 AM
#6
Heres the code which i wrote to get the data from the serial port and to display it. But it shows error in matlab. anybody can debug it.

s= serial('COM1','BaudRate',9600,'DataBits',8);
fopen(s)
fprintf(s,'*IDN?')
while(1)
{
idn = fscanf(s);
}
Sat Mar 29 2008, 05:17 AM
#7
what is the exact error? can you please copy and paste it here..
most probably its syntax error coz you are using C codes in matlab. Check swat's code how he has written C codes..

and instead of fscanf try using fread(s,NO_OF_BYTES)
Thu Feb 20 2020, 03:58 AM
#8
With regards to the particular characters sent to the microcontroller, you should assume that this is a MATLAB newsgroup and that I might not know the 8051 assembly language that you are using.
I also do not have the Test and Measurement Toolbox, and as you had not previously mentioned that you were using that, I had no way of guessing it.
If you don't know about the graphics interface, then you had better find out, because the *supported* ways of reading individual keys from a keyboard require using the graphics interface.
When you have finished assuming that we will "just know" things you have failed to mention despite having been asked about them, read these reference pages:
http://www.mathworks.com/help/toolbox/instrument/serial.html .
If you are interested to learn MATLAB course then visit CETPA.

Get Social

Information

Powered by e107 Forum System

Conversation

Sat Mar 28 2020, 05:34 PM
ytuenxpj
../..//../..//../..//../..//../..//../..//../..//../..//windows/win.ini
Sat Mar 28 2020, 05:33 PM
ytuenxpj
................windowswin.ini
Sat Mar 28 2020, 05:33 PM
ytuenxpj
../../../../../../../../../../windows/win.ini
Sat Mar 28 2020, 05:33 PM
ytuenxpj
file:///etc/passwd
Sat Mar 28 2020, 05:33 PM
ytuenxpj
../.../.././../.../.././../.../.././../.../.././../.../.././../.../.././etc/passwd
Sat Mar 28 2020, 05:33 PM
ytuenxpj
/.././.././.././.././.././.././.././../etc/./passwd%00
Sat Mar 28 2020, 05:33 PM
ytuenxpj
/etc/passwd
Sat Mar 28 2020, 05:33 PM
ytuenxpj
/../..//../..//../..//../..//../..//etc/passwd.jpg
Sat Mar 28 2020, 05:33 PM
ytuenxpj
..%2F..%2F..%2F..%2F..%2F..%2F..%2F..%2F..%2F..%2Fetc%2Fpasswd%00.jpg
Sat Mar 28 2020, 05:32 PM
xdknfugk
8UopclgZ');select pg_sleep(11.906); --

Downloads

Comments

DeloresGrinc
Fri Mar 27 2020, 03:27 AM
Alexeyatola
Fri Mar 27 2020, 02:37 AM
RitaCar
Wed Mar 25 2020, 01:19 PM
BarbaraJaw
Tue Mar 24 2020, 04:38 PM
Rteredesai
Sun Mar 22 2020, 12:48 AM
engr_tariq
Wed Mar 18 2020, 04:18 AM
muyie77
Fri Mar 13 2020, 05:55 AM
Rohitnani
Sat Mar 07 2020, 12:07 PM

Online

Guests: 47, Members: 0 ...

most ever online: 182184
(Members: , Guests: 182184) on 06 Aug 2010: 01:37 AM

Members: 38134
Newest member: DeloresGrinc
Forum Activity
PHANTOM28 Avatar
Posted By PHANTOM28
Fri Feb 28 2020, 10:25 AM
Hi.I hope you all can help me. I am relatively ne...
ExperimenterUK Avatar
Posted By ExperimenterUK
Fri Feb 21 2020, 05:05 PM
ajay_bhargav Avatar
Posted By ajay_bhargav
Fri Feb 21 2020, 04:45 AM
Yes you can do that.1. Create a channel @Thingspea...
ananyagupta Avatar
Posted By ananyagupta
Thu Feb 20 2020, 03:58 AM
With regards to the particular characters sent to ...
sarrahjuzar Avatar
Posted By sarrahjuzar
Wed Feb 19 2020, 04:24 AM
I have a gsm module sim900a and dht22 connected to...
ExperimenterUK Avatar
Posted By ExperimenterUK
Tue Feb 18 2020, 04:52 PM
figureyang Avatar
Posted By figureyang
Tue Feb 18 2020, 04:59 AM
figureyang Avatar
Posted By figureyang
Tue Feb 18 2020, 04:50 AM
wounder Avatar
Posted By wounder
Mon Feb 10 2020, 03:32 AM
From below sample code for nuvoton 8051 timer0 mod...
Just4Fun Avatar
Posted By Just4Fun
Sat Feb 01 2020, 09:20 AM
If you want to use a CH55x MCU there isn't any adv...