how to interface 8051 and matlab
1 回表示 (過去 30 日間)
古いコメントを表示
im trying to turn led on and off by sending an 'o' for on and 'f' for off serially from matlab to (at89c51) the problem is nothing is happening and both my cods are error free. i have never done serial communication before so i have little idea of what im doing wrong. please help! here are my codes:
for 8051
org 100h
mov tmod,#20h
mov th1,#-3
mov scon,#50h setb tr1
again: jnb ri,here
mov a,sbuf
cjne a,#'o',ledoff
setb p2.0
ledoff: clr p2.0
clr ri
sjmp again
end
.................................................. ..................................................
for matlab:
>> s = serial('COM1','baudrate',9600);
>> fopen(s)
>> a=inputdlg('enter o to turn led on and f to turn it off','s');
>> fprintf(s, 'a');
>> fclose(s)
>> clear s
0 件のコメント
回答 (0 件)
参考
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!