.Net object, Read problems

1 Ansicht (letzte 30 Tage)
animati
animati am 9 Okt. 2013
Kommentiert: animati am 10 Okt. 2013
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 Kommentare
animati
animati am 10 Okt. 2013
Bearbeitet: animati am 10 Okt. 2013
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 am 10 Okt. 2013
Bearbeitet: animati am 10 Okt. 2013
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......................................

Melden Sie sich an, um zu kommentieren.

Antworten (0)

Kategorien

Mehr zu Call Web Services from MATLAB Using HTTP finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by