rs232 communication gui

9 views (last 30 days)
Prashant Funde
Prashant Funde on 28 Jan 2016
Answered: Walter Roberson on 28 Jan 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.

Answers (1)

Walter Roberson
Walter Roberson on 28 Jan 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.)

Categories

Find more on Data Acquisition Toolbox Supported Hardware in Help Center and File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!