Problem reading zeros from serial port

1 visualización (últimos 30 días)
Siam Hussain
Siam Hussain el 10 de Oct. de 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?

Respuestas (0)

Categorías

Más información sobre Use COM Objects in MATLAB en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by