how to interface 8051 and matlab

4 vues (au cours des 30 derniers jours)
Ayesha ayub
Ayesha ayub le 15 Nov 2014
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

Réponses (0)

Catégories

En savoir plus sur Standard File Formats dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by