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

Wed Mar 25 2020, 09:39 AM
Tajammul
Sir kindly send the code file i2c for 8051
ExperimenterUK
Fri Mar 13 2020, 06:36 PM
@ Rohitnani,ABEBE..which project ?
Fri Mar 13 2020, 08:55 AM
ABEBE
how can get hadwere of this project
Rohitnani
Sat Mar 07 2020, 12:11 PM
Sir, Could you please send me the zip file input password....
Wed Feb 26 2020, 11:58 AM
Peter Parker
Is it possible to send multiple messages using only 1 GSM module?
Sat Feb 01 2020, 05:12 AM
Pearl Olin
Hello,
Wed Jan 22 2020, 01:16 PM
MINU CHAUDHARY
I m getting errors while simulation process during interfacing socket output and lcd... Can i get the report of ur project which is same as us.
Tue Jan 14 2020, 02:08 AM
shubham kharade
when i am trying to simulate the program in Proteus 8 professional, I am getting some errors as cannot find module file dhtxx.md can u help me
Tue Dec 17 2019, 08:44 AM
Devangi
hello..i am programming industrial timer using 8051 with 24lc64 eeprom. i have query in storing the 3 diff value in eeprom with enter button. can anyone share c code ?
Tue Dec 17 2019, 05:30 AM
Andrius
Hello. Can anyone share the code in Bascon and scheme in Proteus?

Downloads

Comments

ElizabethJuich
Wed Apr 01 2020, 09:24 AM
MichaelVaf
Tue Mar 31 2020, 07:49 AM
Antonduh
Tue Mar 31 2020, 12:58 AM
AndreySem
Mon Mar 30 2020, 01:35 AM
vityaCar
Sat Mar 28 2020, 11:21 PM
DeloresGrinc
Fri Mar 27 2020, 03:27 AM
Alexeyatola
Fri Mar 27 2020, 02:37 AM
RitaCar
Wed Mar 25 2020, 01:19 PM

Online

Guests: 52, Members: 0 ...

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

Members: 38139
Newest member: ElizabethJuich
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...