.Net object, Read problems

2 次查看(过去 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 CenterFile Exchange 中查找有关 Call 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