serial communication between microcontroller 8051 and matlab
이전 댓글 표시
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
채택된 답변
추가 답변 (3개)
muhammad yasir
2011년 4월 17일
0 개 추천
댓글 수: 1
Walter Roberson
2011년 4월 17일
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
2023년 2월 4일
0 개 추천
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
Walter Roberson
2023년 2월 4일
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 ?
카테고리
도움말 센터 및 File Exchange에서 COM Component Integration에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!