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.

Communication between microcontrollers using Rs485

Status
Not open for further replies.

Debasis Swain

Member level 2
Joined
Feb 2, 2013
Messages
52
Helped
10
Reputation
20
Reaction score
10
Trophy points
1,288
Activity points
1,606
I need help to creat a code(.asm) for communication between multiple microcontrollers using RS485.So,pls help me with some sampule code (Using At89s51/52)
 
Last edited:

It is nothing different from UART code.

Just implement the UART code and switch the direction control pin of the RS485 driver IC, through a I/O pin of MCU.
This will switch the MCU in master or slave mode accordingly
 
can it possible a MCU using as both master or slave at a time
 

i also have the same question how to select which 1 is master and which 1 is salve
 

Only 1 master per RS485 bus, hardwired and impossible to change after network setup.

Multi master RS485 are theoretically possible, but very hard to implement and is much cheaper to go for another multi master bus.

Basically RS485 works like this:
- master addresses a slave;
- slave responds;
- master addresses another slave;
...

You need to implement addressing in your protocol.


PS: this sounds like a homework, especially because you need 8051 assembly code
 

Only 1 master per RS485 bus, hardwired and impossible to change after network setup.
In a RS485 bus, definition of master/slave role is a pure software matter.


Multi master RS485 are theoretically possible, but very hard to implement and is much cheaper to go for another multi master bus.
Not only theoretically possible but widely used in industrial communication. RS485 is only the physical layer (OSI layer 1) and not fixing master/slave role. In a multi-master RS485 bus, there must be a layer 2 protocol that dynamically assigns the master role to different nodes. PROFIBUS is e.g. using a token passing scheme to assure that only one master is trying to control the bus at a time.
 

RS485 is half duplex so u can send data or recive data at a time.
and both can be posible by increase wire counts.
 

RS485 is half duplex so u can send data or recive data at a time.
and both can be posible by increase wire counts.

Multi wire RS485 is not RS485 !

Is RS422 !

- - - Updated - - -

PROFIBUS is e.g. using a token passing scheme to assure that only one master is trying to control the bus at a time.

Can we have an implementation ?

I have tried to do that but it is way cheaper to go to another bus.
 

Multi wire RS485 is not RS485 !

Is RS422 !

- - - Updated - - -



Can we have an implementation ?

I have tried to do that but it is way cheaper to go to another bus.


BOTH RS422 AND RS485 can be either 2-wire (half duplex) of 4-wire (full duplex) configured. The differences are in the characteristic impedances of the devices, termination, and node topologies defined (RS422 = 1 Master, multiple (10) slaves; RS485 = 32 unit loads, can be mixture of Masters (drivers) and slaves (receivers). Many RS485 transceiver components will work fine on RS422 systems by design, but not all RS422 components will work on RS485 systems because of the impedance/unit load issue, and differences in sensitivity.

Profibus is a standard which you will need to join an organization to have it certified that it is compliant, if you wish to advertise and connect to other Profibus devices. however, you can implement your own simple networking scheme which is very similar.
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top