Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

DB9 methodology with microcntroller

Status
Not open for further replies.

RenesasT

Full Member level 2
Joined
Mar 11, 2016
Messages
149
Helped
0
Reputation
0
Reaction score
0
Trophy points
16
Activity points
1,330
Hi,

I want to ask a general question.
I am doing RS232 communication using max 232 IC. I am using BAFO cable. I am able to do communication. I just wanted continuous signal at microcontroller if cable is connected to computer.

Please suggest any solution for continuous signal at microcontroller.

What happen if I connect 9th pin i . e.RI pin of DB9 to 5th pin i.e . GND pin of DB9 connector.
 

RS232 CONNECTION.png

Connect RX(with a pull-up is good) & TX to micro controller. This will make the RS 232 Communication..
 

What happen if I connect 9th pin i . e.RI pin of DB9 to 5th pin i.e . GND pin of DB9 connector.

If I understand, you are looking for a way to tell if the connection is present or not. The RI pin is rarely used unless there is a dial-up modem on the cable so it is safe to connect it to something else, for example a loop to ground to detect whether the plug is inserted.

I use it on one system here to ICSP a microcontroller on a board while the DB9 still functions normally for serial data.

Brian.
 

Hi,

RI is the ring indicator .... it usually signals an incoming call.

I'd rather user DSR (data set ready) ... maybe CTS

Or a software solution. Just send a "dummy" byte to show activity.

Klaus
 

@brian- yes I need the same as you understood. I wanted to see if connection is there or not. I will use RI pin as GND and microcontroller pin as a pull up pin. Does this method will work to detect??.

@Klaus- I need continuous informatiom of connection. I think DSR pin will not help here. Also DSR is in between +12v to -12 V. If it is possible using DSR , please help.

About software, it is not possible because I am doing modbus communication . Is there any other way???
 

Hi,

Modbus will time out if the device does not repond.
Handle this 'time out' and you are as safe as can be.

Any other solution is just extra effort without much benefit.

Imagine:
You just tested the RI state, and it shows device is connected.
Now you start communication.
...during communication an error happens...either device software crashes, a wire in the cable is broken, or the device now gets completely disconnected.
Then what happens? As the master already started communication... how do you recognize/handle those error situations?
Two of them can't be detected with the RI state...and the other... does it make a difference?
I mean do you handle the RI fail differentely than a timeout? Why and How?

Klaus
 

Hi,

I will short RI (pin 9) and GND (pin 5) of DB9 connector. From microntroller side one pin is pulled up. Once DB9 is connected microcontroller pin will show logic low. If DB9 is not connected microcntroller pin will show logic high.

In this way I am thinking to do the connection is established or not.

Suppose anything would happen at RI or any +or - 12 signal came at RI then it will become grounded. There is no harm to my controller. In this way I am thinking.

Please let me know, this will work or not. Suggest any diff method if you have any.
 

RI is very rarely used these days and most DB9 adapter cables don't even connect it.

If in doubt about a driver being connected to it, you can use a pull-down resistor instead of a direct short to ground.

Brian.
 

Hello Betwixt,

How to use pull down. Can you please explain? This will shorten my circuit.

Please help me.
 

It just means use a resistor instead of a direct link to ground. On the microcontroller side you use a fairly high value resistor from the sense pin to VCC. As the microcontroller draws very litttle current on an input pin it will read as a logic high. In the plug you place a much lower value resistor, the 'pull-down' to GND. When the plug is inserted the high value resistor on the micro side and the lower value one in the plug make a potential divider, as long as the voltage at it's center is below logic '0' threshold it will let you detect the plug is inserted. It makes the plug safe to connect to other equipment without a short being present.

The alternative but similar method is to keep the RI and GND pins shorted in the plug but wire a pull-up resistor from the sense pin to VCC and another lower value resistor to the RI pin on the microcontroller side. That gives better protection to your microcontroller in case something with a 'live' RI signal is plugged in to the DB9.



Sorry for the scribbled drawing!
Suggest for the high value resistor you use 15K and for the low value one you use 1K. Assuming 5V VCC that gives you 5V on the sense wire with the plug removed and about 0.3V on it with the plug inserted.

Brian.
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top