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.

Help me out with RS485 interface

Status
Not open for further replies.

jit_singh_tara

Full Member level 6
Joined
Dec 22, 2006
Messages
325
Helped
9
Reputation
18
Reaction score
4
Trophy points
1,298
Location
Delhi , India
Activity points
4,293
hi friends , has any one ever used rs485 chip , ltc485 or adm485 !i want to know practically interfacing idea !
 

Re: rs485 ?

Hi!
I have used SN75176 from texas instruments. RS485 is a differential bus system. Interfacing is very easy. The RS485 chip has the TX and RX pins and a another couple of pins to select the mode for the chip because RS485 is half duplex i.e you can either receive or transmit at a time. The TX and RX pins are connected to the standard Tx and Rx pins (USART) of the microcontroller. When data is to be transmitted the chip is set into the transmit mode and when data is to be recieved the chip is set in the receive mode.
Regards.
 
Re: rs485 ?

Depends on what you want to do... just connect 2 systems together, create a network with many systems. If there are many systems are you going to use half or full duplex? (full uses double the number of components and wires) if half and many devices, do you need collision detection?
So explain exactly what you want to do and then we can make the right suggestions
 
Re: rs485 ?

a network of 3 controllers connected to 3 rs485 .

1 master and other 2 slaves .master sends data and address oF slave , both receives data but the one whose address matches responds by blinking led .
 

Re: rs485 ?

Hi,
Use a full duplex network using MAX 491 IC, if you are not much worried about one more extra pair of wires., but avoids a lot of timing problems. For more details, look for MAX 491 applications at Maxim's site.

Regards,
Laktronics
 
Re: rs485 ?

my communication is from controller to rs485 transmitter - twisted pair cable - rs485 receiver - max232- pc .


in the twisted pair if i remeove 1 wire , the communication still continues , i want to know how this is happening ,
 

Re: rs485 ?

Hi,
In RS485, the D+ output signal will vary in phase with input signal and D- will be inverted output of input signal when seen with respect to ground. The idea in sending the signal over a twisted pair as differential D+ and D- is to reduce the effect of noise signal picked up equally in phase ( becomes common mode) on both the wires and thus gets mostly cancelled at the differential input receiver. If you remove one wire, you will still get the signal through the otherwire, but the noise picked up will not be cancelled. Also by reversing the wires at the receiver end you can get back the original TTL signal as direct or inverted.

Regards,
Laktronics
 
Re: rs485 ?

in the data sheet of max485 , it is written that :
if a=-b >= 200mv, ro = 1
if a - b <= 200mv , ro = 0;

what does this 200mV means , does it mean that if the wire becomes too long the signal amplitude will be reduced to around 200 mv , but the ic will give output a full high 5V.

what use the subtraction of two signals provide.
 

Re: rs485 ?

Hi,
Yes, you are right, the differential receiver which computes a-b of the input signal can work down up to 200mV and will produce the logic output correctly up to this level. Also, I think there is a hysterisis in the receiver and a biasing to ensure that an open input produces a known level at its output.

Regards,
Laktronics.
 
Re: rs485 ?

Tie the read enable to ground. This allows you to monitor the data sent to slaves and see if a collision occurs. Control the write enable with cpu sending data. All devices should be in receive mode if not transmitting or else you will get collisions. D- output should have a 1K resistor to 0v and D+ a 1K to 5v. This sets network to a known condition and allows you to uses an interrupt to detect the presence of data on the network. The last device should have a terminating resistor across the D- and D+. This should be about 220ohm.
I have used this configuration to link about 100 devices together using 10 sub networks of 10 devices each connected to main network which connected to a PC. They could all be masters / slaves. This makes work tough because you have to handle collisions. If you have only one master and all others are slaves then it is easy. Slaves only reply to masters request and then you don get collisions.
 
rs485 ?

RS485 is just a physical interface, any address decoding to flash leds etc needs to be done at the receiving end by a micro or decoder ic. Nothing to do with the RS485, that just carries the data about.
 
Re: rs485 ?

thanks a lot for such a great help . i would like to know what does extended common mode range (12v to -7v) in the datasheet of max485 means , please clarify my this doubt,
 

Re: rs485 ?

I have not checked the data sheet and might be wrong about this, but I think that they are talking about the difference in voltage between 2 devices on your network. But the best way to get around this is to also connect the 0 volt rail of the 2 devices, this ensures that there will be little difference in voltage. I must point out that this might not always be possible / desirable,I might be better to optically isolate the systems. In all of the rs485 systems that I have put together I connected them together. For example one system is working in a yard where they build shipping containers. The device are about 1000 meters apart and there is a lot of electric welding happening in the area. The connection was done using twisted pair, shielded cat 5 cable which had the 0 volt of each device's power supply connected to the cables shield. This works well and I have few problems with the system.
 
Re: rs485 ?

hi friends ,


i am using 2 controllers one as transmitter and other as receiver over rs485 network, i mean a pair of twisted pair cable.

i send 5 bytes of data , but the first byte i receive is always 0x00. followed by my desired first 4 bytes.

please suggest how to proceed.

Added after 1 hours 17 minutes:

i figured it out , i was pressing reset of transmitter microcontroller , and it was sending 0x00 to receiver......as the first byte of reception because receiver was in continous reception mode.....

i was mistaken the problem still exists ...the transmission is right all 5 bytes transmitted,

what i am doing is after transmitting through rs485 tx i am putting microcontroller in receiving mode ... so the bytes which i transmitted to other controller i am sending back from it , but i am missing 2 bytes at the receiving end...it is taking 2 bytes as 0x00 0x00;


any solutions...
 

Re: rs485 ?

Remember the processor converts the data to serial which takes a few clock cycles depending on baud rate, you must make sure that the byte has been sent before changing to receive mode. This is usually done by checking a status flag or if you are using interrupts, when the interrupt occurs once the byte has been sent.
It is easier if you send a packet start character and a packet end character, that way you will only accept data if it falls between these characters.
What processor are you using? Some processors allow for automatic address recognition, the 8051 for example can be set up that it will only generate an interrupt if it recognizes it's own address.
 
Re: rs485 ?

thanx davidgrm , i am using microchip microcontroller.


here is a new thing i found .

1. if i remove the rs485 bus between two controllers and connect tx and rx on corresponding rx and tx of another controller , the communication is fine, i am able to send 5 bytes from transmitter to receiver and receive the same bytes from receiver on transmitter(direction change). but when i connect rs485 twisted pair cable , the communication from transmitter is fine but from receiver i miss 1 byte , the transmitter controller reads it as 0x00 followed by the destined 5 bytes which receiver send.


i want to know does this happen in this way ....!!!


i tried your packet start character and my first byte 0x00 error is resolved now , now i first try to receive start byte , and cosecutively receive the following byte .it worked.
 

Re: rs485 ?

which config(half duplex or full duplex) suits best in one master multi slave mode...
in rs484 network....
 

Re: rs485 ?

Hi,
Probably nothing much to choose, except that for a full duplex system, the timing issues are less, since the buss direction need not be switched between messages. It works like an extended RS232. But in this case, you need to maintain one more pair of wires and connections.
Finally for series connected RS 485, a malfunctioning of any intermediate node or cable section can affect the functioning of rest of the nodes down the line and it is a serious limitation.

Regards,
Laktronics
 
Re: rs485 ?

my rs485 is working fine now, i was having grounding issue....

the place where i was keeping my pcb ( micro + max485) , was not properly grounded , so some interference was there.....
i am astonished how this could affect the system so much....
so it is a suggestion from my side to all friends..... that noise , electromagnetic interference could be a serious problem..... please take care of it....
 

rs485 ?

hi laktronics , i need to know one more thing about rs485.... the termination resistance resistance 120 ohm , is it necessary to connect termination resistance at each node....in half duplex mode....i know its for impedance matching ,something like this , could you tell me the precise answer.
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top