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.

Connect more than one 89c52 to a PC serial port

Status
Not open for further replies.

eng_ahmed22

Full Member level 4
Joined
Jun 7, 2005
Messages
190
Helped
20
Reputation
40
Reaction score
5
Trophy points
1,298
Activity points
2,944
program 89s52 with 485

hi all
i face a problem.
i had design a circuit doing something, it has a serial interface with a PC. but tha problem is i want to install more than tow circuits, and i have only one PC means one serial port????
i am using 89c52.

anyone give me an aidea to interface more than one 89c52 to the serial port..plzzz

thanks alot

bye
 

IanP

Advanced Member level 5
Joined
Oct 5, 2004
Messages
7,942
Helped
2,309
Reputation
4,620
Reaction score
531
Trophy points
1,393
Location
West Coast
Activity points
66,435
89s52 connect rs232

One option will be to convert all signals from RS-232 to RS-485 (4 wires, full duplex), and then you can connect up to 32 of 89C52 to one serial port;
another option will be to use three-state RS-232 drivers, for example MAX233 ..
In both cases you will be able to connect several 89C52s to single serial port ..
Regards,
IanP
 

silvio

Advanced Member level 3
Joined
Dec 31, 2001
Messages
716
Helped
105
Reputation
210
Reaction score
16
Trophy points
1,298
Location
Romania
Activity points
11,471
how to use rs232 protocol in 89c52

As far as the hardware is concerned you'll have no problem. Just wired together the RX of first 89C52 with RX of 2nd 89C52 toward TX of PC.
Same diagram for TX of both 89S52 toward RX of PC.
It's harmless and RS232 specification easily meat as long as both 89S52 has power supply.
Let's assume that data flow isn't an issue, thus no need to worry about hardware hanshake (RTS - CTS).
Now only one thing left, but the most important especially for the PC RX line. Otherwise you can't link TX lines of both 89S52 in parallel, without conflict arrise.
How the PC knows from which 89C52 data is coming from ? How the 89C52 knows which data belongs to it and when is allowed by the PC to deliver data?
The Intel 8051 designer thought about that and provides the magic SM2 bit.
Read more about a way to use this feature in multiprocessor system https://www.semiconductors.philips.com/acrobat_download/various/80C51_FAM_HARDWARE_1.pdf
page 9. Unfortunatelly this solution is viable only when both 89S52 behaves as slaves. As long as both 89S52 share the same TX line, they can't send data until the other is iddle and as answer to PC's querry. Nevertheless when 89S52 talks must identifies himself in order that PC to figure out who's talking from network if the PC issued a broadcast querry (for both 89S52).
If the 9th bit in your PC program is an issue or you want a full communication (no mesh networking - means no communication between two 89S52, but only between either 89S52 and PC), then the only solution is using a protocol able to solve the problem "which one is talking on serial line to which and when".

However for software issues you can better listen to IanP's advices here :
 

artem

Advanced Member level 4
Joined
May 22, 2003
Messages
1,350
Helped
126
Reputation
252
Reaction score
32
Trophy points
1,328
Location
Turkey
Activity points
13,450
can rs232 89s52

silvio , it is possible to overcome this problem with same time slave sending issues. If organize slave transmission as differential pair or single current sources and multiply slave output bytes with ortogonal codes - slaves will be ale to send data at same time .
Xexe, looks too complicated and almost cdma approach . But it is very funny to implement .
On reception side master should use ADC and decode data using same aproach given that it knows code per each slave.
Implementing this approach not only on Rx but on Tx as well will let us construct embedded device network with no master-slave relationship.
We will need just one stupid embedded device to implement sync burst or similar.

eng_ahmed22, please disregard above as it is better to go with IanP's approach - RS485. But you need arbitrating protocol to exchange data between slaves and master. let say , you can modify X10 to meet your specific requirements .
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Top