Timeout problem in matlab

Status
Not open for further replies.

xilinx1001

Member level 3
Joined
Apr 3, 2013
Messages
60
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,286
Activity points
1,781
Hi,

I am trying to read data through serial communication in matlab

I am reading 2 bytes of data

First byte is zero for most of the times and 2nd byte contains information.

I am getting timeout error
Warning: Unsuccessful read: A timeout occurred.

Is there any command to read data starting with zeros

Code:
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
Can anybody suggest something about this

Thanks
xilinx1001
 

Status
Not open for further replies.

Similar threads

Cookies are required to use this site. You must accept them to continue using the site. Learn more…