필터 지우기
필터 지우기

Problem reading zeros from serial port

조회 수: 2 (최근 30일)
Siam Hussain
Siam Hussain 2014년 10월 10일
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?

답변 (0개)

카테고리

Help CenterFile Exchange에서 Use COM Objects in MATLAB에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by