Borrar filtros
Borrar filtros

rs232 communication gui

2 visualizaciones (últimos 30 días)
Prashant Funde
Prashant Funde el 28 de En. de 2016
Respondida: Walter Roberson el 28 de En. de 2016
I want to make communication in such a way that when there is no short created between pin no 2 and pin no. 3 for RS232 there should no data transfer or display on GUI, but as as i short pin 2 and 3 data should be displayed on GUI. I can do serial port setting with its baud rate in GUI but unable to do it in above manner.

Respuestas (1)

Walter Roberson
Walter Roberson el 28 de En. de 2016
In RS232, it is not possible to determine whether pin 2 (transmit) and pin 3 (receive) have been shorted. Data goes out on pin 2, data gets received on pin 3, and the device cannot tell that this is the result of a short and not the result of that particular data happening to be received right then.
Therefore the closest you could get would be to display everything you get on the serial input, and not have the receive tied to transmit except when you want it to be. However you do need to be careful to tie the receive to ground when you do not have it shorted to transmit: if you leave it floating then because signal presence is determined by difference between receive and ground, a floating receive pin can have phantom input.
The easiest way to do all of this is to look for the existing code in the File Exchange.
And as explained in http://uk.mathworks.com/matlabcentral/answers/265385-gui-to-make-usb-to-serial-communication#answer_207589 if you are not using an actual RS232 port and are instead using a USB to RS232 adapter, there is no chance at all of detecting the short. (There are special-purpose RS232 ports that can determine whether a short exists using TDR, time domain reflectometry, but you would need special drivers to be able to invoke that mode if you had such a device, which you almost certainly do not have.)

Categorías

Más información sobre Data Acquisition Toolbox Supported Hardware en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by