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.

Want to receive data in microcontroller

Hayee

Junior Member level 3
Junior Member level 3
Joined
Mar 4, 2022
Messages
26
Helped
0
Reputation
0
Reaction score
0
Trophy points
1
Activity points
216
Hi Guys
I have a scenario in which two devices are connected with rs232 protocol. Device 1 asks for some data and device 2 provides the data to device 1.
Now what I want to do is to add a microcontroller which also send command to Device 2 to get some data. Here I attached the image which shows the scenario.
Device 1 asks for data at a defined interval so my microcontroller will ask for data from Device 2 at a pre-time interval.
My question is Can I do something like that as shown in the picture by placing Diode at Tx side of Both Device 1 and Microcontroller?
Maybe it looks so simple but actually this cannot be achieved.
Required suggestions from your side.
serial data scenario.jpg


Thanks and best regards
 

KlausST

Super Moderator
Staff member
Advanced Member level 7
Joined
Apr 17, 2014
Messages
23,269
Helped
4,741
Reputation
9,503
Reaction score
5,127
Trophy points
1,393
Activity points
154,156
Hi,

RS232 is no protocol.

And diodes without pullup/pulldown resistor don't work.
And the polarity of the diodes is wrong, because UART signals are idle HIGH.
... did not look more deeply.

No elaborated concept.

Klaus
 

danadakk

Advanced Member level 5
Advanced Member level 5
Joined
Mar 26, 2018
Messages
2,296
Helped
351
Reputation
720
Reaction score
530
Trophy points
113
Activity points
10,092
If you have a timed idle state (time of day from internet or the like), eg. never a possibility of a collision
I see where one user implemented design with 4052 dual 4-to-1 multiplexer. To mux Rx and Tx lines.
But Mux control becomes some part of a protocol, be it HW or SW or both....

One can think instead of mux using tristate buffers, of course they would have to handle RS232
levels.


Regards, Dana.
 

FvM

Super Moderator
Staff member
Advanced Member level 7
Joined
Jan 22, 2008
Messages
50,996
Helped
14,632
Reputation
29,540
Reaction score
13,741
Trophy points
1,393
Location
Bochum, Germany
Activity points
291,765
The original post is stating RS-232 interface, this would imply negative idle state. A microcontroller would need a driver to convert UART level to RS-232.

The diode OR-circuit can well work if you add a pull-down to negative level for RS-232. Problem of possible collisions has to be handled on the protocol layer. Most existing techniques are for half-duplex interfaces like RS-485, where each host reads the transmitted data of all peers, e.g. PROFIBUS token passing method.
 

Hayee

Junior Member level 3
Junior Member level 3
Joined
Mar 4, 2022
Messages
26
Helped
0
Reputation
0
Reaction score
0
Trophy points
1
Activity points
216
Thanks guys for your suggestions.
Yes Device1 will ask for data on timely basis like after every 5 mins. and my microcontroller will ask for data in between this time.
Device 1 and Device 2 have installed Max232 IC for conversion and I will also use Max232 with my MicroController.
Can I just connect Tx of device1 and microconroller with Rx of Device 2 with out using Diode and pull down resistors?
 

KlausST

Super Moderator
Staff member
Advanced Member level 7
Joined
Apr 17, 2014
Messages
23,269
Helped
4,741
Reputation
9,503
Reaction score
5,127
Trophy points
1,393
Activity points
154,156
Hi,

I have two transmitters, 1st is Device 1 and 2nd is Microcontroller.

In post#6 you asked this.
Can I just connect Tx of device1 and microconroller with Rx of Device 2 with out using Diode and pull down resistors?
I see only one Tx in this question.

Klaus
 

Hayee

Junior Member level 3
Junior Member level 3
Joined
Mar 4, 2022
Messages
26
Helped
0
Reputation
0
Reaction score
0
Trophy points
1
Activity points
216
Hi,



In post#6 you asked this.

I see only one Tx in this question.

Klaus
No no. My bad, may be I mistakenly type it. actual scenario have two transmitter and I asked if i don't use diode then what will happen or can I not use diode

1677756101889.png
 

Hayee

Junior Member level 3
Junior Member level 3
Joined
Mar 4, 2022
Messages
26
Helped
0
Reputation
0
Reaction score
0
Trophy points
1
Activity points
216
I think he does not understand what is a basis of electronics, no matter
Do you know where to put a pull-down resistor and of what value? kindly guide me, is it before diode or after diode? and is the direction of diode will be reverse?
--- Updated ---

I believe the question was already answered.
Dear FvM
are you saying to do like that
1677780374133.png
 
Last edited:

KlausST

Super Moderator
Staff member
Advanced Member level 7
Joined
Apr 17, 2014
Messages
23,269
Helped
4,741
Reputation
9,503
Reaction score
5,127
Trophy points
1,393
Activity points
154,156
Hi,

I have to admit that my post#3 wast partly wrong.
If you really use RS232, then idle HIGH means low voltage.
Thus the diode orientation of post#1 is correct. Anode to RS232 transmitter. You need a resistor to -Vs.

*****
Now the qestion: why RS232 at all?
What baud rate, what wire length, what cable type?

Klaus
 

Hayee

Junior Member level 3
Junior Member level 3
Joined
Mar 4, 2022
Messages
26
Helped
0
Reputation
0
Reaction score
0
Trophy points
1
Activity points
216
Hi,

I have to admit that my post#3 wast partly wrong.
If you really use RS232, then idle HIGH means low voltage.
Thus the diode orientation of post#1 is correct. Anode to RS232 transmitter. You need a resistor to -Vs.

*****
Now the qestion: why RS232 at all?
What baud rate, what wire length, what cable type?

Klaus
regarding your question why RS232 at all this is because other two devices (Device1 and Device2) are of other company and they are using RS232 Signaling. So at microcontroller side I have to use RS232 signaling as well.
I can't use TTL Level
Baudrate is 9600
Wire Length 3ft to 4ft
 

FvM

Super Moderator
Staff member
Advanced Member level 7
Joined
Jan 22, 2008
Messages
50,996
Helped
14,632
Reputation
29,540
Reaction score
13,741
Trophy points
1,393
Location
Bochum, Germany
Activity points
291,765
Signal-level-wise, post #14 scheme works correctly. But it doesn't solve the problem of possible signal collisions if both transmitters are sending simultaneously. In contrast to a multi-drop RS-485 network, the transmitters have no means to detect collisions directly.
 

Hayee

Junior Member level 3
Junior Member level 3
Joined
Mar 4, 2022
Messages
26
Helped
0
Reputation
0
Reaction score
0
Trophy points
1
Activity points
216
Signal-level-wise, post #14 scheme works correctly. But it doesn't solve the problem of possible signal collisions if both transmitters are sending simultaneously. In contrast to a multi-drop RS-485 network, the transmitters have no means to detect collisions directly.
For the collision,
what's in my mind, Rx of Device1 and Microcontroller are tied togeather. and serial interrupt at microcontroller side already ENABLED and receive the data. from which I can realize that Device1 is in communication. Also there is a time pattern from Device1, After every 5 minutes Device1 ask for data from Device2.

Is my this scheme is valid or some other thing to add up?
 

KlausST

Super Moderator
Staff member
Advanced Member level 7
Joined
Apr 17, 2014
Messages
23,269
Helped
4,741
Reputation
9,503
Reaction score
5,127
Trophy points
1,393
Activity points
154,156
Hi,
Signal-level-wise, post #14 scheme works correctly

Correct me if I'm wrong:
UART is idle HIGH, TTL level HIGH, RS232 voltage negative.
So in idle state
* upper RS232 driver drives negative through diode (sadly the schematic misses designators for clear communication)
* upper resistor pulls negative
* lower RS232 driver drives negative through diode
* lower resistor pulls negative
I see no possibility for the drivers to pull positive, and the resistors don't anyways.
So how can the receiver see positive voltage = logically LOW?

Still to consider: (besides the bus collission problem)
What happens to the signal levels if one driver is not powered up?
Also how does the unpowered driver react in this case?

Klaus
--- Updated ---

Added...
Post#18: I can't see how the microcontroller can detect that device 1 is sending.
There is no connection from device1_Tx to microcontroller_Rx. (Referring to schematic of post#1)

Microcontroler Rx just sees device2_Tx .... but this does not solve the collission problem .... unless there is a specified time scheme.

Klaus
 
Last edited:

Hayee

Junior Member level 3
Junior Member level 3
Joined
Mar 4, 2022
Messages
26
Helped
0
Reputation
0
Reaction score
0
Trophy points
1
Activity points
216
Hi,


Correct me if I'm wrong:
UART is idle HIGH, TTL level HIGH, RS232 voltage negative.
So in idle state
* upper RS232 driver drives negative through diode (sadly the schematic misses designators for clear communication)
* upper resistor pulls negative
* lower RS232 driver drives negative through diode
* lower resistor pulls negative
I see no possibility for the drivers to pull positive, and the resistors don't anyways.
So how can the receiver see positive voltage = logically LOW?

Still to consider: (besides the bus collission problem)
What happens to the signal levels if one driver is not powered up?
Also how does the unpowered driver react in this case?

Klaus
--- Updated ---

Added...
Post#18: I can't see how the microcontroller can detect that device 1 is sending.
There is no connection from device1_Tx to microcontroller_Rx. (Referring to schematic of post#1)

Microcontroler Rx just sees device2_Tx .... but this does not solve the collission problem .... unless there is a specified time scheme.

Klaus
Dear KlausST
First we clarify the hardware side. what should be done. I am confusing someone says it is correct some says it will not work :confused:
 

LaTeX Commands Quick-Menu:

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Top