.Net object, Read problems

1 回表示 (過去 30 日間)
animati
animati 2013 年 10 月 9 日
コメント済み: animati 2013 年 10 月 10 日
Hi sir, I'm living very strange problem. I'm using a .net class for serial communication. It's working very well, i can see how many data coming but never see 00 value... I didn't figured out why.. I'm able to sent any character to any device and any data rate (600-921600) and I can read any character except 0 (zero) value.
I'm working like that:
rx_available=uint32(0); TxQueue=uint32(0); num_rx=uint32(0); [status_rx,rx_available] =GetRxBytesAvailable(handles.PortOBJ, rx_available);
[status_Read,Rx_Data,num_rx] = Read( handles.PortOBJ,rx_available, num_rx);
and i try to see which data came,
Rx_Data.char or only Rx_data object , never see 0 (zero) character. How can I trabsform .net object to numeric or uint8 value.
I'm stuck in here... And after I want to share my FTDI-Xbee library, I hope...
Sincerely...
  3 件のコメント
animati
animati 2013 年 10 月 10 日
編集済み: animati 2013 年 10 月 10 日
Now, new problem is ready.... While i was using
Data=Rx_data.TocharArray
for i=1:Data.Length
if isemty ( Data(i) )
Data(i)=uint8(0)% problem solved this place
end
end
All Data member have to lower than 128 value... If we want to use 128-255 value, always came 63 value to us. I'm struggle on that problem now......
animati
animati 2013 年 10 月 10 日
編集済み: animati 2013 年 10 月 10 日
I builded byte array for this and problem solved......
Rx_data = NET.createArray('System.Byte',256);% for buffer
[status,rx_available]=PortObj.RxByteAvailable(Rx_data,rx_available);
% see how many byte came
[status,num]=PortObj.Read(Rx_data,rx_available,num);%
and all data is inside buffer.... How can we see? Like that
for i=1:rx_available
disp( Rx_data(i) )
end
Finally......................................

サインインしてコメントする。

回答 (0 件)

カテゴリ

Help Center および File ExchangeCall Web Services from MATLAB Using HTTP についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by