필터 지우기
필터 지우기

.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