how to interface 8051 and matlab

3 ビュー (過去 30 日間)
Ayesha ayub
Ayesha ayub 2014 年 11 月 15 日
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 件)

カテゴリ

Help Center および File ExchangeIntroduction to Installation and Licensing についてさらに検索

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by