フィルターのクリア

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 Center および File ExchangeUse 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