Info

이 질문은 마감되었습니다. 편집하거나 답변을 올리려면 질문을 다시 여십시오.

problem with matlab code while receiving from nexys2 board

조회 수: 2 (최근 30일)
Jim
Jim 2013년 5월 19일
마감: MATLAB Answer Bot 2021년 8월 20일
Hi,
I am working with nexys2 board
From the nexys2 board I am able to send 2 bytes of data to matlab
But the problem is that matlab is not able to receive the data
Can anyone please explain me where is the problem
Code:
nexys = serial('COM1', 'BaudRate', 9600, 'Parity', 'odd', 'Terminator', '', 'Timeout', 1);
fopen(nexys);
myNum = 4563;
%fprintf(nexys, 'd1539'); %Fungerar
%fprintf(nexys, 'd%4d', myNum); %Fungerar
for i=1:2
fprintf(nexys, 's');
scan_s1 = fscanf(nexys,'%s')-0;
fprintf(nexys, 't');
scan_s2 = fscanf(nexys,'%s')-0;
end
%scan_s1 = fscanf(nexys,'%s')-0;
%s1_dec = char2dec('s1'); %Fungerar inte
%'!'-0
%double('a':'z')
sensor1 = scan_s1*2;
sensor2 = scan_s2*2;
Thanks in advance
  댓글 수: 2
Walter Roberson
Walter Roberson 2013년 5월 19일
Do you get the timeout message?
Jim
Jim 2013년 5월 20일
편집: Jim 2013년 5월 24일
Hi walter,
I am getting error like this
Warning: Unsuccessful read: A timeout occurred.
yes exactly the timeout error
Why I am getting this?
Can you please suggest something for this

답변 (0개)

이 질문은 마감되었습니다.

제품

Community Treasure Hunt

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

Start Hunting!

Translated by