Problem reading zeros from serial port

1 view (last 30 days)
Siam Hussain
Siam Hussain on 10 Oct 2014
I am reading binary data from FPGA through COM port. Here is the code I am using
delete(instrfindall);
clear s
s = serial('COM4'); %assigns the object s to serial port
set(s, 'InputBufferSize', 256); %number of bytes in inout buffer
set(s, 'FlowControl', 'software');
set(s, 'BaudRate',115200 );
set(s, 'Parity', 'none');
set(s, 'DataBits', 8);
set(s, 'StopBit', 1);
set(s, 'Timeout',10);
fopen(s);
x = fread(s, 256, 'uint8');
fclose(s);
It reads all the values except zero. If a zero appears in the stream it discards that value and read the next value. If I send constant 0s it displays the warning "Warning: Unsuccessful read: The specified amount of data was not returned within the Timeout period."
Cam someone please help me solve this?

Answers (0)

Community Treasure Hunt

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

Start Hunting!