how to interface 8051 and matlab
1 visualizzazione (ultimi 30 giorni)
Mostra commenti meno recenti
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 Commenti
Risposte (0)
Vedere anche
Categorie
Scopri di più su Standard File Formats in Help Center e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!