For Programmers: Free Programming Magazines  


Home > Archive > Matlab > April 2005 > matlab freezing while reading from serial port









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author matlab freezing while reading from serial port
os09626

2005-04-21, 4:03 pm

i have been encoutered with freezing matlab during read operation
from a serial port problem. i wonder if you can help me, i will show
you the code i wrote to send & receive a string. i tried to retrace
the program, but matlab in the receiving computer keeps freezing , i
don'y know why!
im using matlab 6.5 R13. your help will be appreciable. thanx in
advance.

%this code run on the sending computer
warning off
s1=serial('COM1');
fopen(s1);
s1
pause;
stringin = input('Hello','s');
disp(' ')
fprintf(s1, '%s\n', stringin);
s1
pause;
fclose(s1)
delete(s1)
clear s1


% & this code run on the receiving computer

warning off
s2=serial('COM2');
s2
pause;
fopen(s2);
s2
pause;
output=fscanf(s2);
disp(output)
fclose(s2)
delete(s2)
clear s2
Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com