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.

Problem with Master - Multi slave communication

Status
Not open for further replies.

rushi53

Member level 2
Joined
Aug 19, 2009
Messages
46
Helped
2
Reputation
4
Reaction score
1
Trophy points
1,288
Location
India
Activity points
1,632
I am working on a project in which a Master microcontroller has to communicate with 3 slave microcontrollers (all are 89s51)

I have to implement following steps:
1. Master will select slave by sending device address.
2. Then selected slave will perform the action
3. Then that slave will send data to master microcontroller.

My Problem:
Step 1 and 2 are working fine
But Step 3 is not working.

When I connect only 1 slave to master microcontroller then all 3 steps are working.

Please see the attached image



Please help me on this...
 

Hii, I Think I see your problem

Master slave communication can be made by 2 protocol (I think) :
1. SPI
2. RS-485 Multinode

If I see your configuration schematic, you just use UART it means sigle node communication. For RS-485 you have to add some device for protocol example max 485. (if you use this you don't have to use max 232).

you can see the detail in this link **broken link removed**

and for Master Slave Communication the setting of is diffrent.
for UART 9600 bps 8 bit.
for master slave communication 9600 bps 9bit.

And you must declare the address of master and slave please check this sample.


this take from atmel appnote for master initialization :
Void initmaster(void)
{
SCON = 0xfo // uart in mode 3
$ADDR = 0X01 // this master addres
$ADEN = 0Xff // addres mask
TMODE = TMOD | OX20 // timer 1 in mode2
THI1 = oxfd // setting baudrate 9600 bps
TL1 = 0xfd
ES=1 // enable serial interrupt
EA = 1 // enable global interrupt
TR = 1 // start timer 1 running
}

this take from atmel appnote for slave initialization :
void initslave()
{
SCON = 0xfo // uart in mode 3
$ADDR = 0X03 // this slave addres
$ADEN = 0Xff // addres mask
TMODE = TMOD | OX20 // timer 1 in mode2
THI1 = oxfd // setting baudrate 9600 bps
TL1 = 0xfd
ES=1 // enable serial interrupt
EA = 1 // enable global interrupt
TR = 1 // start timer 1 running
}

Please check this link for more detailed sample source code :
UART Master Slave
http://www.atmel.com/dyn/resources/prod_documents/doc4346.pdf
SPI Master Slave
http://www.atmel.com/dyn/resources/prod_documents/doc4348.pdf

Hope this help U

Deny(Bodat'z)
 

Hi "the_balistic", thanks for the reply....

You said that there are 2 ways
1. SPI and 2. RS-485 Multinode

But I have already made/soldered 4 PCBs(1master, 3slaves)
so it will be difficult to replace MAX232 by MAX485

So I will go for 1st option(SPI)

Once again thanks, I will implement changes suggested by you and will revert back
:)
 

HI

According to the connection schematic multi master using RS232 will not work

You need to connect TX line via a switch or a multiplexer who can handle RS232 voltage level - like CD4051 or a relay

All the best

Bobi

The microcontroller specialist
 

Hi "bobcat1",
I have gone through datasheet of "CD4051BC", it is 16 pin IC
out of which 8 pins are output/ip, 1 is input/op
3 pins are for Adds select ABC, 1 is INH
I understood all these pins.

But I didn't understood the meaning of VEE, VDD and VSS
Which is 5v/Gnd/12v or 15v

Please guide me in this regard.
 

You may want to use also RS232 driver chips, that have a selective transmitter shutdown, e.g. MAX3222. They are basically
suited for a mutidrop RS232.

CD4000 series CMOS multiplexer are not capable of driving full RS232 levels due to supply voltage restrictions. They are often
used with a reduced +/- 5V level.
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top