serial communication between microcontroller 8051 and matlab
Show older comments
i want to send information through matlab to 8051. to control the speed of motor.if any key is pressed the speed should up. and other key for down.
plzzzzzzzzzzzz help. i really need.
I am working through pwm. so if high pulse occur so motor get up,and if low pulse then motor speed down.
so I did this with external internpt in interrupt, so its working but with matlab its not working. im using imtool for this purpose
to understand the key i use sbuf reg in 8051,
org 0
mov tmod,#20h
mov th1,#-3
mov scon,#50h
setb tr1
here: jnb ri,here
mov a,sbuf
cjne a,#'a',n1
setb p2.0
acall delay
clr ri
sjmp here
n1: clr p2.0
acall delay
clr ri
sjmp here
delay:
mov r2,#255
h7: mov r3,#250
h8: djnz r3,h8
djnz r2,h7
ret
end
now you can understand my program easily. what will happen.
I am using keyboard
now you can get my all point.
please help
Accepted Answer
More Answers (3)
kanan baheti
on 17 Apr 2011
0 votes
can u post ur matlab prog here?????
1 Comment
muhammad yasir
on 17 Apr 2011
muhammad yasir
on 17 Apr 2011
0 votes
1 Comment
Walter Roberson
on 17 Apr 2011
If you had answered the questions put to you without a 1 1/2 day delay, would the situation still be "urgent" ?
If you want my attention "urgently" on a Sunday afternoon, you can book my time *in advance*, and you can pay my incremental costs for having to run my household errands during the week.
Stephen Justin
on 4 Feb 2023
0 votes
you need to changes the hexadecimal values are properly prefixed with 0x, the th1 is set to the proper value for 9600 baud rate -3, scon is set to the proper value for serial communication 0x50
1 Comment
Walter Roberson
on 4 Feb 2023
The code they posted back then uses
mov scon,#50h
I would have expected that the "h" suffix would indicate hexadecimal, and so 0x50 would not be required ?
Categories
Find more on COM Component Integration in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!