Azzera filtri
Azzera filtri

Problem reading zeros from serial port

2 visualizzazioni (ultimi 30 giorni)
Siam Hussain
Siam Hussain il 10 Ott 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?

Risposte (0)

Categorie

Scopri di più su Use COM Objects in MATLAB in Help Center e File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by