.Net object, Read problems

1 visualización (últimos 30 días)
animati
animati el 9 de Oct. de 2013
Comentada: animati el 10 de Oct. de 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 comentarios
animati
animati el 10 de Oct. de 2013
Editada: animati el 10 de Oct. de 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 el 10 de Oct. de 2013
Editada: animati el 10 de Oct. de 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......................................

Iniciar sesión para comentar.

Respuestas (0)

Categorías

Más información sobre Call Web Services from MATLAB Using HTTP en Help Center y File Exchange.

Community Treasure Hunt

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

Start Hunting!

Translated by