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.

two microcontroller communication?

Status
Not open for further replies.

vicky29

Member level 4
Member level 4
Joined
Feb 5, 2005
Messages
75
Helped
3
Reputation
6
Reaction score
2
Trophy points
1,288
Activity points
750
microcontroller to microcontroller communication

hi friends

i want to communicate between two microcontrollers(89c51 ) using RXD & TXD pins, P3.0 and P3.1 respectively. should i need to connect TXD of Transmiter 89c51 with RXD of receiver 89c51 and vice -versa directly or should i use two MAX232 chips for communication.
please help
waiting for reply
neelam
 

techie

Advanced Member level 3
Advanced Member level 3
Joined
Feb 5, 2002
Messages
839
Helped
58
Reputation
116
Reaction score
9
Trophy points
1,298
Location
Pakistan
Activity points
7,802
microcontroller communication

As long as the power supplies are the same, you can connect the pins directly without using any drivers like max232. But it is sometimes dangerous if the 8051's are powered by 2 diff sources. A cheaper way is the use a TTL open collector gate to act as a buffer.
As a thumb rule, whenever I have both the 8051's powered by the same VCC, I connect pins directly and when I have diff sources, I use a TTL OC gate in between.
 

VVV

Advanced Member level 5
Advanced Member level 5
Joined
Nov 26, 2004
Messages
1,575
Helped
384
Reputation
768
Reaction score
88
Trophy points
1,328
Activity points
19,971
communication between microcontrollers

If they are in the same circuit and powered by the same source, connect the pins together.
If they will be in different circuits, and connected through cables, then use interface IC's.
 

IanP

Advanced Member level 7
Advanced Member level 7
Joined
Oct 5, 2004
Messages
7,929
Helped
2,311
Reputation
4,624
Reaction score
531
Trophy points
1,393
Location
West Coast
Activity points
66,416
how to communicate two microcontroller

Although, technically speaking, you don't need any drivers, but I would use 232 interface. And the reason is that if you encounter any problems with your software at one or the other end you will be able to connect your PC or laptop or any other port analyser and "see" what your microcontrolleres are trying to send/receive.
Once your system is running smoothly you can remove (or leave) 232 drivers.
Regards,
IanP
 

@t

Member level 3
Member level 3
Joined
May 14, 2005
Messages
66
Helped
5
Reputation
10
Reaction score
4
Trophy points
1,288
Activity points
1,724
8051 to 8051 communication

Also with different PSU's I would not put RS232 converters in between, just use
a protection resistor in each dataline.
The value depends on the distance (length of cable) you work with and the speed
of communication, but I would use 1k for 'on the bench' and about 120 ohm if you
span some meters.
RS232 officially will span 15 meters, but 50 can be reached if your baudrate is not
to high.
 

fuzzzy

Full Member level 3
Full Member level 3
Joined
Oct 2, 2004
Messages
156
Helped
7
Reputation
14
Reaction score
2
Trophy points
1,298
Location
ITALY
Activity points
1,650
max485 pic

You could also use RS485 device. For example I use Max485 to make 2 pic communicating both if they are on different boards with diferent power supply or if they are lying on the same board.
I think it would be very simple using I2C protocol to make communication instead of using TX and RX pins if MCU are on the same board.
Check if your MCU has an internal I2C HW.
 

ful babu

Full Member level 3
Full Member level 3
Joined
Nov 11, 2004
Messages
174
Helped
13
Reputation
26
Reaction score
3
Trophy points
1,298
Location
Singapore
Activity points
1,634
example of how link two microcontroller

fuzzzy said:
You could also use RS485 device. For example I use Max485 to make 2 pic communicating both if they are on different boards with diferent power supply or if they are lying on the same board.

i want to connect few PIC's with max485 can u giv me few good examples, code preference is c

thx
 

fuzzzy

Full Member level 3
Full Member level 3
Joined
Oct 2, 2004
Messages
156
Helped
7
Reputation
14
Reaction score
2
Trophy points
1,298
Location
ITALY
Activity points
1,650
pic max485 code

It's very very simple.

I haven't got a simple schemtic to upload now. i'll tell you in few words.
i use SN75176(texas) or max485(maxim) interchangeble.

You have to use Hardawre or software uart of PIC. connect TX(usually RC6) to PIN 4 of rs485 chip and RX(usually RC7) to PIN 1 of max485. Also I usually control TX(pin 2) and RX(pin 3) enable together by another PIC's Port(whatever).
Pins 5 and 8 are for power supply. and pins 6 and 7 (A, B) are for rs485 bus(all on the same line and all B on the other bus line). You have to connect all of your max485 in the same way.

To send or receive data is the same of simple rs232.if you use to program in C you can Use commands PUTC() or Printf() to send characters or strings.
and command kbht() and GETC() to control if byte has been received.

If you need more explanations tell me.
 

    V

    Points: 2
    Helpful Answer Positive Rating

hani salehi

Member level 2
Member level 2
Joined
Aug 31, 2004
Messages
44
Helped
4
Reputation
8
Reaction score
0
Trophy points
1,286
Location
IRAN - Isfahan
Activity points
339
communication between two 8051

hi
you don't need a max232 Ic ,
you must connect RX1 to TX2 and TX1 to RX2 ,
 

saeedakhan

Junior Member level 1
Junior Member level 1
Joined
Mar 1, 2005
Messages
15
Helped
1
Reputation
2
Reaction score
1
Trophy points
1,283
Activity points
1,407
pic18 max485

I think it would be very simple using I2C protocol to make communication instead of using TX and RX pins if MCU are on the same board.
Check if your MCU has an internal I2C HW.
 

antedeluvian

Full Member level 1
Full Member level 1
Joined
Apr 23, 2005
Messages
97
Helped
33
Reputation
66
Reaction score
17
Trophy points
1,288
Activity points
2,470
how to communicate between microcontrolers

See this thread for a simlar discussion
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Top